cut11b: fix snapshot and physics field names in regression tests

This commit is contained in:
Meta Vens 2026-12-06 02:12:38 +01:00
commit 2945e33e92
2 changed files with 26 additions and 19 deletions

View file

@ -803,35 +803,29 @@ namespace RustToDust.Tests
// 1. Direct snapshot interpolation guards: LegCount mismatch & >4m teleport jump must snap cleanly to curr
var snap2Leg = new WalkerVisualSnapshot
{
HipYaw = 0f,
ComPos = new Vector3(10f, 4f, 10f),
ComRot = Quaternion.Identity,
PelvisOffset = Vector3.Zero,
LeanPitch = 0.05f,
LeanRoll = 0f,
Scale = 1f,
GeomScale = 1f,
LegCount = 2,
IsArachnidUp = false,
IsDigitigrade = true,
LegSoles = new[] { new Vector3(9f, 0f, 10f), new Vector3(11f, 0f, 10f), Vector3.Zero, Vector3.Zero }
FootNormal = new LegArray4<Vector3> { L0 = Vector3.UnitY, L1 = Vector3.UnitY }
};
var snap4Leg = new WalkerVisualSnapshot
{
HipYaw = 1.2f,
ComPos = new Vector3(12f, 5f, 12f),
ComRot = Quaternion.CreateFromAxisAngle(Vector3.UnitY, 1.2f),
PelvisOffset = new Vector3(0f, -0.1f, 0f),
LeanPitch = -0.05f,
LeanRoll = 0.04f,
Scale = 1.15f,
GeomScale = 1.15f,
LegCount = 4,
IsArachnidUp = false,
IsDigitigrade = false,
LegSoles = new[]
{
new Vector3(10f, 0f, 10f),
new Vector3(14f, 0f, 10f),
new Vector3(10f, 0f, 14f),
new Vector3(14f, 0f, 14f)
}
FootNormal = new LegArray4<Vector3> { L0 = Vector3.UnitY, L1 = Vector3.UnitY, L2 = Vector3.UnitY, L3 = Vector3.UnitY }
};
var swapInterp = WalkerVisualSnapshot.Interpolate(in snap2Leg, in snap4Leg, 0.5f);
Assert.Equal(4, swapInterp.LegCount);
@ -913,6 +907,15 @@ namespace RustToDust.Tests
var view = host.Session.World.View;
int lane = localBody.Lane;
for (int t = 0; t < 6; t++)
{
nowMs += 16;
host.StepOnce(nowMs);
client.PumpNetwork(nowMs);
client.BeginRenderFrame(1.0 / 60.0, 1f);
Thread.Sleep(1);
}
Assert.True(client.TrySampleInterpolatedWalkerPose(true, slot, 1f, out var preBlastSnap),
"Expected local walker prediction snapshot while grounded idle");
float preBlastY = preBlastSnap.ComPos.Y;
@ -936,9 +939,11 @@ namespace RustToDust.Tests
sawBlastClimb = true;
for (int i = 0; i < postBlastSnap.LegCount; i++)
{
float surfY = host.Session.State.Terrain.SampleHeight(postBlastSnap.LegSoles[i].X, postBlastSnap.LegSoles[i].Z);
Assert.True(postBlastSnap.LegSoles[i].Y >= surfY - 0.10f,
$"Idle post-blast pred foot {i} dove underground ({postBlastSnap.LegSoles[i].Y:F2} < {surfY:F2})");
float surfY = host.Session.State.Terrain.SampleHeight(localWs.FootSole[i].X, localWs.FootSole[i].Z);
Assert.True(localWs.FootSole[i].Y >= surfY - 0.10f,
$"Idle post-blast foot {i} dove underground ({localWs.FootSole[i].Y:F2} < {surfY:F2})");
Assert.True(float.IsFinite(postBlastSnap.LegAngles[i].HipPitch),
$"Idle post-blast pred leg {i} angle invalid");
}
}
}