- Home /
How to rotate an object with a script after an animation has rotated it?
I'm flying a space ship using a chase camera. When I use the left/right arrows, my script causes the ship to tilt based on its velocity like this:
objectToTilt.transform.rotation = Quaternion.Euler(0, 0, body.velocity.x
* -tilt);
This was working PERFECTLY until I introduced a state to an animator on the same object which also controls rotation (360 degree roll). The code above now seems to have no effect, even when the animation state machine is in an idle state which has no clip associated. I feel like the animator is sort of 'holding' my object's rotation where it wants. How do I tell the animator to 'let go' when I want to have script control of my object's rotation?
Have you checked that that axis is indeed not changing? It may be changing its $$anonymous$$inematic property.
Answer by DSebJ · Feb 14, 2017 at 01:17 AM
Do you have to have both on the same object?
If you just split the animation out to a parent object and keep your rotation script on the child object, you should get the behaviour you're expecting.
Your answer
Follow this Question
Related Questions
KeyNotFoundException in animator 0 Answers
how to make an animation run continuously while you press a button on the keyboard 1 Answer
How to reset animator controller ? 4 Answers
How to interrupt and replay an animation? 0 Answers
Animations Won't Play 0 Answers