- Home /
The question is answered, right answer was accepted
Mecanim Root Motion -- Not Moving Forward?
Hello,
I figure it's been a couple hours of searching so it's about time I ask the question.
HERE IS A VIDEO: http://www.sfbaystudios.com/rootMotionProblem.mov [you can see when I click "Root Motion" the enemy moves up/down and the motion is certainly being added, it's just not moving forward]
How do enemies (not the player character, basically) move with Mecanim? I've got a character set up to increase speed when the player is close to him. And in Mecanim, the walk animation begins when the speed is above 0.1. When I begin the game, the player is close to the enemy, so the enemy begins the walk animation. However, the animation stays in one place. The enemy does slowly move around in a circle (no forward motion, just a slow turn while staying still [animation is playing])
I can't seem to figure out why the enemy character is not moving forward. I'm guessing that since the enemy is slowly rotating that there is actual force being put on him, but I don't know why it's stuck in one spot.
Any ideas why the enemy doesn't move forward, but only slowly rotates on the Y Axis?
function Update () {
distanceToPlayer = Vector3.Distance(transform.position, playerObject.transform.position);
if (distanceToPlayer <= 10)
{
currentSpeed = Mathf.SmoothDamp(currentSpeed, maxSpeed, speedDampV, speedDamp);
enemyAnimator.SetBool("isChasing", true);
}
else
{
currentSpeed = Mathf.SmoothDamp(currentSpeed, 0, speedDampV, speedDamp);
enemyAnimator.SetBool("isChasing", false);
}
enemyAnimator.SetFloat("speed", currentSpeed);
}
Any ideas? I asked late at night, so I'm hoping daytime users would be able to help. I also did this in a brand new scene with nothing but the character, and the same result happened.
Here is another video example: Two characters (including a male from $$anonymous$$ixamo) that are scripted to idle for 5 seconds then run for 5, then idle for 5 on a loop. You can see them not moving forward, even though they are running, and the 2nd half of the video shows the states in $$anonymous$$ecanim.
Answer by infinitypbr · Jun 16, 2013 at 10:01 PM
It looks like the animation fbx file I had "in place" checked, so I paid $15 for a walking one that did not have in place checeked.
Where is this "in place" checkbox located? I'm having the same problem.
It's when I bought the motion from the $$anonymous$$ixamo store.