NavMeshAgent: steeringTarget vs. nextPosition (4.2)

I am using a NavMeshAgent and wanted to do a calculation based on the next waypoint on its path. I looked at the doc for NavMeshAgent and found nextPosition and read its doc which says:

The next position on the path. – A path consists of waypoints that are aimed for in succession by the agent as it navigates. This property contains the position of the waypoint the agent is currently heading for. When this point is reached, the target will be advanced to the next waypoint, and so on until the agent lands at the destination point.

Somewhat later I found steeringTarget whose doc says:

The current steering target - usually the next corner or end point of the current path. (Read Only)

It turns out that steeringTarget is the value I want. But on the way to figuring that out, I was pretty confused by the behavior of nextPosition. As near as I can tell, nextPosition is exactly the same value as position. That is, as my agent advances along the navmesh path, this expression returns zero on every frame:

 Vector3.Distance (navMeshAgent.transform.position, navMeshAgent.nextPosition)

Is that the way it is supposed to work? And if so, isn’t the documentation for nextPosition wrong?

Thanks for any enlightenment,
Craig Reynolds

I also came across this discrepancy between the documentation and the implementation. I believe that what nextPosition is reporting is an interpolated point along the path (not necessarily a corner) that the agent is moved to if its updatePosition is set to true.

Therefore, if you’re using the NavMeshAgent to handle movement of your transform this seems to report the current position every frame. I’m using my NavMeshAgent to calculate paths but handling the movement manually, and nextPosition will be near to, but not quite the same position as my transform. As you have spotted steeringTarget seems to actually report the next corner of the path, so it would seem that some updating of documentation is required!