Combines TerrainSurface + CellSurface into a single Resolve() API that handles outdoor terrain walking, indoor floor walking, outdoor<->indoor cell transitions, step-height enforcement, and ground detection. Step-height blocks upward Z deltas exceeding the limit (walls, cliffs); downhill movement is always accepted. Indoor transitions pick the cell whose floor Z is closest to the entity's current Z (handles multi-story buildings). Reports IsOnGround=false when no landblock or surface covers the entity's position (gravity applied by the caller). One API mismatch fixed vs plan: plan encoded the upper 16 landblock bits into the returned cell ID, but the tests assert the raw cell ID (0x0100, <0x0100) — so Resolve returns targetCellId directly. 6 new tests covering flat terrain, slopes, step-height rejection, indoor entry/exit, and void detection. 243 total, all green. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
13 lines
367 B
C#
13 lines
367 B
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.
|
|
/// </summary>
|
|
public readonly record struct ResolveResult(
|
|
Vector3 Position,
|
|
uint CellId,
|
|
bool IsOnGround);
|