Skip to main content

NavMeshAgent.FindClosestEdge()

Locate the closest NavMesh edge.

Returns:

typeDescription
booleanTrue if a nearest edge is found.
NavMeshHitproperties of the resulting location.

Usage

---@type NavMeshAgent
local navmeshagent;


local val0, val1 = navmeshagent.FindClosestEdge()

Extra Detail

The returned NavMeshHit object contains the position and details of the nearest point on the nearest edge of the Navmesh. Since an edge typically corresponds to a wall or other large object, this could be used to make a character take cover as close to the wall as possible.