#navigation #system #path #nav-grid #nav-islands #nav-net #nav-free-grid

navmesh

NavMesh, NavNet, NavGrid, NavFreeGrid and NavIslands navigation system

10 releases (5 breaking)

0.12.1 Nov 30, 2021
0.11.0 Nov 28, 2021
0.8.3 May 20, 2021
0.8.2 Feb 17, 2020
0.7.0 Nov 23, 2019

#1657 in Game dev

Download history 37/week @ 2024-03-17 36/week @ 2024-03-24 77/week @ 2024-03-31 32/week @ 2024-04-07 25/week @ 2024-04-14 31/week @ 2024-04-21 43/week @ 2024-04-28 31/week @ 2024-05-05 44/week @ 2024-05-12 43/week @ 2024-05-19 45/week @ 2024-05-26 29/week @ 2024-06-02 32/week @ 2024-06-09 37/week @ 2024-06-16 31/week @ 2024-06-23 6/week @ 2024-06-30

109 downloads per month
Used in 6 crates (2 directly)

MIT/Apache

110KB
3K SLoC

NavMesh travis-ci status crates-io version

Nav-Mesh path finder for Rust

Installation

Cargo.toml

[dependencies]
navmesh = "0.8"

Example

use navmesh::*;

let vertices = vec![
    (0.0, 0.0, 0.0).into(), // 0
    (1.0, 0.0, 0.0).into(), // 1
    (2.0, 0.0, 1.0).into(), // 2
    (0.0, 1.0, 0.0).into(), // 3
    (1.0, 1.0, 0.0).into(), // 4
    (2.0, 1.0, 1.0).into(), // 5
];
let triangles = vec![
    (0, 1, 4).into(), // 0
    (4, 3, 0).into(), // 1
    (1, 2, 5).into(), // 2
    (5, 4, 1).into(), // 3
];

let mesh = NavMesh::new(vertices, triangles).unwrap();
let path = mesh
    .find_path(
        (0.0, 1.0, 0.0).into(),
        (1.5, 0.25, 0.5).into(),
        NavQuery::Accuracy,
        NavPathMode::MidPoints,
    )
    .unwrap();
assert_eq!(
    path.into_iter()
        .map(|v| (
            (v.x * 10.0) as i32,
            (v.y * 10.0) as i32,
            (v.z * 10.0) as i32,
        ))
        .collect::<Vec<_>>(),
    vec![(0, 10, 0), (10, 5, 0), (15, 2, 5),]
);

Dependencies

~9MB
~163K SLoC