Physics Collisions Acting different in 4.20

Good Day,

After updating to 4.20 we have noticed that our physics based sphere colliders are “catching” edges on static objects that were not catching in the previous engine version. We are having issues locating the cause. Reading through the patch notes the only thing we can find about collision changes is the Rest Offset. Does anyone have any insight on what might be causing this effect.

Kindest Regards

Just an update it is where 2 meshes meet.

It’s a combination of RestOffset added in 4.20 and changes to how ContactOffset is generated in PhysicsGeometyPhysX.cpp (FBodySetupShapeIterator::ForEachShape) function.

In earlier engine versions (I’m using 4.18) the code to determine offsets looked like this:


const float ContactOffset = ComputeContactOffset(Geom);
VisitorFunc(Elem, Geom, PLocalPose, ContactOffset);


And in 4.21 (my current version) it looks like this:


const float RestOffset = ComputeRestOffset(Elem);
const float ContactOffset = FMath::Max(ComputeContactOffset(Geom), RestOffset + 1.f);    //make sure contact offset is always at least rest offset + 1 cm
VisitorFunc(Elem, Geom, PLocalPose, ContactOffset, RestOffset);

This seems to force a minimum value for ContactOffset which results in “catching” on edges between two rigid bodies that are flush with each other.

I’m able to get my game running as it did in 4.18 (no catching!) by replacing the code in PhysicsGeometryPhysX.cpp with this:


const float RestOffset = 0.0f;
const float ContactOffset = ComputeContactOffset(Geom); 
VisitorFunc(Elem, Geom, PLocalPose, ContactOffset, RestOffset);

The problem is that this is a change to engine source and thus unusable for the rest of my team and those working with the Binary version of the engine. It also probably has unintended consequences I haven’t discovered yet.