fix(physics): S2 — static publication emits authored Spheres as Spheres (AP-155 narrowed)
Some checks are pending
Headless portability / portable-headless (ubuntu-latest) (push) Waiting to run
Headless portability / portable-headless (windows-latest) (push) Waiting to run
Headless portability / linux-graphical (push) Waiting to run
Headless portability / linux-vulkan (push) Waiting to run

Both static sites (LandblockPhysicsPublisher, the headless-only
LandblockPhysicsContentBuilder) emitted an authored Setup Sphere as a
base-anchored Cylinder of radius r and height 2r. The live path emits a
Sphere for the same data, so the same object collided differently by
arrival route, and the narrow phase met a flat cap where retail meets a
curved surface. Both sites now mirror ShadowShapeBuilder.FromSetup's
Sphere block exactly.

Combined Opus review: PASS. Its numeric verification of the dispatch
test's geometry (head-sphere clearance 0.201 m for the true sphere; the
cylinder counterfactual inside by 0.10 m XY with the Z band overlapping)
is what makes the discrimination claim more than a sabotage anecdote,
and its F8 finding is applied: the test now carries a POSITIVE control —
aiming straight through the boulder's centre must block — so a
membership/seed regression can no longer masquerade as a curve-hit
pass. F4 applied: CylHeight is asserted, not inferred (the C4 lesson).
F3 applied: the deleted Quaternion.Inverse base composition is recorded
as internally coherent for the old cylinder's world-Z axis — the defect
was the shape TYPE, not that rotation math.

The review also verified the deleted-cylinder blast radius: the F2
overlay's drawn span is IDENTICAL for both shapes (old [c-r, c+r], new
[c-r, c+r]); the flood sphere's centre rises by exactly r, which cannot
change outdoor membership (XY rectangle) and lands the indoor half on
Session B's dungeon gate alongside S1B; and the sphere-branch flood is
now pinned uncapped by a genuine eleventh-shape A/B test.
PublishStaticCollision — the headless static path — gains its first
test ever.

AP-155 is NARROWED, not deleted (review F13): the has-BSP source split
(entity.MeshRefs vs setup.Parts + AnimPartChanged) survives and keeps
the row active. The shared-primitive-emitter refactor that would make
route independence a compile-time property is the filed follow-up
(review F20).

Population: 3,506 of 5,935 installed Setups, structurally equal to
AP-157's third-branch count (byte-identical classifier — three
independent routes agree: 3,605 - 99 = 3,506).

Clean-room suite at implementation: 11,253 passed / 6 skipped / 0
failed on landed S1B. Post-review-hardening: Publisher tests 25/25,
Content tests 2/2, both green.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Erik 2026-08-07 08:07:02 +02:00
parent b3e43d22c9
commit 9671af0273
7 changed files with 470 additions and 18 deletions

View file

@ -1011,6 +1011,16 @@ public sealed class LandblockPhysicsPublisher
if (setup.Cylinders.Length == 0)
{
// AP-155: mirror ShadowShapeBuilder.FromSetup's step-2 Sphere
// emission EXACTLY (same origin/scale composition, same
// Radius<=0 guard) — a true Sphere, not a height-capped
// Cylinder. Retail's CPhysicsObj::FindObjCollisions dispatches
// an authored Setup Sphere to CSphere::intersects_sphere;
// there is no cylinder substitution for this branch. Emitting
// Cylinder here (base = origin - r*ẑ, height = 2r) made a
// static object's narrow phase disagree with the SAME object
// arriving as a live spawn via FromSetup — the route-
// dependence this fix closes.
for (int sphereIndex = 0;
sphereIndex < setup.Spheres.Length;
sphereIndex++)
@ -1022,17 +1032,15 @@ public sealed class LandblockPhysicsPublisher
float radius = sphere.Radius * scale;
Vector3 localOffset = sphere.Origin * scale;
Vector3 localBaseOffset = localOffset
+ Vector3.Transform(
-Vector3.UnitZ * radius,
Quaternion.Inverse(entity.Rotation));
setupShapes.Add(ShadowShape.Cylinder(
setupShapes.Add(// (Review F3: the deleted Quaternion.Inverse base composition was
// internally coherent for the old CYLINDER's world-Z axis — the
// defect was the shape TYPE, not that rotation math.)
ShadowShape.Sphere(
gfxObjId: entity.SourceGfxObjOrSetupId,
localPosition: localBaseOffset,
localPosition: localOffset,
localRotation: Quaternion.Identity,
scale: scale,
radius: radius,
cylHeight: radius * 2f));
radius: radius));
}
}
@ -1080,8 +1088,11 @@ public sealed class LandblockPhysicsPublisher
for (int index = 0; index < shapes.Count; index++)
{
// AP-155: the Setup-derived shape can now be Cylinder OR Sphere
// (never both — see ShadowShapeBuilder.FromSetup step 1/2). Read
// the actual emitted type rather than assuming Cylinder.
Console.WriteLine(FormattableString.Invariant(
$"[entity-source] id=0x{entity.Id:X8} entityId=0x{entity.Id:X8} src=0x{entity.SourceGfxObjOrSetupId:X8} gfxObj=0x{shapes[index].GfxObjId:X8} lb=0x{landblock.LandblockId:X8} type=Cylinder note=setup-part{index} state=0x{0u:X8} flags={EntityCollisionFlags.None}"));
$"[entity-source] id=0x{entity.Id:X8} entityId=0x{entity.Id:X8} src=0x{entity.SourceGfxObjOrSetupId:X8} gfxObj=0x{shapes[index].GfxObjId:X8} lb=0x{landblock.LandblockId:X8} type={shapes[index].CollisionType} note=setup-part{index} state=0x{0u:X8} flags={EntityCollisionFlags.None}"));
}
}

View file

@ -666,6 +666,11 @@ public static class LandblockPhysicsContentBuilder
if (setup.Cylinders.Length == 0)
{
// AP-155: mirror ShadowShapeBuilder.FromSetup's step-2 Sphere
// emission EXACTLY (same origin/scale composition, same
// Radius<=0 guard) — a true Sphere, not a height-capped
// Cylinder. See LandblockPhysicsPublisher's identical fix for
// the full retail-anchor note.
for (int index = 0;
index < setup.Spheres.Length;
index++)
@ -675,17 +680,15 @@ public static class LandblockPhysicsContentBuilder
continue;
float radius = sphere.Radius * scale;
Vector3 localOffset = sphere.Origin * scale;
Vector3 localBaseOffset = localOffset
+ Vector3.Transform(
-Vector3.UnitZ * radius,
Quaternion.Inverse(entity.Rotation));
setupShapes.Add(ShadowShape.Cylinder(
setupShapes.Add(// (Review F3: the deleted Quaternion.Inverse base composition was
// internally coherent for the old CYLINDER's world-Z axis — the
// defect was the shape TYPE, not that rotation math.)
ShadowShape.Sphere(
entity.SourceGfxObjOrSetupId,
localBaseOffset,
localOffset,
Quaternion.Identity,
scale,
radius,
radius * 2f));
radius));
}
}