You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-15 13:51:40 +00:00
Fix CCD bodies adding multiple contact manifolds when using Jolt
This commit is contained in:
@@ -193,6 +193,12 @@ bool JoltContactListener3D::_try_add_contacts(const JPH::Body &p_jolt_body1, con
|
|||||||
return manifolds_by_shape_pair[shape_pair];
|
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();
|
const JPH::uint contact_count = p_manifold.mRelativeContactPointsOn1.size();
|
||||||
|
|
||||||
manifold.contacts1.reserve((uint32_t)contact_count);
|
manifold.contacts1.reserve((uint32_t)contact_count);
|
||||||
|
|||||||
Reference in New Issue
Block a user