- Home /
Animation of my door is getting absolute rotation, how to get relative?
Hi,
I have animated a door in Unity, made two animations, one to open and another to close, it worked really fine. But when I duplicated the door and tried to use it in another place, it didnt worked, because it use the absolute rotation of the previous door, instead it open 90 degree it open to rotation 270 which only work of the position of the first door.
How is the right/easiest way to work with animations in Unity, so i can reuse my objects and animations?
Answer by Mike 3 · Jun 28, 2010 at 05:39 PM
Make sure the object rotating isn't the root object of the animation. You'll want to rotate a child under it, so it's relative to the parent.
Anything you change on the animation's root will be in world space
Hello $$anonymous$$ike. I have the same problem. I'm having a hard time trying to understand what you're trying to say.
I've animated a plane so as to move forward and then back to the same position, and to rotate around Z -90. These are being done linearly (the movement and the rotation are being done simultaneously).
I've parented this plane to an empty gameobject and, while the movement works fine, the rotation just resets from (0, 0, 0) and goes to (0, 0, -90) each time, ignoring the current rotation of the child.
I don't understand this sentence: "$$anonymous$$ake sure the object rotating isn't the root object of the animation". The animation will play on the object you've attached to. I've attached the animation to the child.