I’ve got a simple character and it has to move with a Character Controller, but I’m trying to set the animations based on the direction it is moving.
I have a blend tree for going from idel to walk with a simple script:
horizontalVelocity = new Vector3(characterController.velocity.x, 0, characterController.velocity.z);
float horizontalSpeed = horizontalVelocity.magnitude;
if (horizontalSpeed > 0)
{
animator.SetFloat("IdleWalk", horizontalSpeed);
}
So now I need to check which direction the player is moving, really I just need to know when the player is straffing, or moving backwards (or forwards)
Any tips?