Contents Menu Expand Light mode Dark mode Auto light/dark, in light mode Auto light/dark, in dark mode Skip to content
🌐 English | Русский
Thunder Engine documentation
Thunder Engine documentation

Thunder Engine

  • Getting Started
    • Quick Start
    • Thunder Hub
    • Sample Projects
    • Thunder Engine Features
  • Editor
    • Viewport
    • Properties
    • Content Browser
    • Hierarchy
    • Plugin Manager
    • Building Project
  • Rendering
    • Camera
    • Geometry
      • Mesh Resource
      • MeshRender
      • SkinnedMeshRender
    • Lighting
    • Visual Effects (VFX)
      • VFX Editor
      • Creating Custom Modules
    • Graphics Pipeline
  • Audio
    • AudioClip
    • AudioSource
  • Scripting
    • Overview
    • Creating and Using Scripts
    • Variables and Property Editor
    • Instantiating Prefabs
    • Native Introspection
  • API Reference
    • Animation Module
      • Animation
      • PropertyAnimation
      • VariantAnimation
    • Bullet Module
      • BoxCollider
      • CapsuleCollider
      • CharacterController
      • Collider
      • MeshCollider
      • PhysicMaterial
      • RigidBody
      • SphereCollider
      • VolumeCollider
    • Components Module
      • Actor
      • Animator
      • AreaLight
      • Armature
      • BaseLight
      • Camera
      • Component
      • DirectLight
      • EffectRender
      • FixedJoint
      • HingeJoint
      • Joint
      • MeshRender
      • NativeBehaviour
      • PlayerInput
      • PointLight
      • PostProcessVolume
      • Renderable
      • Scene
      • SkinnedMeshRender
      • SkinnedSpriteRender
      • Spline
      • SpotLight
      • SpringJoint
      • SpriteRender
      • TextRender
      • TileMapRender
      • Transform
      • World
    • Core Module
      • Bson
      • Event
      • Json
      • MetaEnum
      • MetaMethod
      • MetaObject
      • MetaProperty
      • MetaType
      • MethodCallEvent
      • Object
      • ObjectSystem
      • TString
      • ThreadPool
      • Url
      • Variant
    • Engine Module
      • CommandBuffer
      • Engine
      • Gizmos
      • Input
      • Log
      • Module
      • PipelineContext
      • PipelineTask
      • System
      • Timer
    • Gui Module
      • AbstractButton
      • AbstractSlider
      • Button
      • Canvas
      • CheckBox
      • FloatInput
      • Foldout
      • Frame
      • Image
      • Label
      • Layout
      • LineEdit
      • Menu
      • ProgressBar
      • RectTransform
      • ScrollBar
      • Slider
      • Splitter
      • StyleSheet
      • Switch
      • TabBar
      • TabWidget
      • ToolButton
      • UiDocument
      • UiLoader
      • Widget
    • Math Module
      • AABBox
      • Matrix3
      • Matrix4
      • OBBox
      • Plane
      • Quaternion
      • Ray
      • Vector2
      • Vector3
      • Vector4
    • Media Module
      • AudioClip
      • AudioSource
    • Navigation Module
      • NavMesh
      • NavMeshAgent
      • NavMeshLink
      • NavMeshObstacle
      • NavMeshSurface
    • Os Module
      • Backtrace
      • FileSystemWatcher
      • Process
      • ProcessEnvironment
      • Uuid
    • Resources Module
      • AnimationClip
      • AnimationStateMachine
      • AnimationTrack
      • Bone
      • ComputeBuffer
      • ComputeInstance
      • ComputeShader
      • ControlScheme
      • Font
      • Map
      • Material
      • MaterialInstance
      • Mesh
      • Pipeline
      • Pose
      • Prefab
      • RenderTarget
      • Resource
      • Sprite
      • Text
      • Texture
      • TileMap
      • TileSet
      • Translator
      • VisualEffect
    • NetworkAddress
    • WebRequest

Get Involved

  • Contribute Documentation
    • Documentation Writing Guide
    • Documentation Style Guide
    • Documentation Review Process
    • Building Thunder Engine from Source
  • Documentation Localization
Back to top
View this page

NavMeshAgentΒΆ

Inherited: NativeBehaviour

DescriptionΒΆ

A navigation agent finds a path on the navigation mesh and advances its owner along the resulting waypoints. The agent can be controlled by setting a target point with moveTo() or by following another actor with moveToActor().

The agent uses the configured agentType() to select a compatible navigation mesh. Its movement is limited by speed(), acceleration(), and angularSpeed(). When autoBraking() is enabled, the agent slows down near the end of the path. When autoRepath() is enabled, it recalculates the path after detecting a deviation or a stalled movement.

Public MethodsΒΆ

~NavMeshAgent ()

float

acceleration () const

int

agentType () const

float

angularSpeed () const

bool

autoBraking () const

bool

autoRepath () const

Vector3Vector

calculatePath (const Vector3 & target)

void

destinationReached ()

bool

moveTo (const Vector3 & target)

bool

moveToActor (Actor * targetActor)

const Vector3Vector

path () const

void

pathFailed ()

void

pathFound ()

void

pause (bool paused)

void

setAcceleration (float acceleration)

void

setAgentType (int type)

void

setAngularSpeed (float angularSpeed)

void

setAutoBraking (bool autoBraking)

void

setAutoRepath (bool autoRepath)

void

setSpeed (float speed)

void

setStoppingDistance (float stoppingDistance)

float

speed () const

NavMeshAgent::NavigationState

state () const

void

stop ()

float

stoppingDistance () const

void

stuck ()

const Vector3 &

target () const

void

unstuck ()

Vector3

velocity () const

void

waypointReached ()

Public EnumsΒΆ

enum NavMeshAgent::NavigationState

Describes the current navigation state of the agent.

Constant

Value

Description

NavMeshAgent::Idle

0

The agent has no active navigation request.

NavMeshAgent::Moving

1

The agent is following the current path.

NavMeshAgent::Pathfinding

2

The agent is calculating a path to its target.

NavMeshAgent::Stuck

3

The agent has not moved for the configured stuck threshold.

NavMeshAgent::Arrived

4

The agent has reached its destination.

Static MethodsΒΆ

None

Methods DescriptionΒΆ

NavMeshAgent::~NavMeshAgent ()

Destroys the navigation agent and stops its active navigation request.


float NavMeshAgent::acceleration () const

Returns the maximum movement acceleration in world units per second squared.

See also setAcceleration().


int NavMeshAgent::agentType () const

Returns the navigation mesh agent type used for pathfinding.

The value selects the agent configuration registered in NavigationSystem.

See also setAgentType().


float NavMeshAgent::angularSpeed () const

Returns the maximum rotation speed in degrees per second.

See also setAngularSpeed().


bool NavMeshAgent::autoBraking () const

Returns true when the agent automatically slows down near the end of its path.

See also setAutoBraking().


bool NavMeshAgent::autoRepath () const

Returns true when the agent automatically recalculates a deviated or stalled path.

See also setAutoRepath().


Vector3Vector NavMeshAgent::calculatePath (Vector3 & target)

Calculates a path from the agent’s current position to the target point.

Returns an empty vector when no path can be found.

See also moveTo().


void NavMeshAgent::destinationReached ()

Emitted when the agent reaches its destination.


bool NavMeshAgent::moveTo (Vector3 & target)

Starts moving the agent to the target point.

The request replaces the current path and emits pathFound() when a path is available, or pathFailed() when pathfinding fails.

Returns true after the navigation request has been submitted.

See also stop() and moveToActor().


bool NavMeshAgent::moveToActor (Actor * targetActor)

Starts moving the agent to the position of targetActor.

Returns false when targetActor or its transform is null. Otherwise, returns the result of moveTo().

See also moveTo().


const Vector3Vector NavMeshAgent::path () const

Returns the current path as a sequence of waypoints.


void NavMeshAgent::pathFailed ()

Emitted when pathfinding cannot produce a path to the requested target.


void NavMeshAgent::pathFound ()

Emitted when a path to the requested target has been found.


void NavMeshAgent::pause (bool paused)

Pauses or resumes movement according to the paused value.

While paused, the current path and navigation state are preserved.


void NavMeshAgent::setAcceleration (float acceleration)

Sets the maximum movement acceleration in world units per second squared.

The acceleration value limits how quickly the movement speed can change.

See also acceleration().


void NavMeshAgent::setAgentType (int type)

Sets the navigation mesh agent type used for pathfinding.

The type value is an index of an agent configuration registered in NavigationSystem.

See also agentType().


void NavMeshAgent::setAngularSpeed (float angularSpeed)

Sets the maximum rotation speed in degrees per second.

The angularSpeed value limits rotation in degrees per second.

See also angularSpeed().


void NavMeshAgent::setAutoBraking (bool autoBraking)

Enables or disables automatic braking near the end of the path.

When autoBraking is true, the agent slows down near the end of the path.

See also autoBraking().


void NavMeshAgent::setAutoRepath (bool autoRepath)

Enables or disables automatic path recalculation.

When autoRepath is true, the agent recalculates a deviated or stalled path.

See also autoRepath().


void NavMeshAgent::setSpeed (float speed)

Sets the maximum movement speed in world units per second.

The speed value limits movement to world units per second.

See also speed().


void NavMeshAgent::setStoppingDistance (float stoppingDistance)

Sets the distance at which the agent considers a waypoint reached.

The stoppingDistance value specifies the waypoint reach distance in world units.

See also stoppingDistance().


float NavMeshAgent::speed () const

Returns the maximum movement speed in world units per second.

See also setSpeed().


NavMeshAgent::NavigationState NavMeshAgent::state () const

Returns the current navigation state.


void NavMeshAgent::stop ()

Stops navigation, clears the current path, and resets the agent velocity.


float NavMeshAgent::stoppingDistance () const

Returns the distance at which the agent considers a waypoint reached.

See also setStoppingDistance().


void NavMeshAgent::stuck ()

Emitted when the agent is detected as stuck.


const Vector3 & NavMeshAgent::target () const

Returns the current navigation target.


void NavMeshAgent::unstuck ()

Emitted when a stuck agent starts moving again.


Vector3 NavMeshAgent::velocity () const

Returns the current movement velocity.


void NavMeshAgent::waypointReached ()

Emitted when the agent reaches a waypoint on its current path.

Next
NavMeshLink
Previous
NavMesh
Copyright © 2026, Thunder Engine
Made with Sphinx and @pradyunsg's Furo
On this page
  • NavMeshAgent
    • Description
    • Public Methods
    • Public Enums
    • Static Methods
    • Methods Description