Skip to main content

SimpleCollider

Trait SimpleCollider 

Source
pub trait SimpleCollider: AnyCollider<Context = ()> {
    // Provided methods
    fn aabb(
        &self,
        position: RVector,
        rotation: impl Into<Quat>,
        margin: f32,
    ) -> ColliderAabb { ... }
    fn swept_aabb(
        &self,
        start_position: RVector,
        start_rotation: impl Into<Quat>,
        end_position: RVector,
        end_rotation: impl Into<Quat>,
        margin: f32,
    ) -> ColliderAabb { ... }
    fn contact_manifolds(
        &self,
        other: &Self,
        position1: RVector,
        rotation1: impl Into<Quat>,
        position2: RVector,
        rotation2: impl Into<Quat>,
        prediction_distance: f32,
        manifolds: &mut Vec<ContactManifold>,
    ) { ... }
    fn ccd_thickness(&self) -> f32 { ... }
    fn max_distance_to_point(&self, point: RVector) -> f32 { ... }
    fn bounding_radius(&self) -> f32 { ... }
}
Expand description

A simplified wrapper around AnyCollider that doesn’t require passing in the context for implementations that don’t need context

Provided Methods§

Source

fn aabb( &self, position: RVector, rotation: impl Into<Quat>, margin: f32, ) -> ColliderAabb

Computes the Axis-Aligned Bounding Box of the collider with the given position and rotation, grown by the given margin.

See AnyCollider::aabb_with_context for collider types with a non-empty AnyCollider::Context.

Source

fn swept_aabb( &self, start_position: RVector, start_rotation: impl Into<Quat>, end_position: RVector, end_rotation: impl Into<Quat>, margin: f32, ) -> ColliderAabb

Computes the swept Axis-Aligned Bounding Box of the collider, grown by the given margin. This corresponds to the space the shape would occupy if it moved from the given start position to the given end position.

See AnyCollider::swept_aabb_with_context for collider types with a non-empty AnyCollider::Context.

Source

fn contact_manifolds( &self, other: &Self, position1: RVector, rotation1: impl Into<Quat>, position2: RVector, rotation2: impl Into<Quat>, prediction_distance: f32, manifolds: &mut Vec<ContactManifold>, )

Computes all ContactManifolds between two colliders, writing the results into manifolds.

manifolds is cleared if the colliders are separated by a distance greater than prediction_distance or if the given shapes are invalid.

See AnyCollider::contact_manifolds_with_context for collider types with a non-empty AnyCollider::Context.

Source

fn ccd_thickness(&self) -> f32

Returns a conservative minimum thickness used by Continuous Collision Detection (CCD) to determine when the collider might tunnel through other geometry.

Typically corresponds to the minimum distance from the centroid of any given shape to its surface.

Source

fn max_distance_to_point(&self, point: RVector) -> f32

Returns the maximum distance from the collider to the given point.

Source

fn bounding_radius(&self) -> f32

Returns the radius of the bounding sphere of the collider.

This is used to compute a size-relative ColliderAabbMargin for the collider.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<C: AnyCollider<Context = ()>> SimpleCollider for C