I am wondering on a way on how I can grab the direction a Navmesh Agent is walking, with these values I planned on referencing them to a Blendtree to where certain animations would play depending on the AI direction, Using a 2D Free form Cartesian plane I planned on using those referenced direction values to play certain animations, with the X and Z directions both starting off at zero. so to walk forward the Z value would be 1, while the X value would be 0
Currently I have already tried using rigid body velocity and transform.forward (X and Z), while I received no values using velocity the transform.forward did give increasing values however it did not seem like the values I was looking for (these values need to be in a range from 0-1), as well as never had a starting position(Idle) of 0,0
void animationUpdate() {
anim.SetFloat("Enemy Z", /* Unsure what to do*/);
anim.SetFloat("Enemy X", /* Unsure what to do*/);
if (/*transform.forward.x != 0 && transform.forward.z != 0*/) {
anim.SetBool("isWalking", true);
} else {
anim.SetBool("isWalking", false);
}
}
My Cartesian Plane is the following
Any Help would be appreciated, thank you for reading