Same Frame Readbacks Incorrect With Physics Substepping Enabled

When physics substepping is enabled, setting an actor location and then checking overlaps or doing anything with primitive component bodies results in the wrong location being used for those bodies.

For example, with physics substepping enabled:

AActor* myActor = GetSomeActor();
myActor->SetActorLocation( GetSomeRandomLocation() );
FVector myActorLocation = myActor->GetActorLocation(); // this is correct
UPrimitiveComponent* myActorRootComponent = CastChecked<UPrimitiveComponent>( myActor->GetRootComponent() );
FVector myActorRootComponentLocation = myActorRootComponent->BodyInstance.GetUnrealWorldTransform().GetTranslation(); // this is incorrect

The above does work when substepping is disabled. This is particularly problematic when you need to move an actor and check overlaps with other actors on the same frame.

Hello BrainDx,

Thank you for reporting this issue. Unfortunately I’m having trouble reproducing the issue. Would it be possible for you to put together a quick project that reproduces the issue?

I’ve just attempted to reproduce this on 4.9 in a simple project with somewhat mixed results. It appears as though the behavior of UPrimitiveComponent::BodyInstance::GetUnrealWorldTransform() in 4.9 is now independent of whether or not substepping is enabled and is now based only on whether ETeleportType is TeleportPhysics.

Unfortunately, upon upgrading our game to 4.9 I can see that we’re still getting inconsistent same-frame overlapping behavior in our title when substepping is enabled, so it appears my issue and the return value of BodyInstance::GetUnrealWorldTransform() are not linked after all. I’m having trouble reproducing it in a simple project. I will update this thread if I can figure it out.

Hi BrainDx,

Are you still experiencing this issue? Have you had any success in finding a reproduction case? In the meantime, I’ll be setting this question to resolved for tracking purposes. If you have any more information to provide, please leave a comment and the question will reopen.

Have a nice day!