Crate oxidized_navigation
source ·Expand description
Tiled Runtime Nav-mesh Generation for 3D worlds in Bevy.
Takes in Bevy Rapier3D colliders from entities with the NavMeshAffector component and asynchronously generates tiles of navigation meshes based on NavMeshSettings. Nav-meshes can then be queried using query::find_path.
Quick Start:
Nav-mesh generation:
- Insert an instance of the NavMeshSettings resource into your Bevy app.
- Add OxidizedNavigationPlugin as a plugin.
- Attach a NavMeshAffector component and a rapier collider to any entity you want to affect the nav-mesh.
At this point nav-meshes will be automatically generated whenever the collider or [GlobalTransform] of any entity with a NavMeshAffector is changed.
Querying the nav-mesh / Pathfinding:
- Your system needs to take in the NavMesh resource.
- Get the underlying data from the nav-mesh using NavMesh::get. This data is wrapped in an RwLock.
- To access the data call RwLock::read. This will block until you get read acces on the lock. If a task is already writing to the lock it may take time.
- Call query::find_path with the NavMeshTiles returned from the RwLock.
Also see the examples for how to run pathfinding in an async task which may be preferable.
Modules
Structs
Wrapper around the nav-mesh data.
Component for entities that should affect the nav-mesh.
Settings for nav-mesh generation.
System label used by the crate’s systems.