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

NavMeshSurfaceΒΆ

Inherited: Component

DescriptionΒΆ

A navigation surface collects collider geometry from a scene or an actor hierarchy and converts it into a navigation mesh. The resulting mesh can be built synchronously with build() or asynchronously with buildAsync().

The surface can also include NavMeshLink connections while building. Its agentType() and geometrySource() determine which navigation configuration and source geometry are used.

Public MethodsΒΆ

NavMeshSurface ()

~NavMeshSurface ()

void

addBoxColliderGeometry (BoxCollider * collider, Vector3Vector & outVertices, std::vector<int> & outIndices)

void

addCapsuleColliderGeometry (CapsuleCollider * collider, Vector3Vector & outVertices, std::vector<int> & outIndices)

void

addMeshColliderGeometry (MeshCollider * collider, Vector3Vector & outVertices, std::vector<int> & outIndices)

void

addSphereColliderGeometry (SphereCollider * collider, Vector3Vector & outVertices, std::vector<int> & outIndices)

int

agentType () const

bool

autoBuild () const

bool

build ()

std::future

buildAsync ()

bool

buildNavMeshData (const Vector3Vector & vertices, const std::vector<int> & indices)

void

clear ()

bool

collectGeometry (Vector3Vector & outVertices, std::vector<int> & outIndices)

void

drawGizmosSelected ()

int

geometrySource () const

void

loadUserData (const VariantMap & data)

NavMesh *

navMesh () const

void

onNavMeshChanged ()

VariantMap

saveUserData () const

void

setAgentType (int type)

void

setAutoBuild (bool autoBuild)

void

setGeometrySource (int source)

void

setNavMesh (NavMesh * navMesh)

void

setTileSize (int tileSize)

int

tileSize () const

Public EnumsΒΆ

enum NavMeshSurface::GeometrySource

Defines where the surface collects collider geometry from.

Constant

Value

Description

NavMeshSurface::AllColliders

0

Collects enabled colliders from the scene.

NavMeshSurface::CollidersInHierarchy

1

Collects enabled colliders in the actor hierarchy.

Static MethodsΒΆ

None

Methods DescriptionΒΆ

NavMeshSurface::NavMeshSurface ()

Constructs a navigation surface with automatic building disabled.


NavMeshSurface::~NavMeshSurface ()

Destroys the navigation surface and releases its navigation mesh resource.


void NavMeshSurface::addBoxColliderGeometry (BoxCollider * collider, Vector3Vector & outVertices, std::vector & outIndices)

Appends box collider geometry to the build buffers.

The collider geometry is converted into vertices appended to outVertices and triangle indices appended to outIndices.


void NavMeshSurface::addCapsuleColliderGeometry (CapsuleCollider * collider, Vector3Vector & outVertices, std::vector & outIndices)

Appends capsule collider geometry to the build buffers.

The collider geometry would be appended to outVertices and outIndices.

Note: Capsule geometry is not implemented yet.


void NavMeshSurface::addMeshColliderGeometry (MeshCollider * collider, Vector3Vector & outVertices, std::vector & outIndices)

Appends mesh collider geometry to the build buffers.

The collider geometry is converted into vertices appended to outVertices and triangle indices appended to outIndices.


void NavMeshSurface::addSphereColliderGeometry (SphereCollider * collider, Vector3Vector & outVertices, std::vector & outIndices)

Appends sphere collider geometry to the build buffers.

The collider geometry would be appended to outVertices and outIndices.

Note: Sphere geometry is not implemented yet.


int NavMeshSurface::agentType () const

Returns the navigation mesh agent type used to build the surface.

See also setAgentType().


bool NavMeshSurface::autoBuild () const

Returns whether the surface rebuilds its navigation mesh automatically after a build-related setting changes.

See also setAutoBuild().


bool NavMeshSurface::build ()

Builds the navigation mesh from the configured collider geometry.

Returns true when the resulting navigation mesh is ready; otherwise returns false.

See also buildAsync() and clear().


std::future NavMeshSurface::buildAsync ()

Starts building the navigation mesh on an asynchronous task.

Returns a future that contains the same success state as build().

See also build().


bool NavMeshSurface::buildNavMeshData (Vector3Vector & vertices, std::vector & indices)

Converts collected geometry and off-mesh links into navigation mesh data.

The vertices buffer contains world-space positions, and indices contains triangle indices referring to those positions.

Returns true when the navigation mesh data is generated successfully.


void NavMeshSurface::clear ()

Unregisters and releases the navigation mesh generated by the surface.


bool NavMeshSurface::collectGeometry (Vector3Vector & outVertices, std::vector & outIndices)

Collects collider geometry according to geometrySource().

Collected vertex positions are appended to outVertices, while outIndices receives triangle indices referring to those vertices.

Returns true when at least one vertex and one triangle index are collected.


void NavMeshSurface::drawGizmosSelected ()

Reimplements: Component::drawGizmosSelected().

Draws the generated navigation mesh when the surface is selected.


int NavMeshSurface::geometrySource () const

Returns the source used to collect collider geometry.

See also setGeometrySource().


void NavMeshSurface::loadUserData (VariantMap & data)

Reimplements: Object::loadUserData(const VariantMap &data).

Loads the navigation mesh resource reference stored in user data.


NavMesh * NavMeshSurface::navMesh () const

Returns the navigation mesh resource generated by this surface.

See also setNavMesh().


void NavMeshSurface::onNavMeshChanged ()

Registers the current navigation mesh in NavigationSystem when it is ready.


VariantMap NavMeshSurface::saveUserData () const

Reimplements: Object::saveUserData() const.

Saves the navigation mesh resource reference to user data.


void NavMeshSurface::setAgentType (int type)

Sets the navigation mesh agent type used to build the surface.

The type value selects the agent configuration to use. When automatic building is enabled, a changed value starts a new build.

See also agentType().


void NavMeshSurface::setAutoBuild (bool autoBuild)

Enables or disables automatic rebuilding of the navigation mesh.

Setting autoBuild to true immediately starts a synchronous build.

See also autoBuild().


void NavMeshSurface::setGeometrySource (int source)

Sets the source used to collect collider geometry.

The source value selects the collider scope. When automatic building is enabled, a changed value starts a new build.

See also geometrySource().


void NavMeshSurface::setNavMesh (NavMesh * navMesh)

Assigns the navigation mesh resource owned by the surface.

The navMesh value is the resource to assign, or nullptr to clear the current resource.

See also navMesh().


void NavMeshSurface::setTileSize (int tileSize)

Sets the tile size used when building the navigation mesh.

The tileSize value is the number of cells along one navigation mesh tile edge. Non-positive values are ignored, and a valid changed value starts a new build when automatic building is enabled.

See also tileSize().


int NavMeshSurface::tileSize () const

Returns the tile size used when building the navigation mesh.

See also setTileSize().

Next
Os Module
Previous
NavMeshObstacle
Copyright © 2026, Thunder Engine
Made with Sphinx and @pradyunsg's Furo
On this page
  • NavMeshSurface
    • Description
    • Public Methods
    • Public Enums
    • Static Methods
    • Methods Description