Complete Render Residual A's faithful port: PhysicsCameraCollisionProbe.SweepEye now mirrors SmartBox::update_viewer (acclient_2013_pseudo_c.txt:92761) end-to-end: - Start cell (pc:92824-92844): indoor (>=0x100) seats the sweep at the head-PIVOT via PhysicsEngine.AdjustPosition (the cellar-lip case — feet in the low connector, head up at floor level); outdoor keeps the player cell. - Sweep pivot -> sought-eye from the seated start cell (unchanged 0x5c viewer flags). - Success (pc:92870): set_viewer(curr_pos), viewer_cell = curr_cell. - Fallback 1 (pc:92878): AdjustPosition(sought_eye). - Fallback 2 / no-cell (pc:92775, 92886): snap to player, viewer_cell = null. This also makes cellId==0 faithful (was returning the desired eye; retail snaps to player_pos) and adds the playerPos arg to ICameraCollisionProbe.SweepEye. Supporting: ResolveResult.Ok surfaces FindTransitionalPosition's return (retail find_valid_position != 0, pc:273898) so SweepEye knows when to fall back. TDD: 11 new tests (FindVisibleChildCell 4, AdjustPosition 3, ResolveResult.Ok 2, SweepEye orchestration 2). The seating test's RED proved the sweep does NOT auto- advance feet->room, so the pivot-seated start cell is genuinely decisive. Core 1326 pass / 4 documented-fail / 1 skip; App 179 pass / 0 fail. No regression. Per the live-capture finding, the visible payoff is the cellar-corner (point 3); the cottage-room bluish void stays for residual C. Spec: docs/superpowers/specs/2026-06-05-residual-a-camera-collision-design.md. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
37 lines
1.7 KiB
C#
37 lines
1.7 KiB
C#
using System.Numerics;
|
|
|
|
namespace AcDream.Core.Physics;
|
|
|
|
/// <summary>
|
|
/// Result of <see cref="PhysicsEngine.Resolve"/>: the validated
|
|
/// position after collision, the cell the entity ended up in,
|
|
/// and whether they're standing on a surface.
|
|
///
|
|
/// <para>
|
|
/// L.3a (2026-04-30): added optional collision-normal fields so the
|
|
/// caller (typically <see cref="AcDream.App.Input.PlayerMovementController"/>)
|
|
/// can apply retail's velocity-reflection bounce
|
|
/// (<c>v_new = v - (1 + elasticity) * dot(v, n) * n</c>) to the
|
|
/// PhysicsBody after the geometric resolve completes. ACE port mirror:
|
|
/// <c>references/ACE/Source/ACE.Server/Physics/PhysicsObj.cs:2692-2697</c>;
|
|
/// retail equivalent: <c>CPhysicsObj::handle_all_collisions</c> at
|
|
/// <c>acclient_2013_pseudo_c.txt:282699-282715</c>.
|
|
/// </para>
|
|
/// </summary>
|
|
public readonly record struct ResolveResult(
|
|
Vector3 Position,
|
|
uint CellId,
|
|
bool IsOnGround,
|
|
/// <summary>True when a wall collision occurred during this resolve
|
|
/// and <see cref="CollisionNormal"/> is meaningful.</summary>
|
|
bool CollisionNormalValid = false,
|
|
/// <summary>Outward surface normal of the wall the sphere hit. Used
|
|
/// by the velocity-reflection step. Pointing away from the wall.</summary>
|
|
Vector3 CollisionNormal = default,
|
|
/// <summary>Render Residual A — whether the underlying
|
|
/// <c>FindTransitionalPosition</c> found a valid position (retail
|
|
/// <c>find_valid_position != 0</c>, pc:273898). False when the sweep had no
|
|
/// start cell or was immediately stuck. The camera <c>SweepEye</c> reads this
|
|
/// to trigger <c>SmartBox::update_viewer</c>'s fallbacks. Default <c>true</c>
|
|
/// so existing callers are unaffected.</summary>
|
|
bool Ok = true);
|