Skip to content

NavigationWorld: add navmesh pathfinding with Recast & Detour#899

Open
Tron-xR wants to merge 1 commit into
crownengine:masterfrom
Tron-xR:navmesh-feature
Open

NavigationWorld: add navmesh pathfinding with Recast & Detour#899
Tron-xR wants to merge 1 commit into
crownengine:masterfrom
Tron-xR:navmesh-feature

Conversation

@Tron-xR

@Tron-xR Tron-xR commented Jun 27, 2026

Copy link
Copy Markdown

Add full navmesh support to the engine:

3rdparty:

  • Vendor Recast & Detour (MIT license) for navmesh generation and pathfinding
  • Vendor DetourCrowd for agent management and crowd simulation

Build system (scripts/):

  • recastnavigation.lua: Genie build script for Recast/Detour/DetourCrowd
  • genie.lua: register recastnavigation build target
  • crown.lua: add recastnavigation includes and link dependency

NavigationWorld (src/world/):

  • navigation_world.h/cpp: new sub-world managing navmesh loading, pathfinding (find_path, nearest_point, ray_cast, random_point), agent creation/destruction/target/state, and crowd simulation
  • Integrated into World: created/destroyed/updated each frame
  • navigation_agent component routed through create_components

Navmesh resource (src/resource/):

  • navmesh_resource.h/cpp: new .navmesh resource type with data compiler
  • data_compiler.cpp: register navmesh compiler + RESOURCE_TYPE extern
  • resource/types.h: add RESOURCE_TYPE_NAVMESH / RESOURCE_VERSION_NAVMESH
  • device.cpp: register navmesh runtime resource type (simple_resource)

Lua API (src/lua/):

  • lua_stack.h/inl: add NavigationWorld getter with marker check
  • lua_api.cpp: expose NavigationWorld methods (find_path, nearest_point, ray_cast, random_point, agent_create/destroy/set_target/position/velocity)
  • World:navigation_world() getter in Lua

Add full navmesh support to the engine:

3rdparty:
- Vendor Recast & Detour (MIT license) for navmesh generation and pathfinding
- Vendor DetourCrowd for agent management and crowd simulation

Build system (scripts/):
- recastnavigation.lua: Genie build script for Recast/Detour/DetourCrowd
- genie.lua: register recastnavigation build target
- crown.lua: add recastnavigation includes and link dependency

NavigationWorld (src/world/):
- navigation_world.h/cpp: new sub-world managing navmesh loading,
  pathfinding (find_path, nearest_point, ray_cast, random_point),
  agent creation/destruction/target/state, and crowd simulation
- Integrated into World: created/destroyed/updated each frame
- navigation_agent component routed through create_components

Navmesh resource (src/resource/):
- navmesh_resource.h/cpp: new .navmesh resource type with data compiler
- data_compiler.cpp: register navmesh compiler + RESOURCE_TYPE extern
- resource/types.h: add RESOURCE_TYPE_NAVMESH / RESOURCE_VERSION_NAVMESH
- device.cpp: register navmesh runtime resource type (simple_resource)

Lua API (src/lua/):
- lua_stack.h/inl: add NavigationWorld getter with marker check
- lua_api.cpp: expose NavigationWorld methods (find_path, nearest_point,
  ray_cast, random_point, agent_create/destroy/set_target/position/velocity)
- World:navigation_world() getter in Lua
@dbartolini

Copy link
Copy Markdown
Collaborator

This PR does not even compile. If it is a work in progress, you should mark it as a draft. If you plan to work seriously on this, it should at least include a dedicated example in the samples folder, and minimal tooling to generate navmeshes for levels inside the editor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants