Cut 1: 1536m desert relief, terrain/cover LOS detection, tier positioning, 3P shoulder cam
This commit is contained in:
parent
3bd66c3b64
commit
3221ca1d0c
19 changed files with 1558 additions and 316 deletions
|
|
@ -82,15 +82,18 @@ namespace RustToDust.Tests
|
|||
public void Raycast_RespectsStaticCoverWalls()
|
||||
{
|
||||
using var session = new ArenaSession(seed: 12);
|
||||
// Cover block #0 sits at (28, 1.8, 16) with half-extents (4.5, 1.8, 1.4).
|
||||
// A ray from one side (28, 1.0, 10) to the other side (28, 1.0, 22) must hit the static cover wall!
|
||||
var blockedHit = session.World.CastRayClosest((28f, 1.0f, 10f), (0f, 0f, 15f));
|
||||
var c0 = session.State.ArenaCoverBoxes[0];
|
||||
float rayStartZ = c0.Z - c0.HalfZ - 5f;
|
||||
float raySpanZ = c0.HalfZ * 2f + 10f;
|
||||
|
||||
// A ray from one side of cover block #0 to the other must hit the static cover wall!
|
||||
var blockedHit = session.World.CastRayClosest((c0.X, c0.Y, rayStartZ), (0f, 0f, raySpanZ));
|
||||
Assert.True(blockedHit.Hit);
|
||||
Assert.True(blockedHit.Point.Z < 16f, $"Expected cover hit before z=16, got z={blockedHit.Point.Z:F2}");
|
||||
Assert.True(blockedHit.Point.Z < c0.Z, $"Expected cover hit before z={c0.Z:F2}, got z={blockedHit.Point.Z:F2}");
|
||||
Assert.InRange(blockedHit.StableId, 10UL, 99UL); // Static cover StableId range
|
||||
|
||||
// Ray high above the cover block (y = 5.0 > 3.6 top) passes unobstructed
|
||||
var clearHit = session.World.CastRayClosest((28f, 5.0f, 10f), (0f, 0f, 15f));
|
||||
// Ray high above the cover block passes unobstructed
|
||||
var clearHit = session.World.CastRayClosest((c0.X, c0.Y + c0.HalfY + 2.0f, rayStartZ), (0f, 0f, raySpanZ));
|
||||
Assert.False(clearHit.Hit);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue