Component · navigation
NavAgent
Dimensions, speed and permitted areas of one navigation agent.
Fields
profile
u32Mesh profile ID; radius and height must fit that profile.
default 0
radius
f32Collision radius in metres.
default 0.3m0.001 – 10
height
f32Required clearance in metres.
default 1.8m0.01 – 100
maxSpeed
f32Maximum movement speed in metres per second.
default 30 – 1000
acceleration
f32Maximum change in velocity per second.
default 80 – 10000
areaMask
u16Areas this agent can use (one bit per area).
default 65535
stoppingDistance
f32Arrival tolerance in metres.
default 0.1m0.001 – 10
Usage
Every edit is an undoable command: from the CLI as below, or the same JSON from an agent over MCP. See component.add and property.set.
Add it
ara do component.add -p entity=name:Crate -p component=NavAgent --why "Add NavAgent"Set a field
ara do property.set -p entity=name:Crate -p path=NavAgent.profile -p value=0 --why "Tune NavAgent"In a scene document
{
"NavAgent": {
"profile": 0
}
}From C#
/// <summary>Let an alerted NPC run toward its goal.</summary>
public static void UseNavAgent(Entity entity, in Tick tick)
{
ref var component = ref World.Get<NavAgent>(entity);
component.MaxSpeed = 4f;
}From C#
Scripts read and write it with Get<NavAgent>(); see the NavAgent struct.