fix(physics): make collision activation starvation-free

This commit is contained in:
Erik 2026-07-31 18:34:46 +02:00
parent d94145e6b8
commit 6b28ff999c
14 changed files with 4637 additions and 474 deletions

View file

@ -802,6 +802,10 @@ public sealed class LandblockPhysicsPublisherTests
Assert.DoesNotContain("_physicsDataCache.RemoveBuildingsForLandblock", publisherSource, StringComparison.Ordinal);
Assert.DoesNotContain("_physicsEngine.ShadowObjects.Reflood", publisherSource, StringComparison.Ordinal);
Assert.Contains("CommitCollisionGeneration(", publisherSource, StringComparison.Ordinal);
Assert.DoesNotContain(
"RestartCollisionRetainedOwnerCapture(",
publisherSource,
StringComparison.Ordinal);
}
private static void Publish(

View file

@ -482,7 +482,15 @@ public class PhysicsEngineTests
[Fact]
public void ResolveWithTransition_SelfShadowEntry_NotPushedWhenIdMatches()
{
var engine = MakeFlatEngine(terrainZ: 50f);
var freshCache = new PhysicsDataCache();
var engine = new PhysicsEngine { DataCache = freshCache };
engine.AddLandblock(
0xA9B4FFFFu,
new TerrainSurface(FlatHeightmap(50), LinearHeightTable()),
Array.Empty<CellSurface>(),
Array.Empty<PortalPlane>(),
worldOffsetX: 0f,
worldOffsetY: 0f);
// FindObjCollisions early-returns when DataCache is null. An empty
// cache is enough for cylinder objects; only BSP objects look up
// entries inside.
@ -490,9 +498,7 @@ public class PhysicsEngineTests
// succeeds for the outdoor seed cell (0xA9B40039). In production the
// streaming-center landblock is always resident before outdoor resolves run;
// we replicate that invariant here by registering a flat dummy terrain.
var freshCache = new PhysicsDataCache();
freshCache.CellGraph.RegisterTerrain(0xA9B4FFFFu, new TerrainSurface(FlatHeightmap(50), LinearHeightTable()), Vector3.Zero);
engine.DataCache = freshCache;
const uint movingEntityId = 0xDEADBEEFu;
var bodyPos = new Vector3(96f, 96f, 50f);

File diff suppressed because it is too large Load diff