So I have a blendtree of an idle/walk/run animation of a character (the navmesh agent). I want to use a normalised float of the speed of the navmesh agent to control the blend of the animation cycles. Currently I use this:
void FixedUpdate ()
{
speed = (transform.position - lastPosition).magnitude;
lastPosition = transform.position;
print(speed);
}
However the result is fluctuating all over the place and the animations blends look crap. How do I find a more accurate speed of the navmesh agent?