- Home /
How to make a sprite stay at a consistant baseline during animation?
So I have an interesting problem concerning animation. I know exactly what is happening but I don't know how to fix it. I am using a sprite sheet (yes its from Tales of Phantasia and yes I know it's copyrighted and all) with an attack animation that has a sword that goes below the sprite. This causes the animation to actually raise the player part of the sprite when animating because the sprite itself is reading the bottom of the sword as the bottom of the sprite when in reality the sprite is higher. The only way I can think to currently fix is to animate the entirety of the object along with it (the collider, my checkers, etc.). I feel like this will be very, very difficult to change all of this every single frame. Is there a way you can set the baseline of a sprite or a quick fix for this sort of thing? I feel like it will come up a lot in the future.
Answer by IvovdMarel · Jun 10, 2014 at 05:43 AM
Unity2D Sprite has the 'Pivot' option which allows you to create a custom pivot point.
This works, but to expand on your answer in order to give other readers more clarity on how this actually fixes it. I went into the sprite editor and moved the pivot point on my sprites to a consistent location on the sprite itself. In my case, the first animation had it near the mouth and left eye. So, in order to maintain the consistent animation I had to move the pivot point to that location on each sprite even though it wasn't the "middle" of the entire sprite. I did it by eyeball as I could not think of a helpful math equation or anything to help out, as the pivot point can only be set in terms of the sprite(0.0-1.0). Thanks again!
Your answer
Follow this Question
Related Questions
Using same animation with different sprite sheets 0 Answers
Simultaneous Animation for an Object 0 Answers
I cannot make AnimationClip changing some Sprites without AnimationController. 0 Answers
Sprites: Project Sprite to Mesh, allow for bending of sprites for 3d environments 0 Answers
Object not moving after changing animator parameter 1 Answer