Component · navigation
NavObstacle
Dynamic obstacle: an axis-aligned box centred on the entity's
NavPosition. Carve/Area changes publish after NavConfig::rebake_latency_ticks; until then (and always for Avoid) agents avoid it locally.Fields
id
u32Stable nonzero ID; changes are canonically ordered by it.
default 0
halfExtents
vec3Box half extents in metres.
default [0.5,0.5,0.5]m
mode
ObstacleModeCarve, relabel or avoid only.
default "carve"
One ofcarveareaavoid
area
u8Area applied in
Area mode, from 0 through 15.default 00 – 15
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=NavObstacle --why "Add NavObstacle"Set a field
ara do property.set -p entity=name:Crate -p path=NavObstacle.id -p value=0 --why "Tune NavObstacle"In a scene document
{
"NavObstacle": {
"id": 0
}
}From C#
/// <summary>Resize a dynamic carving obstacle around a crate.</summary>
public static void UseNavObstacle(Entity entity, in Tick tick)
{
ref var component = ref World.Get<NavObstacle>(entity);
component.HalfExtents = new Vector3(1, 1, 1);
}From C#
Scripts read and write it with Get<NavObstacle>(); see the NavObstacle struct.