"Bad Body Instance" logspam due to serialization issue in component validation

Hello,

We have been experiencing excessive logspam due to the BodyInstance validation on line 910 of PrimitiveComponent.cpp

The if statement below implies that if collision is disabled (i.e set to NoCollision) then this validation will be skipped.

#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
			if ((BodyInstance.GetCollisionEnabled() != ECollisionEnabled::NoCollision) && (FMath::IsNearlyZero(BodyScale.X) || FMath::IsNearlyZero(BodyScale.Y) || FMath::IsNearlyZero(BodyScale.Z)))
			{
				UE_LOG(LogPhysics, Warning, TEXT("Scale for %s has a component set to zero, which will result in a bad body instance. Scale:%s"), *GetPathNameSafe(this), *BodyScale.ToString());
 
				// User warning has been output - fix up the scale to be valid for physics
				BodyTransform.SetScale3D(FVector(
					FMath::IsNearlyZero(BodyScale.X) ? UE_KINDA_SMALL_NUMBER : BodyScale.X,
					FMath::IsNearlyZero(BodyScale.Y) ? UE_KINDA_SMALL_NUMBER : BodyScale.Y,
					FMath::IsNearlyZero(BodyScale.Z) ? UE_KINDA_SMALL_NUMBER : BodyScale.Z
				));
			}
#endif

However this validation generates a warning even if the static mesh component on the actor is set to NoCollision.

The validation will always generate a warning if the blueprint asset has collision is enabled, regardless of whether the actor component placed in world has collision disabled.

It seems like the validation is executing before the BodyInstance/BodySetup for the component has been fully initialized, and so it’s falling back to the class default.

If so, is this a bug? Please let us know.

Thanks,

-Amiko :slight_smile:

[Attachment Removed]

Steps to Reproduce

  1. Create an actor blueprint asset
  2. Add a static mesh component to the blueprint
  3. Place the blueprint into a new level
  4. On this newly placed actor, on the root scene component set the Z scale to 0
  5. On the same actor set the static mesh component Collision Enabled value to be NoCollision.
  6. Change/move the actor in any way that executes the SCS (e.g change the world position)
  7. Observe the output log to see warning about bad body instance
  8. Now, in the blueprint asset set the collision on the static mesh to be NoCollision and recompile
  9. Change/move the actor in any way that executes the SCS (e.g change the world position)
  10. Observe the warning no longer appears

[Attachment Removed]

Hi Amiko,

I’ve been assigned this ticket and I’m looking into it. I should get back to you soon.

I do believe the in-level actor instance properties are only applied later after the warning was already triggered. I’ll try to confirm the timing and see if there is some quick workaround.

Best regards,

Vitor

[Attachment Removed]

Hi Amiko,

Thank you for the report, I was able to repro the problem and it does seem like a small bug. Note that, up to UE 5.4, it was actually not possible to override the Collision Profile of a Blueprint-defined StaticMeshComponent in an actor instance placed on a level (see UE-82422 and UE-58279, for example). This restriction seems to have been lifted only in UE 5.5, so this warning (and possibly other small issues) might have gone unnoticed until now.

I have filed an internal bug report about this, here’s the tracking number: UE-360406. The link should become accessible once the engine devs mark it as public.

In the meantime, you can work around this by adding an extra SceneComponent just below the root of the actor blueprint, and attach the remaining hierarchy to that. If you then change the scale of that extra SceneComponent instead of the root, the effect should be the same but without the annoying warning.

Let me know if this helps!

Best regards,

Vitor

[Attachment Removed]

Hi Vitor,

I will test adding the extra component to work around this for now.

Thank you for your help!

Kind regards,

-Amiko :slight_smile:

[Attachment Removed]