Skip to content

stdlib/navmeshView source ↗

navmesh

18 items · generated by scribe fromstdlib/navmesh.fd· synced 2026-11-15

stdlib/navmesh18 items

Contents

pub struct NavGrid {

Fields:

NameType
widthi64
heighti64
cellsVec<bool>

Defined at line 20


pub fn nav_grid_create(width: i64, height: i64) -> NavGrid {

Parameters:

  • width: i64
  • height: i64

Returns: NavGrid

Defined at line 26


pub fn nav_grid_set_blocked(grid: & mut NavGrid, x: i64, y: i64, blocked: bool) -> void {

Parameters:

  • grid: & mut NavGrid
  • x: i64
  • y: i64
  • blocked: bool

Returns: void

Defined at line 38


pub fn nav_grid_is_blocked(grid: & NavGrid, x: i64, y: i64) -> bool {

Parameters:

  • grid: & NavGrid
  • x: i64
  • y: i64

Returns: bool

Defined at line 45


pub fn nav_grid_index(x: i64, y: i64) -> i64 {

Parameters:

  • x: i64
  • y: i64

Returns: i64

Defined at line 52


pub fn nav_grid_unpack(idx: i64) -> vec2 {

Parameters:

  • idx: i64

Returns: vec2

Defined at line 57


AStarNode

pub struct AStarNode {

Fields:

NameType
xi64
yi64
gf64
hf64
ff64
parent_xi64
parent_yi64
openbool
closedbool

Defined at line 62


Find a path on the grid using A*. Returns a Vecof packed (x,y) coordinates.

pub fn nav_grid_find_path(grid: & NavGrid, start_x: i64, start_y: i64, goal_x: i64, goal_y: i64) -> Vec<i64> {

Parameters:

  • grid: & NavGrid
  • start_x: i64
  • start_y: i64
  • goal_x: i64
  • goal_y: i64

Returns: Vec<i64>

Defined at line 78


Get the path length (number of waypoints).

pub fn nav_grid_path_length(path: Vec<i64>) -> i64 {

Parameters:

  • path: Vec<i64>

Returns: i64

Defined at line 235


Get a waypoint from the path.

pub fn nav_grid_path_waypoint(path: Vec<i64>, idx: i64) -> vec2 {

Parameters:

  • path: Vec<i64>
  • idx: i64

Returns: vec2

Defined at line 240


pub struct NavPoly {

Fields:

NameType
idi64
center_xf64
center_yf64
neighborsVec<i64>

Defined at line 249


pub struct NavMesh {

Fields:

NameType
polygonsVec<NavPoly>

Defined at line 256


pub fn navmesh_create() -> NavMesh {

Returns: NavMesh

Defined at line 260


Add a polygon to the navmesh. Returns the polygon ID.

pub fn navmesh_add_polygon(mesh: & mut NavMesh, center_x: f64, center_y: f64) -> i64 {

Parameters:

  • mesh: & mut NavMesh
  • center_x: f64
  • center_y: f64

Returns: i64

Defined at line 267


Connect two polygons (bidirectional).

pub fn navmesh_connect(mesh: & mut NavMesh, a: i64, b: i64) -> void {

Parameters:

  • mesh: & mut NavMesh
  • a: i64
  • b: i64

Returns: void

Defined at line 276


Find a path between two polygons using A*.

pub fn navmesh_find_path(mesh: & NavMesh, start: i64, goal: i64) -> Vec<i64> {

Parameters:

  • mesh: & NavMesh
  • start: i64
  • goal: i64

Returns: Vec<i64>

Defined at line 292


Get the center of a polygon.

pub fn navmesh_poly_center(mesh: & NavMesh, id: i64) -> vec2 {

Parameters:

  • mesh: & NavMesh
  • id: i64

Returns: vec2

Defined at line 405


Get the number of polygons.

pub fn navmesh_poly_count(mesh: & NavMesh) -> i64 {

Parameters:

  • mesh: & NavMesh

Returns: i64

Defined at line 414


Generated by scribe, the Fides documentation generator