FBodyInstance::GetBodyBounds fails for static bodies

FBodyInstance::GetBodyBounds() is meant to return the box bounds of the instance, which it does by grabbing the data from PhysX:

ExecuteOnPxRigidBodyReadOnly(this, [&](const PxRigidBody* PRigidBody)
{
	PxBounds3 PBounds = PRigidBody->getWorldBounds();

	Bounds.Min = P2UVector(PBounds.minimum);
	Bounds.Max = P2UVector(PBounds.maximum);
});

However, ExecuteOnPxRigidBodyReadOnly is a no-op if RigidActorSync is a PxRigidStatic (as PxRigidStatic does not subclass PxRigidBody). That leads to returning uninitialized data. The correct code reads:

ExecuteOnPxRigidActorReadOnly(this, [&](const PxRigidActor* PRigidActor)
{
	PxBounds3 PBounds = PRigidActor->getWorldBounds();

	Bounds.Min = P2UVector(PBounds.minimum);
	Bounds.Max = P2UVector(PBounds.maximum);
});

Hi Sneftel,

It looks like you already have a suggested fix in mind for the issue that you described. Would you like to submit that on GitHub as a Pull Request? We can then have a developer review your suggestion and add it into the source code.

If you don’t want to, or are unable to, submit a Pull Request, I can enter a ticket internally to have this segment of code investigated.

I’m afraid my branch has diverged too far from the mainline to make a pull request practical.

Hi Sneftel,

I have entered a report of the issue that you described to have it investigated further (UE-24089).