NavMeshAgent not moving at given speed
Hey there,
I have a problem with my NavMeshAgent and the movement of 3D models. I have two gameobjects (3d model guards) that have exactly the same movement settings but move differently. Additionally, I don't know if that's related, the navmeshagent.distance of one of the guards is 'infinity' at some points.
Scenario:
So what happens in short: I attract the attention of guard 1 which then begins to chase me (state = CHASE). After a while he calls out for help which makes the other guards run to the position guard 1 passed on to them (state = SEARCH). While guard 1 still happily chases me at the intended speed, the other guards keep moving at the walking speed but the animation is the one for running (which looks pretty silly of course...). After approximately 2/3 of the way they also begin running at full speed as intended.
Every variable I can think of is correctly set but the agent just won't move correctly. I've read that addind a coroutine can enhance the behaviour of a NavMeshAgent? Had no luck with that though. Any suggestions?
Cheers, Dan
EDIT: I've also now tested the actual speed of the guard while moving to the given position. With this code:
private Vector3 previousPosition;
public float curSpeed;
void Update()
{
Vector3 curMove = transform.position - previousPosition;
curSpeed = curMove.magnitude / Time.deltaTime;
previousPosition = transform.position;
}
It is pretty accurately the same as what the navmeshagent shows in the inspector. So the speed is at 1 but the guard is obviously not moving that fast! What the....!?!?
Your answer
Follow this Question
Related Questions
NavMeshAgent isn't chasing the player 0 Answers
NavMesh agent moving to unassigned target 1 Answer
How to prevent AI from going Backwards 0 Answers
Farthest Reachable Destination 0 Answers