Scripting API
Scripting API
Navigation2D
Class in Abyss.Navigation, from Abyss.Navigation.
The navmeshes a world's surfaces in 2D were baked as, loaded as each NavMeshSurface2D appears and let go of as it goes, and asked for a path, the closest point or a straight walk on the one of an agent type: world.Navigation2D().FindPath(from, to).
public sealed class Navigation2D : IDisposableRemarks
Of an agent type, as Project Settings ▸ Navigation lists them, the first by default. Where several surfaces are baked for it, a question is asked of the first whose navmesh the start is on.
Safe from systems running in parallel: each navmesh is asked one question at a time.
Properties
Walking
public int Walking { get; }How many agents walk a navmesh while the game plays.
Carved
public int Carved { get; }How many obstacles are cut out of a navmesh while the game plays.
Version
public int Version { get; }Moves on whenever a navmesh is loaded or let go of: what something drawing them follows.
Surfaces
public IReadOnlyList<(ulong Surface, int AgentType)> Surfaces { get; }The surfaces whose navmeshes are loaded, with the agent type each is for.
Methods
PathOf
public int PathOf(ulong agent, Span<Vector2> corners)The corners of the path the agent on agent walks while the game plays, from where it is to where it was sent, into corners.
Parameters
agentcorners
Returns How many; none where it walks nowhere, or the game is not playing.
FindPath
public NavPath2D FindPath(Vector2 from, Vector2 to, int agentType = 0, int areaMask = -1)A path on the navmesh of agentType from from to to, crossing only the areas areaMask ticks; NavPath2D.None where none is loaded or either end is not on one.
Parameters
fromtoagentTypeareaMask
ClosestPoint
public bool ClosestPoint(Vector2 point, out Vector2 closest, int agentType = 0)The point of the navmesh of agentType closest to point.
Parameters
pointclosestagentType
Returns Whether one is that close.
Raycast
public bool Raycast(Vector2 from, Vector2 to, out Vector2 hit, int agentType = 0)Walks straight on the navmesh of agentType from from toward to: where a wall stops it, in hit.
Parameters
fromtohitagentType
Returns Whether something stops it short.
With
public bool With(ulong surface, Action<NavMesh3D> use)Has use read the navmesh surface was baked as, with it held so nothing lets go of it meanwhile. It is in Recast's space: a point's X along X and its Y along −Z.
Parameters
surfaceuse
Returns Whether one is loaded for it.
Forget
public void Forget(ulong surface)Has the navmesh of surface read again as it is next seen: what a bake does.
Parameters
surface
Dispose
public void Dispose()Lets go of every navmesh.
