[5.9 Preview 1] UE-380849 now causes wrong collision, not only non-deterministic cooks

Summary

[5.9 Preview] Runtime ProceduralMeshComponents above 16384 verts share one cooked complex collision (wrong collision, traces miss)

What Type of Bug are you experiencing?

Simulation

Steps to Reproduce

  1. In a 5.9 project, at runtime create two UProceduralMeshComponents with different terrain-like grids, each with more than 16384 vertices (p.BodySetupSkipDDCThreshold).
  2. Call CreateMeshSection on each with bCreateCollision=true, no simple collision, and CollisionTraceFlag = UseComplexAsSimple. Same collision settings on both.
  3. Line-trace (ECC_WorldStatic) straight down onto the second mesh, at a spot where only the second mesh has geometry.

Expected Result

The trace hits the second mesh’s surface. Each mesh gets complex collision cooked from its own triangles.

Observed Result

The trace misses, or hits where the FIRST mesh’s surface would be. Every such mesh gets the same cooked collision from the physics DDC. In our game, 16 terrain tiles with different bounds all cooked to one set of bounds, and characters fall through. Clearing the DDC does not help: it happens again within one run.

Affects Versions

5.9

Platform(s)

Linux

Additional Notes

Engine: 5.9.0-preview-1 (commit acf0265dd), source build, not modified in this area. Related: UE-380849 (Backlogged), which notes an invariant GUID is a problem above CVarBodySetupSkipDDCThreshold vertices. In 5.9 this now gives wrong collision, not just a non-deterministic cook.

Cause (from the source): UBodySetup::InvalidatePhysicsData (BodySetup.cpp ~line 853) now derives BodySetupGuid from AggGeom + flags + trace flag only. It leaves complex triangles out because CDP->GetMeshId() is supposed to cover them in GetGeometryDDCKey (~line 1611). UProceduralMeshComponent doesn’t override GetMeshId, so every such mesh gets the same DDC key. In 5.7 BodySetupGuid was a random FGuid::NewGuid(). Likely affects all platforms.

Workaround: a UProceduralMeshComponent subclass whose GetMeshId hashes the section vertices and indices.
Suggested fix: hash the complex source (or a provider mesh id) into the GUID or DDC key, or give UProceduralMeshComponent a content-based GetMeshId.