Add a CollisionWorld method that checks if two colliders are touching.
The current way of doing this is collision_world.contact_pair(handle1, handle2).unwrap_or(false).num_contacts() > 0 but it is verbose and does not cover cases where the collision query is a proximity.
Hi, I can take this issue if it's still open.
@ChinYing-Li Thanks! Yes, this is still open.
I wonder if branch ISSUE252 looks like what you have in mind?
Thank you for your suggestion. It would be best to open a PR with your issue252 branch so simplify the review process. Whether or not this looks like what I had in mind, a PR will allow me (or someone else) to add comments and suggestions.
To answer your question: I was thinking of reusing the preexisting information available in the contact graph and proximity graph, i.e., do a check similar to
let (_, _, interaction) = self.interaction_pair(false).unwrap_or(false);
match interaction {
Interaction::Contact(_, manifold) => {
// If the deepest contact multiplied by -1 of the manifold is smaller than 0, return Proximity::Penetrating
// If it is smaller than the sum of the linear prediction (obtained from the collider's `GeometricQueryType`), return Proximity::WithinMargin.
// Other wise return Proximity::Disjoin.
}
Interaction::Proximity(_, prox) => prox
}