using System.Numerics;
namespace AcDream.Core.Physics;
///
/// Result of : the validated
/// position after collision, the cell the entity ended up in,
/// and whether they're standing on a surface.
///
///
/// L.3a (2026-04-30): added optional collision-normal fields so the
/// caller (typically )
/// can apply retail's velocity-reflection bounce
/// (v_new = v - (1 + elasticity) * dot(v, n) * n) to the
/// PhysicsBody after the geometric resolve completes. ACE port mirror:
/// references/ACE/Source/ACE.Server/Physics/PhysicsObj.cs:2692-2697;
/// retail equivalent: CPhysicsObj::handle_all_collisions at
/// acclient_2013_pseudo_c.txt:282699-282715.
///
///
public readonly record struct ResolveResult(
Vector3 Position,
uint CellId,
bool IsOnGround,
/// True when a wall collision occurred during this resolve
/// and is meaningful.
bool CollisionNormalValid = false,
/// Outward surface normal of the wall the sphere hit. Used
/// by the velocity-reflection step. Pointing away from the wall.
Vector3 CollisionNormal = default,
/// Render Residual A — whether the underlying
/// FindTransitionalPosition found a valid position (retail
/// find_valid_position != 0, pc:273898). False when the sweep had no
/// start cell or was immediately stuck. The camera SweepEye reads this
/// to trigger SmartBox::update_viewer's fallbacks. Default true
/// so existing callers are unaffected.
bool Ok = true,
///
/// Final transition orientation. Projectile callers consume the
/// interpolated frame committed before a PathClipped collision; legacy
/// point/capsule callers leave this at identity and ignore it.
///
Quaternion Orientation = default,
///
/// Exact retail SetPositionInternal contact-plane-valid result. This is
/// distinct from : a steep surface may be contact
/// without being ground.
///
bool InContact = false,
///
/// Exact retail walkability result after testing the contact-plane normal
/// against .
///
bool OnWalkable = false,
/// The accepted SetPosition contact plane, when present.
Plane ContactPlane = default,
/// Full cell that owns .
uint ContactPlaneCellId = 0,
/// Whether the accepted contact plane is water.
bool ContactPlaneIsWater = false);