5 releases
0.2.0 | May 3, 2023 |
---|---|
0.1.3 | May 6, 2019 |
0.1.2 | May 6, 2019 |
0.1.1 | May 6, 2019 |
0.1.0 | Apr 25, 2019 |
#2 in #recast
239 downloads per month
24KB
596 lines
recast-detour-rs
This project do not and will not be a full function Recast & Detour library.
This project do the followings things
- Add an very simple c-api for
Detour
Query. - An actual rust crate for provide a better usage (
recast-detour-rs
) - An augmented obj file format reader for reading NavMesh from a file
- An demo implementation for Unity NavMesh Exporter
Basic Usage
#[cfg(test)]
mod tests {
use super::*;
use insta::*;
fn simple_mesh() -> NavMeshData {
let vertices = vec![
0.0, 0.0, 0.0, 10.0, 0.0, 0.0, 10.0, 0.0, 10.0, 0.0, 0.0, 10.0,
];
let indices = vec![0, 1, 2, 0, 2, 3];
NavMeshData {
vertices,
indices,
walkable_height: 0.2,
walkable_radius: 0.2,
walkable_climb: 0.2,
cell_size: 0.1,
cell_height: 0.1,
}
}
#[test]
fn test_simple_path() {
assert_eq!("0.0.1", version());
let mesh = simple_mesh();
let q = RecastQuery::new_from_mesh(mesh).unwrap();
let p = q
.find_path((0.2, 0.1, 0.4).into(), (0.8, 0.1, 0.5).into(), 0.2)
.unwrap();
assert_debug_snapshot_matches!(p, @r###"Point(
[
0.29999924,
0.0,
0.29999924
]
)"###);
}
}
Dependencies
~1.6–4MB
~85K SLoC