- Home /
How do I make an animation not reset the position of the object?
Hello, I was trying to make an animation in which the object at hand moves to the right a certain amount. However I discovered that if I animate the object at -3 and make it move to -1.5, whenever the animation is executed, the object flies back to -3 and goes to -1.5, instead of moving 1.5 units to the right (that's probably how it's supposed to work). How do I make an object move 1.5 units to the right using the Unity animation system, regardless of current position?
Answer by aoun111 · Jul 04, 2019 at 08:58 PM
Start by going to the first frame of your animation and setting the position values as you want. Then go to another frame (can be your last frame) and write the same values, but now adding (or subtracting) 1.5 to the respective axis. It should work flawlessly.
Hey, thanks for replying.
By setting the values as I want, do you mean making an animation (two keyframes)? And by writing the same values, do you mean writing the same values as the keyframes? And writing where? For me it just moves the object 1.5 units more than needed.
The object will move in local space. So if you put an empty GameObject (called 'base') in your scene, and then the animated model inside that GameObject, you'll be able to move the base object to move the model, and it will then only move relative to the base and won't snap back to -3 in world space.