-
Notifications
You must be signed in to change notification settings - Fork 4
NavMeshAgent.calculatePath
Wyatt Gillette edited this page Oct 28, 2021
·
2 revisions
public boolean calculatePath(Vector3f targetPosition, NavMeshPath path);| targetPosition | The final position of the path requested. |
| path | The resulting path. |
boolean True if a path is found.
Calculate a path to a specified point and store the resulting path. This function can be used to plan a path ahead of time to avoid a delay in gameplay when the path is needed. Another use is to check if a target position is reachable before moving the agent.
Vector3f targetPos;
NavMeshAgent agent;
NavMeshPath navPath = new NavMeshPath();
agent.calculatePath(targetPos, navPath);
if (navPath.getStatus() == NavMeshPathStatus.PathComplete) {
agent.setPath(navPath);
}