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);
}