Scripting API

Scripting API

NavMeshAgent2D

Struct in Abyss.Navigation, from Abyss.Navigation.

Something that walks a navmesh in 2D while the game plays: sent to NavMeshAgent2D.Destination, or after NavMeshAgent2D.Target, it walks there around walls, obstacles and other agents at its NavMeshAgent2D.Speed, moving its entity along X and Y. What it does is in its fields as it goes: NavMeshAgent2D.Velocity, NavMeshAgent2D.RemainingDistance, NavMeshAgent2D.Arrived.

public struct NavMeshAgent2D

Remarks

Of an agent type, as Project Settings ▸ Navigation lists them: its radius is the agent's, and it walks the navmesh of a NavMeshSurface2D baked for that type.

Only while the game plays: edited, it stands where it is put.

Constructors

public NavMeshAgent2D()

Of the first agent type, sent nowhere, moving its entity and leaving it turned as it is.

Fields

AgentType

public int AgentType

Which agent type it is: its place in Project Settings ▸ Navigation.

Speed

public float Speed

How fast it walks, in units a second.

AngularSpeed

public float AngularSpeed

How fast it turns to where it walks, in degrees a second, where it turns.

Acceleration

public float Acceleration

How fast it gets up to speed, and slows down, in units a second each second.

StoppingDistance

public float StoppingDistance

How near where it is sent it stops.

AutoBraking

public bool AutoBraking

Whether it slows as it comes to where it is sent.

Avoidance

public NavMeshAvoidance2D Avoidance

How well it steers around other agents and moving obstacles.

Priority

public int Priority

How readily it gives way, 0 to 99: one numbered higher steps aside more for one numbered lower.

UpdatePosition

public bool UpdatePosition

Whether it moves its entity; off, it only steers, and something else moves the entity by its velocity.

UpdateRotation

public bool UpdateRotation

Whether it turns its entity about Z so the entity's up points the way it walks.

Destination

public Vector2 Destination

Where it walks to, in world space, while NavMeshAgent2D.HasDestination is on and NavMeshAgent2D.Target names nothing.

HasDestination

public bool HasDestination

Whether it walks to NavMeshAgent2D.Destination.

Target

public EntityRef Target

An entity it follows wherever that goes; while one is named, NavMeshAgent2D.Destination is not walked to.

Stopped

public bool Stopped

Whether it stands where it is, though it is sent somewhere.

AreaMask

public int AreaMask

The areas it walks, a bit each by their place in Project Settings ▸ Navigation: every one to begin with.

AutoTraverse

public bool AutoTraverse

Whether it crosses a link by itself; off, it stops as it comes to one and waits for the game's code.

Velocity

public Vector2 Velocity

How fast and which way it walks now, in units a second.

RemainingDistance

public float RemainingDistance

How far it has left to walk to where it is sent.

Arrived

public bool Arrived

Whether it came to where it was sent, and stopped there.

OnNavMesh

public bool OnNavMesh

Whether it stands on a navmesh of its type.

public bool OnLink

Whether it is on a link: set as it starts across, and cleared as it lands, or by the game's code that moved it across.

LinkProgress

public float LinkProgress

How far across its link it is, 0 to 1.

LinkStart

public Vector2 LinkStart

Where the link it crosses starts, in world space.

LinkEnd

public Vector2 LinkEnd

Where the link it crosses ends, in world space.