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§
Required Methods§
Sourcefn collision_info(
&self,
other: &OtherCollider,
) -> Option<CollisionInfo<Self::Vector>>
fn collision_info( &self, other: &OtherCollider, ) -> Option<CollisionInfo<Self::Vector>>
Returns collision info if colliders intersect, otherwise None.
Provided Methods§
Sourcefn check_collision(&self, other: &OtherCollider) -> bool
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.