Cook non-determinism due to changes in UStaticMeshComponent.BodyInstance.MaxAngularVelocity

I’m observing cook non-determinism in some values of UStaticMeshComponent.BodyInstance.MaxAngularVelocity property: the original value in the source assets is 3600, but sometimes it’s serialized to 3599.99... (1 bit off). The change happens because of this line in FBodyInstance::InitDynamicProperties_AssumesLocked: SetMaxAngularVelocityInRadians(GetMaxAngularVelocityInRadians(), false, false); - converting 3600 to radians and back to degrees does not roundtrip perfectly. I’m not sure why it happens only sometimes (i.e. why is it not _always_ cooked as 3599.99...).

Still, this change looks unnecessary. All other properties use Update* functions that don’t touch the actual properties and just update the underlying physics actor. As a local change, I’ve replaced this call with a call to a new function:

void FBodyInstance::UpdateMaxAngularVelocity()
{
	float MaxAngVel = GetMaxAngularVelocityInRadians();
	FPhysicsCommand::ExecuteWrite(ActorHandle, [&](const FPhysicsActorHandle& Actor)
	{
		FPhysicsInterface::SetMaxAngularVelocity_AssumesLocked(Actor, MaxAngVel);
	});
}

Note that it’s a slight change in behaviour (if some code or blueprint is reading MaxAngularVelocity property directly and it’s not being overridden (bOverrideMaxAngularVelocity flag not set), it would read wrong value - but that would probably be a bug in the caller anyway.

Hi Andrew,

Apologies for the delay in responding to this ticket, we had a company wide shutdown for 2 weeks and have been catching up!

We’ll take a look into this next week for you.

Best

Geoff Stacey

Developer Relations

EPIC Games

Hi Andrew - this and the other ticket look to be superceded by the ticket which was opened a few weeks ago. Is that correct?