seldom_map_nav

Crates.ioseldom_map_nav
lib.rsseldom_map_nav
version0.7.0
sourcesrc
created_at2022-10-08 18:46:52.861843
updated_at2024-07-10 00:19:52.344916
descriptionBevy plugin that does navmesh generation, pathfinding, and navigation for tilemaps. Navmesh generation is available without Bevy dependency.
homepage
repositoryhttps://github.com/Seldom-SE/seldom_map_nav
max_upload_size
id683688
size171,864
Seldom (Seldom-SE)

documentation

README

seldom_map_nav

Crates.io MIT/Apache 2.0 Crates.io

seldom_map_nav is a Bevy plugin that does navmesh generation, pathfinding, and navigation for tilemaps. Navmesh generation is available without Bevy dependency. It is agnostic to the solution you use for your tilemaps, but doesn't require much glue. It is also agnostic to your position type, as long as it implements Position2 (ex. Transform). It's compatible with seldom_state with the state feature.

Features

  • Navmesh generation for finite, square tilemaps
  • Awareness of navigator physical size
  • Bevy plugin for pathfinding and navigation
  • Integration with seldom_state

Future Work

This crate is currently in maintenance mode, so I'm not currently adding new features.

  • Tiles that can be pathed over in certain situations, such as doors
  • Tiles that cannot be pathed over, but do not need clearance generated, such as holes

The generated paths are not always optimal, even with the greatest quality settings, but I do not plan to fix this myself. If possible, I may switch dependencies to improve this, though.

seldom_state Compatibility

If the state feature is enabled, it will trigger the DoneTrigger when it is done navigating (if it reaches the destination or cannot find a path). Also, see related example: cargo run --example state --features="state"

Usage

Add to your Cargo.toml

# Replace * with your desired version
[dependencies]
seldom_map_nav = "*"

To generate navmeshes without Bevy integration, disable the bevy feature and use Navmeshes::generate or seldom_map_nav::mesh::generate_navmesh. See the no_bevy.rs example.

To generate paths without using the built-in navigation, add the MapNavPlugin to your app, add the Navmeshes component to your tilemap (or some other entity), and add the Pathfind component to your navigating entity. To use the built-in navigation, also add the Nav component to your navigating entity. See the nav.rs example. If you are having trouble getting it to generate a path, enable the log feature, and it might tell you what's wrong.

If you need help, feel free to ping me on the Bevy Discord server (@Seldom)! If any of the docs need improvement, feel free to submit an issue or pr!

Compatibility

Bevy seldom_state seldom_map_nav
0.14 0.11 0.7
0.13 0.10 0.6
0.11 0.7 0.5
0.10 0.6 0.4
0.10 0.5 0.3
0.9 0.3 0.2
0.8 0.2 0.1

License

seldom_map_nav is dual-licensed under MIT and Apache 2.0 at your option.

Contributing

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Commit count: 34

cargo fmt