Scripting API

Scripting API

NavMeshAgent3D

Struct in Abyss.Navigation, from Abyss.Navigation.

Something that walks the navmesh of its agent type to where it is sent — NavMeshAgent3D.Destination, or NavMeshAgent3D.Target's entity wherever that goes — along a path around what is in its way, steering around the other agents and the obstacles that move. While the game plays, never while it is edited.

public struct NavMeshAgent3D

Remarks

It moves its entity: puts it where it walks on the navmesh, NavMeshAgent3D.BaseOffset above it, and turns its +Z, where an imported model faces, to where it walks. With NavMeshAgent3D.UpdatePosition or NavMeshAgent3D.UpdateRotation off it only steers: a system or a Rigidbody 3D moves the entity, reading NavMeshAgent3D.Velocity, and the agent follows where it went.

Sent by its fields: a system sets NavMeshAgent3D.Destination and NavMeshAgent3D.HasDestination, or NavMeshAgent3D.Target, and the agent goes; NavMeshAgent3D.Stopped halts it where it is.

Across links (NavMeshLink3D) on its path: it walks to the link's start, then jumps in an arc to its end where the two differ in height by more than its step or a gap lies between, and walks straight across otherwise, at its NavMeshAgent3D.Speed; NavMeshAgent3D.OnLink is set meanwhile and NavMeshAgent3D.LinkProgress goes from 0 to 1. With NavMeshAgent3D.AutoTraverse off it stops as it comes to the link, a step or two from its start, and waits for the game's code, which moves its entity across (NavMeshAgent3D.LinkStart to NavMeshAgent3D.LinkEnd) and clears NavMeshAgent3D.OnLink; it walks on from where its entity is then.

Constructors

public NavMeshAgent3D()

Of the first agent type, walking as most engines' first agent does.

Fields

AgentType

public int AgentType

Which agent type it is: its place in Project Settings ▸ Navigation, which says how wide and tall it is.

Speed

public float Speed

How fast it walks, in meters a second.

AngularSpeed

public float AngularSpeed

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

Acceleration

public float Acceleration

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

StoppingDistance

public float StoppingDistance

How near where it is sent it stops, in meters.

AutoBraking

public bool AutoBraking

Whether it slows as it comes to where it is sent, rather than walking into it at speed.

BaseOffset

public float BaseOffset

How far above the navmesh its entity is put, in meters: where the entity's middle is above its feet.

Avoidance

public NavMeshAvoidance3D Avoidance

How well it steers around the others.

Priority

public int Priority

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

UpdatePosition

public bool UpdatePosition

Whether it puts its entity where it walks; off, something else moves the entity and it follows.

UpdateRotation

public bool UpdateRotation

Whether it turns its entity to where it walks.

Destination

public Vector3 Destination

Where it is sent, where NavMeshAgent3D.HasDestination says it is sent anywhere and NavMeshAgent3D.Target names nothing.

HasDestination

public bool HasDestination

Whether it is sent to NavMeshAgent3D.Destination.

Target

public EntityRef Target

An entity it follows wherever that goes, before NavMeshAgent3D.Destination.

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, as Project Settings ▸ Navigation lists them: Walkable's the lowest; -1 for every one.

AutoTraverse

public bool AutoTraverse

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

Velocity

public Vector3 Velocity

How it moves, in meters a second each way: what a system moving its entity itself walks it at.

RemainingDistance

public float RemainingDistance

How far it has left to walk along its path, in meters; 0 with nowhere to go.

Arrived

public bool Arrived

Whether it has come to where it was sent, within NavMeshAgent3D.StoppingDistance.

OnNavMesh

public bool OnNavMesh

Whether it stands on the navmesh of its agent type; false where it was put where none is.

public bool OnLink

Whether it is crossing a link, from the moment it comes to the link until it is on the far side. With NavMeshAgent3D.AutoTraverse off, the game's code clears it once the agent is across, and the agent walks on from where its entity is.

LinkProgress

public float LinkProgress

How far across the link it is, 0 at its start to 1 at its end: what an animator plays a jump by.

LinkStart

public Vector3 LinkStart

The end of the link it crosses from, on the navmesh, in the world.

LinkEnd

public Vector3 LinkEnd

The end of the link it crosses to, on the navmesh, in the world.