Function avian3d::collision::contact_query::contact_manifolds
source · pub fn contact_manifolds(
collider1: &Collider,
position1: impl Into<Position>,
rotation1: impl Into<Rotation>,
collider2: &Collider,
position2: impl Into<Position>,
rotation2: impl Into<Rotation>,
prediction_distance: Scalar
) -> Vec<ContactManifold>
Expand description
Computes all ContactManifold
s between two Collider
s.
Returns an empty vector if the colliders are separated by a distance greater than prediction_distance
or if the given shapes are invalid.
§Example
use avian3d::prelude::{contact_query::contact_manifolds, *};
use bevy::prelude::*;
let collider1 = Collider::sphere(0.5);
let collider2 = Collider::cuboid(1.0, 1.0, 1.0);
// Compute contact manifolds a collision that should be penetrating
let manifolds = contact_manifolds(
// First collider
&collider1,
Vec3::default(),
Quat::default(),
// Second collider
&collider2,
Vec3::X * 0.25,
Quat::default(),
// Prediction distance
0.0,
);
assert_eq!(manifolds.is_empty(), false);