Trait avian3d::collision::collider::AnyCollider
source · pub trait AnyCollider: Component {
// Required methods
fn aabb(
&self,
position: Vector,
rotation: impl Into<Rotation>
) -> ColliderAabb;
fn mass_properties(&self, density: Scalar) -> ColliderMassProperties;
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§
sourcefn aabb(&self, position: Vector, rotation: impl Into<Rotation>) -> ColliderAabb
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.
sourcefn mass_properties(&self, density: Scalar) -> ColliderMassProperties
fn mass_properties(&self, density: Scalar) -> ColliderMassProperties
Computes the collider’s mass properties based on its shape and a given density.
sourcefn contact_manifolds(
&self,
other: &Self,
position1: Vector,
rotation1: impl Into<Rotation>,
position2: Vector,
rotation2: impl Into<Rotation>,
prediction_distance: Scalar
) -> Vec<ContactManifold>
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 ContactManifold
s 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§
sourcefn swept_aabb(
&self,
start_position: Vector,
start_rotation: impl Into<Rotation>,
end_position: Vector,
end_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
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.