avian3d::collision::collider

Trait SimpleCollider

Source
pub trait SimpleCollider: AnyCollider<Context = ()> {
    // Provided methods
    fn aabb(
        &self,
        position: Vector,
        rotation: impl Into<Rotation>,
    ) -> ColliderAabb { ... }
    fn swept_aabb(
        &self,
        start_position: Vector,
        start_rotation: impl Into<Rotation>,
        end_position: Vector,
        end_rotation: impl Into<Rotation>,
    ) -> ColliderAabb { ... }
    fn contact_manifolds(
        &self,
        other: &Self,
        position1: Vector,
        rotation1: impl Into<Rotation>,
        position2: Vector,
        rotation2: impl Into<Rotation>,
        prediction_distance: Scalar,
        manifolds: &mut Vec<ContactManifold>,
    ) { ... }
}
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: Vector, rotation: impl Into<Rotation>) -> ColliderAabb

Computes the Axis-Aligned Bounding Box of the collider with the given position and rotation.

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

Source

fn swept_aabb( &self, start_position: Vector, start_rotation: impl Into<Rotation>, end_position: Vector, end_rotation: impl Into<Rotation>, ) -> ColliderAabb

Computes the swept Axis-Aligned Bounding Box of the collider. 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 non-empty AnyCollider::Context

Source

fn contact_manifolds( &self, other: &Self, position1: Vector, rotation1: impl Into<Rotation>, position2: Vector, rotation2: impl Into<Rotation>, prediction_distance: Scalar, 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 non-empty AnyCollider::Context

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

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