Struct NavMesh

Source
pub struct NavMesh { /* private fields */ }
Expand description

Safe bindings to dtNavMesh Handles life time of the dtNavMesh and will release resources when dropped

Implementations§

Source§

impl NavMesh

Provides functionality to interact with NavMesh and its underlying dtNavMesh

Source

pub fn get_tile_and_poly_by_ref( &self, poly_ref: PolyRef, ) -> DivertResult<(MeshTile, Polygon)>

Gets the tile and polygon for the specified polygon reference.

Source

pub fn calc_tile_location(&self, position: &Vector) -> (i32, i32)

Calculates the tile grid location for the specified world position.

Source

pub fn get_poly_ref_base(&self, tile: &dtMeshTile) -> Option<dtPolyRef>

Gets the polygon reference for the tile’s base polygon.

Source

pub fn get_tile_at( &self, tile_x: i32, tile_y: i32, layer: i32, ) -> Option<&dtMeshTile>

Gets the tile at the specified grid location.

Source

pub fn new(nav_mesh_params: &NavMeshParams) -> DivertResult<Self>

Allocates and initializes a dtNavMesh for NavMesh to handle Errors if allocation returns a null pointer, or the dtNavMesh->init function returns a failed status

Source

pub fn add_tile(&mut self, input_data: Vec<u8>) -> DivertResult<TileRef>

Accepts a byte vector representing a dtTile, adding it to the inner dtNavMesh The byte vector is forgotten after being added to the dtNavMesh Forgetting the memory is critical, because the memory is now owned by the dtNavMesh

Source

pub fn create_query<'b>(&self, max_nodes: i32) -> DivertResult<NavMeshQuery<'b>>

Allocates and initializes a dtNavMeshQuery for NavMeshQuery to handle Errors if allocation returns a null pointer, or the dtNavMeshQuery->init function returns a failed status

Trait Implementations§

Source§

impl Drop for NavMesh

Handles freeing the inner dtNavMesh subsequently handles freeing the tile data added to this NavMesh

Source§

fn drop(&mut self)

Frees dtNavMesh resources with dtFreeNavMesh

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.