- Home /
Navigation with height mesh and Animation
Hello right now im using unity 5 and i have a simple script that uses the velocity of the nav agent to play a different set of animations (Legacy) it works alright, BUT if i bake the nav mesh with a height mesh it stops working.
Here is the code:
void Update ()
{
if (navAgent.velocity.magnitude > 0)
{
anim.CrossFade("Warlock_Run");
}
if (navAgent.velocity.magnitude == 0)
{
anim.CrossFade("Warlock_Standing_Free");
}
}
So i call a debug.log to see what the velocity was without a height mesh and it returns 0 when stoped. (Works right) but it returns a lot of numbers different every frame when baked a height mesh even if the object is stoped, the velocity returns something (high value like 5.2, 4.1, 8.3 etc) So if the agent does stop why the velocity is high.
Also using vector3 distance could fix it but i need to use the speed (will have different set of animations based on the speed) Is this a bug or im doing something terrible wrong?
Anyone knows if this is a bug or an error of $$anonymous$$e?