• Editor
  • Normalize lowest Y-Position for all animations?

Hello,

Does Spine have a built-in method to make all animations have the same minimum Y- position?

For example:
My character's Idle animation is just on top of the line in Spine.

But a chunk of my characters shoes dip below the line in her walking animation.

Because of this, when I position my character perfectly on the ground in Unity, part of her shoes disappear into the ground when her walking animation plays.

I was wondering if there's a simple way to avoid this so that my character will always stay perfectly on the ground in Unity. Is the only option manually animating everything to be on the 0 line in Spine. Any guidance or advice would be greatly appreciated!

    Related Discussions
    ...

    How are you rendering animations in Unity?

    If you are using spine-unity then setting the position of the Spine gameobject corresponds to the world 0,0 position and your animations will all use the same reference point.

    Are you exporting images and rendering frame-by-frame animations? There are two ways to solve this:

    You can place a transparent image in Spine that is the maximal bounds of all your animations. When you export images, they will all have that common size. Whitespace stripping when packing an atlas removes the blank space.

    Another way to do the same is to check Maximal bounds when exporting your images, but then you need to export ALL your images at once. With the transparent image, you can export a single animation with maximal bounds.

    The second solution is that when exporting an image sequence and packing it into an atlas, the world origin is written to the atlas file for each frame. It appears in the atlas data as origin and has an X and Y value. If you draw all your images using the origin as an offset, they will be positioned relative to the same point and frames won't jump around.

    FWIW, most Spine users are using spine-unity, as that provides the many benefits of skeletal animation.

    PayasoPrince I was wondering if there's a simple way to avoid this so that my character will always stay perfectly on the ground in Unity. Is the only option manually animating everything to be on the 0 line in Spine. Any guidance or advice would be greatly appreciated!

    One simple solution if you just want to prevent anything underground being visible is to move your ground objects closer to the camera than the characters to render them on top of the character and conceal any parts underground.

    Moving the whole character upwards programmatically to not have parts underground seems like a rather problematic workaround, as it will introduce movement which might look off, trading one problem for another. If you have working IK leg setup already, it might be better to move just the foot target IK bones upwards by the respective amount that they are underground. This could be done programmatically without using any spine-unity components, or by using a SkeletonUtilityBone with mode Override.

    If you should ever need to adjust feet to a slanted ground or steps at a staircase, you could have a look at the SkeletonUtility GroundConstraint component, demonstrated in the Spine Examples/Other Examples/SkeletonUtility GroundConstraint example scene.

    However, the simplest solution might be to adjust your animation accordingly in the first place.