feat(physics): Phase 2 — port CellTransit + wire into ResolveCellId

New CellTransit static class ports retail's portal-graph cell traversal:
- FindTransitCellsSphere — indoor portal-neighbour walk
- AddAllOutsideCells     — outdoor 24m grid expansion
- FindCellList           — top-level driver (BFS through portals;
                           PointInsideCellBsp for final containment)

PhysicsEngine.ResolveOutdoorCellId renamed to ResolveCellId. Body
rewritten: indoor seeds delegate to CellTransit.FindCellList (portal-
graph BFS + BSP containment test); outdoor seeds keep the landblock
terrain grid lookup from the original implementation (preserving the
L.2e prefix-preservation fix). Signature extended with sphereRadius
parameter (needed by the sphere-vs-portal-plane test). Three call
sites updated (PhysicsEngine x2, TransitionTypes x1).

BSPQuery.PointInsideCellBsp retyped from PhysicsBSPNode? to CellBSPNode?
— the function operates on the cell-BSP tree (CellPhysics.CellBSP.Root
is a CellBSPNode). The previous PhysicsBSPNode typing was dead code, so
retype is safe.

Deletes the Phase D ResolveOutdoorCellIdTests.cs file. New ResolveCellIdTests
covers the equivalent contracts (fallback zero, outdoor seed with no
landblock).

Outdoor->indoor entry (check_building_transit) is stubbed pending the
BuildingPhysics infrastructure landing in the next commit.

Spec: docs/superpowers/specs/2026-05-19-indoor-portal-cell-tracking-design.md
Plan: docs/superpowers/plans/2026-05-19-indoor-portal-cell-tracking.md

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Erik 2026-05-19 17:14:04 +02:00
parent 1969c55823
commit aad697602e
8 changed files with 472 additions and 182 deletions

View file

@ -928,16 +928,24 @@ public static class BSPQuery
// =========================================================================
/// <summary>
/// BSPNode.point_inside_cell_bsp — test if a 3D point is inside the cell BSP.
/// BSPNode.point_inside_cell_bsp — recursive cell-BSP point containment test.
///
/// <para>
/// Follows the front side of each splitting plane. A point is inside when it
/// reaches a front leaf or null PosNode (solid interior).
/// Indoor walking Phase 2 (2026-05-19): retyped from PhysicsBSPNode? to
/// CellBSPNode? — the function operates on the CellBSP tree (which is
/// distinct from the PhysicsBSP tree). The dead-code typing was wrong;
/// no callers existed, so the retype is safe.
/// </para>
///
/// <para>
/// Walks down the tree following splitting planes; returns true when the
/// point reaches a front leaf or null PosNode (solid interior). Behind
/// any splitting plane → outside.
/// </para>
///
/// <para>ACE: BSPNode.cs point_inside_cell_bsp.</para>
/// </summary>
public static bool PointInsideCellBsp(PhysicsBSPNode? node, Vector3 point)
public static bool PointInsideCellBsp(CellBSPNode? node, Vector3 point)
{
if (node is null) return true;
if (node.Type == BSPNodeType.Leaf) return true;