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>
impl<C: Collider, I: Copy> CollisionManager<C, I>
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Creates a new collision manager with the capacity of expected colliders specified.
Sourcepub fn insert_collider(&mut self, collider: C, index: I) -> usize
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.
Sourcepub fn replace_collider(&mut self, index: usize, collider: C)
pub fn replace_collider(&mut self, index: usize, collider: C)
Replaces the existing collider at the specified index by a new collider.
Sourcepub fn remove_collider(&mut self, index: usize)
pub fn remove_collider(&mut self, index: usize)
Removes an existing collider, so the index is usable for a new collect again.
Sourcepub fn collider_mut(&mut self, index: usize) -> &mut C
pub fn collider_mut(&mut self, index: usize) -> &mut C
Get the collider at the sepcified index as mutable.
Sourcepub fn check_collision(&self, check_collider: &C) -> bool
pub fn check_collision(&self, check_collider: &C) -> bool
Checks if theer is a collision at a specific position.
Sourcepub fn find_collision(&self, check_collider: &C) -> Option<I>
pub fn find_collision(&self, check_collider: &C) -> Option<I>
Checks for a collision with collider and returns some index if found.
Sourcepub fn find_collisions(&self, check_collider: &C) -> Vec<I>
pub fn find_collisions(&self, check_collider: &C) -> Vec<I>
Finds all collisions with colliders and returns their indices.
Sourcepub fn compute_inner_collisions(
&self,
) -> ArrayLinkedList<Vec<IndexedCollisionInfo<C::Vector, I>>>
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.
Sourcepub fn compute_collisions_with(
&self,
other: &Self,
) -> ArrayLinkedList<Vec<IndexedCollisionInfo<C::Vector, I>>>
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.