pub trait Collider {
// Required methods
fn shape(&self) -> ColliderShape;
fn bounding_box(&self) -> Rect;
fn contains_point(&self, point: Vector2D) -> bool;
fn center(&self) -> Vector2D;
}Expand description
A trait for objects that can participate in collision detection.
Required Methods§
Sourcefn shape(&self) -> ColliderShape
fn shape(&self) -> ColliderShape
Sourcefn bounding_box(&self) -> Rect
fn bounding_box(&self) -> Rect
Returns the axis-aligned bounding box that encloses this collider.
§Returns
Rect- The bounding box.
Sourcefn contains_point(&self, point: Vector2D) -> bool
fn contains_point(&self, point: Vector2D) -> bool
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl Collider for AabbCollider
Implements the Collider trait for AabbCollider.
impl Collider for CircleCollider
Implements the Collider trait for CircleCollider.