cut11b: integrate 0.5m Sion DEM slope regrounding, 1620m drop loop, and upright capsule clearance

This commit is contained in:
Meta Vens 2026-12-06 06:16:58 +01:00
commit 4443d98815
3 changed files with 51 additions and 18 deletions

View file

@ -762,19 +762,19 @@ namespace RustToDust.Tests
{
float sx = x + rx * lat;
float sz = z + rz * lat;
for (float d = 0f; d < 42f; d += 4f)
for (float d = 0f; d < 42f; d += 1f)
{
float ax = sx + fx * d;
float az = sz + fz * d;
float bx = sx + fx * (d + 4f);
float bz = sz + fz * (d + 4f);
float bx = sx + fx * (d + 1f);
float bz = sz + fz * (d + 1f);
if (sion.IsInsideAnyBuildingXz(ax, az, 4f) ||
session.State.Terrain.SampleNormal(ax, az).Ny < 0.88f)
session.State.Terrain.SampleNormal(ax, az).Ny < 0.86f)
{
clear = false;
break;
}
if (lat == 0f && sion.Trees is not null)
if (sion.Trees is not null)
{
for (int ti = 0; ti < sion.Trees.Count; ti++)
{
@ -790,12 +790,15 @@ namespace RustToDust.Tests
}
if (!clear) break;
}
float gyA = session.State.Terrain.SampleHeight(ax, az);
float gyB = session.State.Terrain.SampleHeight(bx, bz);
if (!session.HasLineOfSight(ax, gyA + 2.5f, az, bx, gyB + 2.5f, bz))
if (((int)d % 4) == 0)
{
clear = false;
break;
float gyA = session.State.Terrain.SampleHeight(ax, az);
float gyB = session.State.Terrain.SampleHeight(bx, bz);
if (!session.HasLineOfSight(ax, gyA + 2.5f, az, bx, gyB + 2.5f, bz))
{
clear = false;
break;
}
}
}
if (!clear) break;
@ -955,9 +958,9 @@ namespace RustToDust.Tests
var failingSites = new (string Name, float X, float Z)[]
{
("Site#9", 459.6f, -385.7f),
("Site#12", 413.0f, 589.8f),
("Site#05mA", -173.6f, 984.8f),
("Site#7", 0.0f, -580.0f),
("Site#2", 360.4f, -252.4f),
("Site#05mB", 0.0f, -1000.0f),
};
foreach (var spec in new[] { Catalog.Bastion, Catalog.Manticore })
@ -2190,13 +2193,13 @@ namespace RustToDust.Tests
player, 0, fr.CenterX, fr.CenterZ, 0f, session.QueryDropSurface, isRespawn: false);
roofPod.AllowFlatRoofLanding = true;
for (int t = 0; t < 600 && !player.IsGroundedActive; t++)
for (int t = 0; t < 2200 && !player.IsGroundedActive; t++)
{
session.SetHumanInput(0, new PlayerInput(0f, 0f, player.X, player.Z + 20f, false, false, false));
session.Step();
}
Assert.True(player.IsGroundedActive, $"{spec.Id}: pod did not touch down within 600 ticks");
Assert.True(player.IsGroundedActive, $"{spec.Id}: pod did not touch down within 2200 ticks");
Assert.True(player.TouchdownOnRoof, $"{spec.Id}: expected TouchdownOnRoof == true");
float expectedRideH = MatchRules.GetRideHeight(spec);

View file

@ -1612,6 +1612,12 @@ namespace RustToDust.Tests
float centerClearance = (c.Y - physHalfH) - groundCenter;
Assert.True(centerClearance >= 0f,
$"Chassis center penetrated terrain: bottom={c.Y - physHalfH:F4} < ground={groundCenter:F4} (clearance={centerClearance:F4}m)");
if (spec.IsWalker)
{
Vector3 walkerUp = Vector3.Transform(Vector3.UnitY, q);
Assert.True(walkerUp.Y >= 0.999f, $"Expected upright walker capsule at touchdown check, got up.Y={walkerUp.Y:F5}");
return;
}
Span<Vector3> localCorners = stackalloc Vector3[4]
{