Struct CollisionManager

Source
pub struct CollisionManager<C: Collider, I> { /* private fields */ }
Expand description

The collision manager, which manages collisions. Can contain multiple colliders.

Implementations§

Source§

impl<C: Collider, I: Copy> CollisionManager<C, I>

Source

pub fn new() -> Self

Creates a new collision manager.

Source

pub fn with_capacity(capacity: usize) -> Self

Creates a new collision manager with the capacity of expected colliders specified.

Source

pub fn insert_collider(&mut self, collider: C, index: I) -> usize

Inserts a new collider and returns its index. An object index needs to be specified.

Source

pub fn replace_collider(&mut self, index: usize, collider: C)

Replaces the existing collider at the specified index by a new collider.

Source

pub fn remove_collider(&mut self, index: usize)

Removes an existing collider, so the index is usable for a new collect again.

Source

pub fn collider(&self, index: usize) -> &C

Get the collider at the sepcified index.

Source

pub fn collider_mut(&mut self, index: usize) -> &mut C

Get the collider at the sepcified index as mutable.

Source

pub fn check_collision(&self, check_collider: &C) -> bool

Checks if theer is a collision at a specific position.

Source

pub fn find_collision(&self, check_collider: &C) -> Option<I>

Checks for a collision with collider and returns some index if found.

Source

pub fn find_collisions(&self, check_collider: &C) -> Vec<I>

Finds all collisions with colliders and returns their indices.

Source

pub fn compute_inner_collisions( &self, ) -> ArrayLinkedList<Vec<IndexedCollisionInfo<C::Vector, I>>>

Computes the internal collisions between all colliders. Returns a list for each, which can be indexed by the specified index.

Source

pub fn compute_collisions_with( &self, other: &Self, ) -> ArrayLinkedList<Vec<IndexedCollisionInfo<C::Vector, I>>>

Computes the collisions between all colliders with the colliders of another collision manager. Returns a list for each, which can be indexed by the specified index.

Trait Implementations§

Source§

impl<C: Collider, I: Copy> Default for CollisionManager<C, I>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<C, I> Freeze for CollisionManager<C, I>

§

impl<C, I> RefUnwindSafe for CollisionManager<C, I>

§

impl<C, I> Send for CollisionManager<C, I>
where I: Send, C: Send,

§

impl<C, I> Sync for CollisionManager<C, I>
where I: Sync, C: Sync,

§

impl<C, I> Unpin for CollisionManager<C, I>
where I: Unpin, C: Unpin,

§

impl<C, I> UnwindSafe for CollisionManager<C, I>
where I: UnwindSafe, C: UnwindSafe,

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.