diff --git a/CHANGELOG.md b/CHANGELOG.md index 04d4151..a34c189 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## 0.7.0 - Added support for using XPBD & wrapped Parry3d components for Nav-Mesh generation (Courtesy of @Elabajaba) +- Add benchmarks. +- Optimizations in tile building. ## 0.6.0 (2023-07-11) - Update to Bevy 0.11. (Courtesy of @Elabajaba) diff --git a/Cargo.toml b/Cargo.toml index 985e047..722426b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,6 +18,7 @@ default = [] rapier = ["bevy_rapier3d"] xpbd = ["bevy_xpbd_3d"] debug_draw = ["bevy/bevy_gizmos"] +trace = [] [[example]] name = "rapier3d" @@ -48,11 +49,14 @@ name = "parry3d" [dependencies] bevy = { version = "0.11", default-features = false } -bevy_rapier3d = { version = "0.22", optional = true } -bevy_xpbd_3d = { version = "0.2", optional = true } + # parry3d doesn't expose the convert-glam feature, so we need to add nalgebra to enable the feature nalgebra = { version = "0.32", features = ["convert-glam024"] } parry3d = "0.13" + +bevy_rapier3d = { version = "0.22", optional = true } +bevy_xpbd_3d = { version = "0.2", optional = true } + smallvec = { version = "1.11", features = ["union"] } [dev-dependencies] @@ -75,4 +79,8 @@ harness = false [[bench]] name = "simple_navigation" -harness = false \ No newline at end of file +harness = false + +[package.metadata.docs.rs] +# Compile docs.rs docs with debug_draw so docs for it appear. +features = [ "debug_draw" ] \ No newline at end of file diff --git a/MIGRATING.md b/MIGRATING.md index 469dc0c..b7a82ae 100644 --- a/MIGRATING.md +++ b/MIGRATING.md @@ -18,11 +18,6 @@ use bevy_xpbd_3d::prelude::Collider; app.add_plugins(OxidizedNavigationPlugin::::new(settings)); ``` -### Using Rapier3d colliders for Nav-Mesh generation is now behind feature ``rapier``. - - - - ## 0.5 ### ``OxidizedNavigationPlugin`` now takes a settings parameter containing ``NavMeshSettings`` diff --git a/README.md b/README.md index 938786b..7897525 100644 --- a/README.md +++ b/README.md @@ -41,11 +41,19 @@ Currently only `parry3d` colliders are supported, or crates using `parry3d` coll You need to manually apply your transform's scale to the Xpbd/Parry3d collider's shape. +> My physics crate updated and now my nav-meshes won't generate. + +This is due to how dependencies are handled, Oxidized Navigation will only interact with the versions specified in [Supported Versions](#supported-versions). If you want to use other versions you can [make cargo use a different version](https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html#the-patch-section). + +> How do I draw the Nav-mesh for debugging? + +Debug draw is available behind the ``debug_draw`` feature and using the ``OxidizedNavigationDebugDrawPlugin`` see usage in examples. + ## Supported versions | Crate Version | Bevy Version | Bevy Rapier 3D Version | Bevy Xpbd 3D Version | Parry3d Version | | ------------- | ------------ | ---------------------- | -------------------- | --------------- | -| unreleased | 0.11 | 0.22 | 0.2 | 0.13 | +| 0.7.0 | 0.11 | 0.22 | 0.2 | 0.13 | | 0.6.0 | 0.11 | 0.22 | unsupported | unsupported | | 0.5.X | 0.10.X | 0.21 | unsupported | unsupported | | 0.4.0 | 0.10.X | 0.21 | unsupported | unsupported | @@ -62,10 +70,6 @@ In this case you may be able to [override which version Oxidized Navigation depe - [ ] Rebuild all tiles when ``NavMeshSettings`` are changed. - [ ] Nav-mesh "layers" using different ``NavMeshSettings``. -- [ ] Pathfinding ticket system (Call to pathfinding returns a ticket that one can check later, controlling async pathfinding like this allows us to limit the amount of parallel tasks) +- [ ] Pathfinding ticket system (Call to pathfinding returns a ticket that one can check later, controlling async pathfinding like this allows us to limit the amount of parallel tasks & prioritize them) - [ ] Remove ``create_nav_mesh_tile_from_poly_mesh`` in favor of creating data in the right format from the start. -- [ ] Benchmarks for tile generation & pathfinding. - -## Debug draw. -Debug draw is available behind the ``debug_draw`` feature and using the ``OxidizedNavigationDebugDrawPlugin`` see usage in examples. diff --git a/src/lib.rs b/src/lib.rs index 8bb3dbc..cfcd170 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,22 +2,40 @@ //! //! Takes in colliders that implement the `OxidizedCollider` trait 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: +//! ## Quick-start: //! **Nav-mesh generation:** //! 1. Choose which backend you're going to use (bevy_rapier3d, bevy_xpbd_3d, or custom parry3d based colliders) and enable the relevant crate features ("rapier" or "xpbd" features, custom parry3d colliders don't require enabling any features). //! 2. If you opted for custom parry3d colliders, implement the `OxidizedCollider` trait for your collider component that wraps a `parry3d::shape::SharedShape`. This is already done for `bevy_rapier3d` and `bevy_xpbd_3d`. //! 3. Add ``OxidizedNavigationPlugin`` as a plugin. (eg. for xpbd `OxidizedNavigationPlugin::::new(NavMeshSettings {...}`) -//! 4. Attach a ``NavMeshAffector`` component and a collider that implements the `OxidizedCollider` trait (already implemented for Bevy Rapier3d and Bevy Xpbd3D `Collider`s) 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.* -//! +//! 4. Attach a ``NavMeshAffector`` component and a collider that implements the `OxidizedCollider` trait (already implemented for `bevy_rapier3d` and `bevy_xpbd_3D`) 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:** -//! 1. Your system needs to take in the [NavMesh] resource. -//! 2. Get the underlying data from the nav-mesh using [NavMesh::get]. This data is wrapped in an [RwLock]. -//! 3. 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.* -//! 4. 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.* +//! 1. Your system needs to take in the ``NavMesh`` resource. +//! 2. Get the underlying data from the nav-mesh using ``NavMesh::get``. This data is wrapped in an ``RwLock``. +//! 3. 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.* +//! 4. Call ``query::find_path`` with the ``NavMeshTiles`` returned from the ``RwLock``. +//! +//! *Also see the [examples](https://github.com/TheGrimsey/oxidized_navigation/tree/master/examples) for how to run pathfinding in an async task which may be preferable.* +//! +//! ## FAQ +//! +//! > I added the `OxidizedNavigationPlugin` to my app and now it won't compile. +//! +//! You need to use `OxidizedNavigationPlugin::::new(NavMeshSettings {...}`, where `Collider` is either a rapier or xpbd `Collider`, or your own custom collider that implements the `OxidizedCollider` trait. This is necessary to allow us to be generic over different `Collider` components. +//! +//! > I don't want to use the Rapier3d or XPBD3d physics engines just to generate a navmesh. How do I create my own `parry3d` wrapper component? +//! +//! You need to create a component that contains a parry3d `SharedShape`, then implement the `OxidizedCollider` trait. See the [parry3d example](./examples/parry3d.rs) for a basic example. +//! +//! > Can I use this with the builtin bevy shapes, or my own custom shapes? +//! +//! Currently only `parry3d` colliders are supported, or crates using `parry3d` colliders. You'd have to write a function to convert your shapes/bevy shapes into `parry3d` colliders. +//! +//! > Why aren't my Xpbd/Parry3d colliders scaled properly? +//! +//! You need to manually apply your transform's scale to the Xpbd/Parry3d collider's shape. //! //! [Bevy]: https://crates.io/crates/bevy //! [Bevy Rapier3D]: https://crates.io/crates/bevy_rapier3d