Fix CCD bodies adding multiple contact manifolds when using Jolt
This commit is contained in:
parent
1f7630f1bf
commit
0590c974c1
1 changed files with 6 additions and 0 deletions
|
|
@ -193,6 +193,12 @@ bool JoltContactListener3D::_try_add_contacts(const JPH::Body &p_jolt_body1, con
|
|||
return manifolds_by_shape_pair[shape_pair];
|
||||
}();
|
||||
|
||||
if (unlikely(!manifold.contacts1.is_empty())) {
|
||||
// CCD collisions can result in two contact callbacks for the same shape pair, one in the earlier discrete stage and one in the later CCD stage.
|
||||
// We want the manifolds from the discrete stage, as the bodies still have their original velocities at that point, so we early-out if we've already stored something.
|
||||
return false;
|
||||
}
|
||||
|
||||
const JPH::uint contact_count = p_manifold.mRelativeContactPointsOn1.size();
|
||||
|
||||
manifold.contacts1.reserve((uint32_t)contact_count);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue