- Home /
Draw NavMesh path with multiple points set
Hello all,
I have some headaches with drawing the path when using NavMeshAgent. So, my object is moving to multiple points with the following code:
if (localPoints.Count > 0) {
if (Vector3.Distance (transform.position, localPoints[0]) > agent.stoppingDistance + 1) {
agent.destination = new Vector3 (localPoints[0].x,transform.position.y,localPoints[0].z);
} else {
Destroy (pointsObjects [0]);
localPoints.Remove(localPoints[0]);
}
}
localPoint is a list of positions and when a point is reached the object moves to the next one.
Currently I am able to draw the path to the nearest point but I would like to draw the entire path from the first to the last point. Any ideas how this could happen?
Please note that I have obstacles so I need to draw the path which the object will take.
Your answer
Follow this Question
Related Questions
Is there a limit on how far a navmesh agent can go? 0 Answers
NavMesh area, walkable but not accessible. 2 Answers
NavMeshAgent and NavMeshObstacle together, unit jumping a small distance on toggle 2 Answers
NavMeshAgent calculated path going in a straight line ignoring height in between start and end 1 Answer
How to speed up built-in Unity pathfinding using navMesh? 1 Answer