diff --git a/tests/RustToDust.Tests/CultNetMultiplayerTests.cs b/tests/RustToDust.Tests/CultNetMultiplayerTests.cs index cbb5fab..ee3e11b 100644 --- a/tests/RustToDust.Tests/CultNetMultiplayerTests.cs +++ b/tests/RustToDust.Tests/CultNetMultiplayerTests.cs @@ -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 { 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 { 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"); } } } diff --git a/tests/RustToDust.Tests/HybridBWalkerTests.cs b/tests/RustToDust.Tests/HybridBWalkerTests.cs index e3ff010..d5f7a62 100644 --- a/tests/RustToDust.Tests/HybridBWalkerTests.cs +++ b/tests/RustToDust.Tests/HybridBWalkerTests.cs @@ -1882,7 +1882,8 @@ namespace RustToDust.Tests WalkerLocomotion.PostStepWalker(ws, player.Grid, session.State.Terrain, session.World, body, view.Mass[lane], ArenaSession.FixedDt); Assert.True(ws.IsAirborne, $"{spec.Id} ({map}): must start airborne at +16m"); - Vector3[] prevSoles = (Vector3[])ws.FootSole.Clone(); + Vector3[] prevSoles = new Vector3[ws.Geom.LegCount]; + for (int i = 0; i < ws.Geom.LegCount; i++) prevSoles[i] = ws.FootSole[i]; bool sawAirborne = false; bool landed = false; int settledTicks = 0; @@ -1980,7 +1981,8 @@ namespace RustToDust.Tests var ws = sionSession.GetWalkerState(true, player.Id)!; var view = sionSession.World.View; int lane = body.Lane; - Vector3[] prevSoles = (Vector3[])ws.FootSole.Clone(); + Vector3[] prevSoles = new Vector3[ws.Geom.LegCount]; + for (int i = 0; i < ws.Geom.LegCount; i++) prevSoles[i] = ws.FootSole[i]; for (int t = 0; t < 120; t++) { @@ -2034,7 +2036,7 @@ namespace RustToDust.Tests sionSession.Step(); if (kWs.IsAirborne) airborneTicks++; - maxVelY = MathF.Max(maxVelY, kView.LinearVelocityY[kLane]); + maxVelY = MathF.Max(maxVelY, kView.VelocityY[kLane]); float surfY = sionSession.State.Terrain.SampleHeight(kestrel.X, kestrel.Z); maxAboveGround = MathF.Max(maxAboveGround, kestrel.Y - (surfY + MatchRules.GetRideHeight(Catalog.Kestrel))); } @@ -2077,7 +2079,7 @@ namespace RustToDust.Tests session.SetHumanInput(0, new PlayerInput(0f, 0f, 0f, 40f, false, false, false)); session.Step(); - float postStepVy = view.LinearVelocityY[lane]; + float postStepVy = view.VelocityY[lane]; Assert.True(postStepVy >= 1.5f, $"{spec.Id}: genuine {impulseVy:F1} m/s upward blast was suppressed on tick 1 (postStepVy={postStepVy:F2})"); }