- Home /
Character not moving (with animation playing)
when you view animations I've noticed that when you press play the default model walks. I've made my own animations in blender, exported fbx, using mecanim with bother legacy and humanoid rig types working find. When i try to move (wasd) it works the animation plays except that the character doesn't move physically. And when playing the animation the same thing it LOOKS like it's walking but it's not actually moving.
Your animation doesn't change position. Or Apply Root $$anonymous$$otion is unchecked.
Hi,
I've solved this problem by separating the player's physics system from the character Animator.
The structure is like follow:
PlayerGameObject (it has the physics system & move controllers)
PlayerAnimationsGameObject (follows the PlayerGameobject) -> AnimatorControllerGameobject (child of AnimationsGameObject; it has the animator)
Answer by zKici · Mar 15, 2014 at 06:34 PM
Hi,
please take a look at this:
http://docs.unity3d.com/Documentation/Manual/ScriptingRootMotion.html
Unfortunately it seems that when the animations are done as "cycle" you will have to script your own "move" script, still using Mecanim however, it might be even better scripting your own, more control etc.
Answer by vizardgames · Sep 06, 2017 at 03:45 PM
//just add this to your character script`
void OnAnimatorMove()
{
Animator animator = GetComponent<Animator>();
if (animator)
{
Vector3 newPosition = transform.position;
newPosition.z += animator.GetFloat("Runspeed") * Time.deltaTime;
transform.position = newPosition;
}
}
doesnt work for me it just says " The local function 'OnAnimator$$anonymous$$ove' is declared but never used" pls help!
You don't need to script anything. In the animator component tab you should enable 'Apply root motion' and that's it.
Answer by mother_chucker · May 22, 2019 at 02:49 PM
@krispastas Apply root motion doesnt work for me , i dont know why, and neither does the script up there, any solution? ,@krispastas not working for me, the guy still wont move, just plays animation in the same place... the script up there isnt working as well... dont know what to do
same problem for me, plus my character gradually falls over.
Answer by NOGOODGAMES · Apr 09 at 01:34 PM
In case anyone stumbles upon this, the best solution is: Create an empty gameobject and parent all your rig's hierarchy and skinned meshes under it -name it animator -copy and paste the animator component from your parent gameobject to the animator gameobject you created
Everything should work fine. The idea is, you don't want to have the logic for movement on the same gameobject as the gameobject where your animator component is attached.
Hope this helps someone!
Your answer
Follow this Question
Related Questions
Add more bones to skeleton - vertebraes definition...? 0 Answers
How to create a 2D rig? 1 Answer
Multiple Animation Events not firing 1 Answer
Tweaking a Walk Cycle 0 Answers
Mecanim animation clip mask 1 Answer