-
Notifications
You must be signed in to change notification settings - Fork 4
NavMeshAgent.samplePosition
Wyatt Gillette edited this page Nov 2, 2021
·
2 revisions
public boolean samplePosition(Vector3f center, float range, Vector3f result);| center | The origin of the sample query. |
| range | Sample within this distance from center. |
| result | Holds the resulting location. |
boolean True if the nearest point is found.
Finds the nearest point based on the NavMesh within a specified range.
float range = 4;
Vector3f point = new Vector3f();
NavMeshAgent agent;
if (agent.samplePosition(character.getWorldTranslation(), range, point)) {
agent.setDestination(point);
}