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§