Skip to content

API > NavMeshAgent > nextPosition


NavMeshAgent.nextPosition⚓︎

Name Type
nextPosition Vector3

Description⚓︎

Gets or sets the simulation position of the navmesh agent.

Extra Detail⚓︎

The position vector is in world space coordinates and units.The nextPosition is coupled to Transform.position. In the default case the navmesh agent's Transform position will match the internal simulation position at the time the script Update function is called. This coupling can be turned on and off by setting updatePosition.

When updatePosition is true, the Transform.position reflects the simulated position, when false the position of the transform and the navmesh agent is not synchronized, and you'll see a difference between the two in general. When updatePosition is turned back on, the Transform.position will be immediately move to match nextPosition.

By setting nextPosition you can directly control where the internal agent position should be. The agent will be moved towards the position, but is constrained by the navmesh connectivity and boundaries. As such it will be useful only if the positions are continuously updated and assessed.