- Home /
Animating rotation with root motion applied on a 2D sprite which has a kinematic rigidbody2D doesn't work
Hi, I'm facing a little problem and don't know whether it's a bug or I'm just missing something.
I created an empty scene and put a sprite named "New Sprite" into it. The sprite has an Animator component attached which plays a simple 45° rotation animation in a loop. On the sprite animation asset I hit the "Generate Root Motion Curves" button so root motion is driven by curves. On the Animator the "Apply Root Motion" checkbox is selected. The sprite also has a Rigidbody 2D component and a Box Collider 2D attached to it. On the collider the checkbox for "Is Trigger" is checked, same with "Is Kinematic" on the rigidbody. When the scene is started the sprite doesn't rotate, maybe it rotates a little bit, but then it gets stucked.
If I uncheck "Is Kinematic" or "Apply Root Motion" everything works, except that it will be affected by physics and drops off the screen which I don't want or the spin rotation jumps back to the beginning which I also don't want. So how can I get it work?
Here is a screenshot of the setup to show what I mean.
The cube is only for demonstration purposes, but the interesting thing is with the 3D model everything works. The cube has also a simple rotation animation attached and as root motion applied. The rigidbody is kinematic and the collider is set as a trigger. There the rotation works as expected, but 2D doesn't.
I read somewhere that the Interpolation for the rotation has to be set to "Euler Angles (Quaternion Approximation)" or "Quaternion", but that didn't help either.
So I don't know what to do to get this work. My real life scenario is a 2D game with many static sprites in the scene. They have a collider, but no rigidbody, because there is no physics in the game and the collider are for touch detecting purposes. However there are some sprites which should move by an animation. So they have a kinematic rigidbody and the collider is set as a trigger, because I want to get informed via script when the moving sprite is overlapping specific static sprites. That all works fine, except when the moving sprite shouldn't only move, but also rotate.
I just updated to Unity 5.3.4f1 on my Mac 10.11, but the problem remains. So any advice will be highly appreciated.
No one can confirm that this is a bug or tell me what I'm doing wrong?
Your answer
