FindPath
The corners of a walk between two points on the navigation mesh.
The route an NPC actor would take, string-pulled to its corners: the first is the start snapped to the mesh, the last
the end. nil when either point is off the mesh (more than 2 m from it sideways or 4 m up or down - a wall, a roof, the
air), when no way joins them, or without a navmesh. Positions in metres, the level’s world space. A path takes well
under a millisecond across a village; a mode that asks every tick for every actor should not.
Syntax
Section titled “Syntax”FindPath(x1, y1, z1, x2, y2, z2)| Parameter | Type | |
|---|---|---|
x1 |
number | the start |
y1 |
number | |
z1 |
number | |
x2 |
number | the end |
y2 |
number | |
z2 |
number |
Returns
Section titled “Returns”table of {x=, y=, z=} corners, the start first; nil for no way
Example
Section titled “Example”local path = FindPath(px, py, pz, gx, gy, gz)if path then SendClientMessage(pid, COLOUR_SERVER, #path .. " corners to the goal") endSee also
Section titled “See also”IsReachable · MoveActor · GetNavmeshHeight · the The world - clock, weather, terrain, the navmesh, the geometry group of the index
