Skip to main content

Collider

Trait Collider 

Source
pub trait Collider<OtherCollider = Self> {
    type Vector;

    // Required method
    fn collision_info(
        &self,
        other: &OtherCollider,
    ) -> Option<CollisionInfo<Self::Vector>>;

    // Provided method
    fn check_collision(&self, other: &OtherCollider) -> bool { ... }
}
Expand description

The collider trait that all colliders must implement.

Required Associated Types§

Source

type Vector

The underlying vector type.

Required Methods§

Source

fn collision_info( &self, other: &OtherCollider, ) -> Option<CollisionInfo<Self::Vector>>

Returns collision info if colliders intersect, otherwise None.

Provided Methods§

Source

fn check_collision(&self, other: &OtherCollider) -> bool

Checks if two colliders collide. By default just checks if a collision info is found, so implementing this manually might be more effcient.

Implementors§

Source§

impl<B: Collider, C: Collider<Vector = B::Vector>> Collider for BoundedCollider<B, C>

Source§

impl<C, T, V> Collider for Transformed<C, T>
where C: Collider<Vector = V> + Transformable<T>, V: Copy,