VaelisDocs
v1.0.0
Components · v1.0.0

NavAgent2D

Vaelis 1.0.0 NavAgent2D component reference: fields, script API, behavior and examples.

View as Markdownllms.txt
ScopeThis page documents the NavAgent2D component in Vaelis 1.0.0. Runtime fields are serialized scene data; the Script API section lists only members intentionally exposed to game scripts.
Where to find it in the editorInspector → Add Component → Nav Agent 2D. For radius and area painting, use the Nav toolbar after a Nav World 2D exists; Match Collider is in the Nav Agent inspector section.

#What it does

Per-agent navigation settings and current path state for NavWorld2D pathfinding.

Component setup & editor toolsNavAgent2D is the moving-agent side of Vaelis navigation. It works with NavWorld2D and the navigation API.

#How to add and use NavAgent2D

Editor path: Select the target entity in the Hierarchy (left side) → look at the Inspector (right side) → click Add Component at the bottom of the Inspector → search for NavAgent2D → click the component row. The Add Component picker is a centered modal with a search box; it only lists components not already attached.

For components with a dedicated editor tool, the tool is opened or activated from the location described below. Do not assume that adding the component alone activates its editor; some systems require a separate window, panel, or viewport tool.

#Component setup & editor tools

  • Select the agent → Inspector → Add Component → Nav Agent 2D. Configure agent parameters, then use the NavWorld2D + navigation workflow before expecting paths. Runtime movement is driven by the NavAgent2D API.

#What you should see after adding it

The component appears as its own section in the Inspector. Its serialized settings are listed in the Component data table below. If a field is conditional, it appears only when the relevant mode/type is selected. If a field is a runtime state field (for example grounded or resolved velocity), treat it as read-only diagnostic state unless the API reference explicitly documents it as writable.

#How to read the settings

For every setting below, the documentation distinguishes type, default, meaning, and tuning direction where behavior is known. When a value represents a direction, use the engine's coordinate convention documented in Coordinate system; do not substitute Unity/Godot conventions.

#Component data

FieldTypePurposeDefault
radiusnumberAgent clearance radius.16
speednumberPreferred speed.120
accelerationnumberAcceleration.800
decelerationnumberDeceleration.1000
stoppingDistancenumberArrival distance.1
autoRepathbooleanAutomatically recompute path.true
repathIntervalnumberMinimum seconds between automatic repaths.0.35
repathDistancenumberDistance target can move before repathing.4
avoidanceEnabledbooleanObstacle/agent avoidance.true
avoidancePrioritynumberAvoidance priority.50
collabEnabledbooleanVehicle/collaborative avoidance mode.false
collabGroupRadiusnumberCollaborative group radius.96
vehicleLookaheadnumberVehicle path lookahead.72
vehicleCornerLookaheadnumberCorner lookahead.110
vehicleObstacleLookaheadnumberObstacle lookahead.120
vehicleObstacleWidthnumberObstacle width estimate.28
vehicleSteerSmoothingnumberSteering smoothing.7
vehicleSpeedSmoothingnumberSpeed smoothing.5
vehicleCornerSlowdownnumberCorner slowdown multiplier.0.72
vehicleObstacleBrakenumberObstacle braking factor.0.9
vehicleRecoveryTimenumberRecovery time.1.35
vehicleRecoveryReverseTimenumberReverse recovery time.0.9
area16-bit maskAllowed navigation areas.0xffff
areaCostsarray|nullOptional 16-entry per-agent cost overrides.null
currentPathvalue | nullWritten by the engine each frame; not an authored setting. (engine-managed runtime state)null
currentPathIndexnumberWritten by the engine each frame; not an authored setting. (engine-managed runtime state)0

#Tuning behavior

These are the practical direction-of-change rules for the most important controls on this component.

SettingWhat changing it does
radiusThe clearance needed around this agent. Larger radius makes narrow passages become non-walkable for this agent.
speedTop travel speed in world units/second.
acceleration / decelerationHigher values make movement and stopping snappier; lower values make it softer.
stoppingDistanceLarger values let the agent stop farther from the final target.
repathIntervalLower reacts faster to changing routes/targets but costs more path queries.
areaHard allowed-area mask; excluding an area prevents the route from crossing it.

#Script API

MemberKindDescription
radiusPropertyAgent radius.
speedPropertyPreferred speed.
accelerationPropertyAcceleration.
decelerationPropertyDeceleration.
stoppingDistancePropertyStopping distance.
autoRepathPropertyAuto-repath.
repathIntervalPropertyRepath interval.
repathDistancePropertyTarget-move repath threshold.
avoidanceEnabledPropertyAvoidance toggle.
avoidancePriorityPropertyAvoidance priority.
collabEnabledPropertyCollaborative vehicle avoidance.
collabGroupRadiusPropertyGroup radius.
vehicleLookaheadPropertyVehicle lookahead.
vehicleCornerLookaheadPropertyCorner lookahead.
vehicleObstacleLookaheadPropertyObstacle lookahead.
vehicleObstacleWidthPropertyObstacle width.
vehicleSteerSmoothingPropertySteering smoothing.
vehicleSpeedSmoothingPropertySpeed smoothing.
vehicleCornerSlowdownPropertyCorner slowdown.
vehicleObstacleBrakePropertyObstacle brake factor.
vehicleRecoveryTimePropertyRecovery time.
vehicleRecoveryReverseTimePropertyReverse recovery time.
areaPropertyAllowed area mask.
areaCostsProperty16-entry area cost overrides.
currentPathPropertyRead-only world-space waypoint array or null.
currentPathIndexPropertyRead-only current waypoint index.

#Examples

js
this.navAgent.speed = 180;
js
this.navAgent.autoRepath = true;
Need the full workflow?Components: complete workflow covers adding, configuring, testing, combining, and removing components.