- Düzenlendi
Root motion
This is more a runtime feature but does Spine have support for root motion?
This is a great method to match animation with the in-game environment.
About root animation: http://docs.unity3d.com/Documentation/M ... otion.html
Spine doesn't use animation clips (nor Mecanim), and has no root motion support itself.
I get around this by placing a rootMotion bone between the Spine skeleton's root and the rest of the skeleton. Animate this bone (translations only) for your root movement, then re-parent the skeleton to the root bone proper whenever you export... this shouldn't break your animation (disclaimer: I can only account for personal experience! Do tests first), and you can re-parent the skeleton to the rootMotion bone whenever you need to go back to editing it. It can get a bit messy if you forget to do this then edit your animation, as it may throw your root motion sync if i.e. a foot or pelvis gets moved, but you can always re-parent and tweak.
You can then read the root motion from the rootMotion bone in your animation code, i.e.
Spine.Bone rootMotionBone = skeleton.FindBone("rootMotion");
float x = rootMotionBone.x;
Remember rootMotionBone's positions are absolute, and resets at the loop, so you need the difference (i.e. Mathf.Abs()) between frames, and a catch for the loop reset.
Not especially elegant, but it's functional, and allows you to switch between Root and In-Place motion with zero hassle.
Native support for root motion would of course be a big bonus.
Can someone explain what root motion is in simple terms?
as far as i understood,
let say you create an animation of a guy walking.
in spine, you can animate it two ways :
the guy is walking without moving forward. it's like someone walking on a running machine. so, his legs are moving but his whole body doesn't.
the guy is actually moving forward as he's walking, like in real life. so, he's both moving his legs AND moving his whole body accordingly (forward).
in unity, you can use the root motion of an animation. this means, unity can interpret the move of the guy forward to actually match his legs movement with the motion of the gameobject.
for this, you need to utilize the second method.
if you check 'root motion' on in unity, the guy will actually animates his legs AND move forward in unity (the gameobject).
if not, the guy will move his legs but stay at the same location (the gameobject) and it's up to you to move the gameobject and try to match the speed of the walkcycle with the movement of the gameobject.
root motion is primarily used in 3d animations so the question would be : is it possible in spine ? :happy:
Please read the newer thread:
viewtopic.php?t=1364