Skip to content

Api > NavMesh > FindClosestEdge()


NavMesh.FindClosestEdge(Vector3 sourcePosition, NavMeshQueryFilter filter)⚓︎

ocate the closest NavMesh edge from a point on the NavMesh, subject to the constraints of the filter argument.

Parameters:⚓︎

Name Type Description
sourcePosition Vector3 The origin of the distance query.
filter NavMeshQueryFilter A filter specifying which NavMesh areas can be passed when finding the nearest edge.

Returns:⚓︎

type Description
boolean True if the nearest edge is found.
NavMeshHit resulting location

Usage⚓︎

---@type Vector3
local sourcePosition;

---@type NavMeshQueryFilter
local filter;


local val0, val1 = NavMesh:FindClosestEdge(sourcePosition, filter)
n and details of the nearest point on the nearest edge of the navmesh. This can be used to query how much extra space there is around the agent.