- Home /
Use mecanim to animate basing on delta movement
In every example from Mecanim Examples, actual movement amount is determined from the animation files (i.e. feet movement in them). Can we somehow force Mecanim to choose animation based on the movement speed/direction, and perform movement ourselves? I think Mecanim should do IK solution to keep feet on ground, based on supplied delta movement. This is crucial to networked games, where you only have the delta amount of movement from last data packet for player, not their real actual state of controls.
Answer by Arnleif · Nov 28, 2012 at 10:42 AM
There is a "Nav Mesh Example" in the latest Mecanim example in the store. It animates the character based on a velocity (from the navmeshagent). You might find it related to what you want to do.
Not exactly. The Speed and Angular $$anonymous$$ovement hints from the Nav $$anonymous$$esh Example code are used only as hints to $$anonymous$$ecanim so it chooses appropriate animation. The real character movement is still far not equal to what Nav$$anonymous$$eshAgent suggests
Ok, I'm not sure what you really want to do, but it sound like you want to turn off 'apply root motion', bake all xz,y,rot movement into the anim (if such exist). Then move your characters transform and supply related values to the animator to make it animate something that almost matches the real movement. (Like legacy stuff). Sliding feet will of course occur to some extent.
Thanks! That's exactly what I think I need, but I hoped that $$anonymous$$ecanim could do I$$anonymous$$ solving to avoid feet sliding in this case
I think the feet sliding would occur because you can not manage to match the anim with the real movement. If you did manage to match them (somehow with a lot of tweaking), it would have been the same as using animator to 'apply root motion'. Anyway, I would think you should be able to avoid most sliding if your anims does the same as the motion-variables you define/feed them. Not that I've tried this with regards to the ik.
Your answer
Follow this Question
Related Questions
Possible to adjust blend tree thresholds in script at runtime? 0 Answers
Best way to go about believable 2 Character Grab/Lift animation? 1 Answer
Trying to get Mecanim to work well with Touch Controls 1 Answer
How do I control two armature animations in one gameObject? (Mecanim) 0 Answers
Swap Mecanim Layers in Unity 4.2 0 Answers