I’m having issues with my movement. When I have the Mathf.Abs line running, the animation for my character runs, but when I remove it, I can move on all parts of the axis, but I do not get the animation called. Any idea as to why this is happening and what I should do about it?
function UpdateSmoothedMovementDirection () {
var h = Input.GetAxisRaw ("Horizontal");
var v = Input.GetAxisRaw ("Vertical");
if (!canControl) {
h = 0.0;
v = 0.0;
}
//movement.isMoving = (Mathf.Abs (h) > 0.1) || (Mathf.Abs (v) > 0.1);
if (movement.isMoving) {
SetState(STATE_WALK);
movement.direction = Vector3 (h, 0, v);
movement.direction.Normalize();
}
// Only play the idle animation once, not every frame.
else {
SetState(STATE_IDLE);
}
}