I can add some bits of info to Justin’s post that I figured out today. The case I was debugging was a level sequence brought to end-state via GoToEndAndStop and collision for a handful of actors didn’t work, even though show collision and chaos visual debugger displayed the shapes where they’re supposed to be. (Idk if it matters, but the actors in question where attached actors.)
After trying to force the sequencer to use ETeleportType::ResetPhysics in its SetComponentTranslationAndRotation and SetComponentTransform wrappers, the collision worked. So I reverted back to not setting it and then looked down the execution path of what ResetPhysics causes to execute differently.
I managed to narrow it down to this in BodyInstance::SetBodyTransform
if(bIsSimKinematic && Teleport == ETeleportType::None)
{
Scene->SetKinematicTarget_AssumesLocked(this, NewTransform, true);
}
else
{
// todo(chaos): Calling SetKinematicTarget_AssumesLocked before SetGlobalPose_AssumesLocked is unnessary for chaos. We should fix this when PhysX is removed.
if(bIsSimKinematic)
{
FPhysicsInterface::SetKinematicTarget_AssumesLocked(Actor, NewTransform);
}
FPhysicsInterface::SetGlobalPose_AssumesLocked(Actor, NewTransform);
}
With teleport mode None it ends up calling only FPhysicsInterface::SetKinematicTarget_AssumesLocked, whereas with ResetPhysics it calls SetGlobalPose_AssumesLocked after it (which does SetX/SetR with invalidation enabled).
I then went into FPhysicsInterface::SetKinematicTarget_AssumesLocked and changed the ‘false’ passed to SetX and SetR to be true instead, and that fixed the collision bug.
So while SetKinematicTarget_AssumesLocked claims
// IMPORTANT : we do not invalidate X and R as they will be properly computed using the kinematic target informationIt appears, at least when using GoToEndAndStop with a sequence, that it’s not correct that it will always be computed properly.
Edit: While results where consistent multiple editor restarts and testing with and without the workaround, I now got back some results from packaged testing and it seems the bug might still be there. Will investigate if it actually was applying the workaround there or not.
Edit2: Ignore my edit above. Turns out I made a mistake so the workaround was never active in the packaged test. (Verified again in PIE that the workaround works, another package test will be on monday.)
Edit3: yeah, workaround worked in package as well, so the original findings seem good. (I can add that framerate and/or substepping settings appear to also affect whether collision breaks. Maybe something in how kinematic target applies is affected by those timings.)
[Attachment Removed]