avian3d::collision::collider

Trait AnyCollider

source
pub trait AnyCollider: Component + ComputeMassProperties {
    // Required methods
    fn aabb(
        &self,
        position: Vector,
        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,
    ) -> Vec<ContactManifold>;

    // Provided method
    fn swept_aabb(
        &self,
        start_position: Vector,
        start_rotation: impl Into<Rotation>,
        end_position: Vector,
        end_rotation: impl Into<Rotation>,
    ) -> ColliderAabb { ... }
}
Expand description

A trait that generalizes over colliders. Implementing this trait allows colliders to be used with the physics engine.

Required 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.

source

fn contact_manifolds( &self, other: &Self, position1: Vector, rotation1: impl Into<Rotation>, position2: Vector, rotation2: impl Into<Rotation>, prediction_distance: Scalar, ) -> Vec<ContactManifold>

Computes all ContactManifolds between two colliders.

Returns an empty vector if the colliders are separated by a distance greater than prediction_distance or if the given shapes are invalid.

Provided Methods§

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.

Object Safety§

This trait is not object safe.

Implementors§