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:
- 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
- Module for querying the nav-mesh.
Structs
- Wrapper around the nav-mesh data.
- Component for entities that should affect the nav-mesh.
- Optional component to define the area type of an entity. Setting this to
Nonemeans that the entity isn’t walkable. - Settings for nav-mesh generation.
Enums
- System sets containing the crate’s systems.