How Do I Find the Location that a NavMeshPath Becomes Partial
My player is able to drop NavMeshObstacles that cut the baked NavMesh. If the player drops a NavMeshObstacle that makes my NavAgent's current path partial, I want to determine where along the path the path becomes partial. My first thought was to loop through the corners of the path however, I am not sure how to determine whether or not the path is complete without having to call CalculatePath() on the particular corner. Is there any way to find this information?
Answer by BiffJenkins · Jun 16, 2016 at 06:37 AM
Rather than find an actual location, I ended up just using the NavMeshAgent.destination. From what I understand, when a path becomes partial the destination is automatically changed to the closest point that the NavMeshAgent can still reach. This allows me to use NavMeshAgent.destination for my functionality rather than determining the actual point in a path where the NavMeshPath becomes partial.
For anyone looking in the future, a better solution is to use Nav$$anonymous$$eshAgent.path.corners. By accessing the last corner of the path, you can find where the path ter$$anonymous$$ates.