cut11b: smooth liftoff transition and fix world hip/idle pred in tests
This commit is contained in:
parent
bc6ec55e43
commit
6c12a79090
3 changed files with 29 additions and 14 deletions
|
|
@ -908,7 +908,9 @@ namespace RustToDust.Tests
|
|||
var view = host.Session.World.View;
|
||||
int lane = localBody.Lane;
|
||||
|
||||
for (int t = 0; t < 6; t++)
|
||||
// Prime idle local prediction once and drain unacked inputs so client sits grounded idle with _unackedInputs.Count == 0
|
||||
client.SubmitLocalInput(new PlayerInput(0f, 0f, 0f, 40f, false, false, false), true);
|
||||
for (int t = 0; t < 10; t++)
|
||||
{
|
||||
nowMs += 16;
|
||||
host.StepOnce(nowMs);
|
||||
|
|
@ -916,6 +918,7 @@ namespace RustToDust.Tests
|
|||
client.BeginRenderFrame(1.0 / 60.0, 1f);
|
||||
Thread.Sleep(1);
|
||||
}
|
||||
Assert.Equal(0, client.UnackedInputCount);
|
||||
|
||||
Assert.True(client.TrySampleInterpolatedWalkerPose(true, slot, 1f, out var preBlastSnap),
|
||||
"Expected local walker prediction snapshot while grounded idle");
|
||||
|
|
|
|||
|
|
@ -1895,6 +1895,8 @@ namespace RustToDust.Tests
|
|||
|
||||
var comPos = new Vector3(view.PositionX[lane], view.PositionY[lane], view.PositionZ[lane]);
|
||||
var qYaw = new Quaternion(player.CurrRotX, player.CurrRotY, player.CurrRotZ, player.CurrRotW);
|
||||
var qTotal = Quaternion.Normalize(qYaw * Quaternion.CreateFromYawPitchRoll(0f, ws.LeanPitch, ws.LeanRoll));
|
||||
Vector3 pelvisWorld = Vector3.Transform(ws.PelvisOffset, qYaw);
|
||||
|
||||
for (int i = 0; i < ws.Geom.LegCount; i++)
|
||||
{
|
||||
|
|
@ -1907,8 +1909,8 @@ namespace RustToDust.Tests
|
|||
$"{spec.Id} ({map}) tick {t} leg {i}: airborne foot plunged underground ({sole.Y:F3} < {surfUnderFoot:F3})");
|
||||
}
|
||||
|
||||
Vector3 hipWorld = comPos + ws.PelvisOffset + Vector3.Transform(ws.Geom.Legs[i].HipInCom * ws.GeomScale, qYaw);
|
||||
Vector3 ankleWorld = sole + new Vector3(0f, ws.Geom.Legs[i].AnkleH * ws.GeomScale, 0f);
|
||||
Vector3 hipWorld = comPos + pelvisWorld + Vector3.Transform(ws.Geom.Legs[i].HipInCom * ws.GeomScale, qTotal);
|
||||
Vector3 ankleWorld = sole + ws.FootNormal[i] * (ws.Geom.Legs[i].AnkleH * ws.GeomScale);
|
||||
float dist3D = Vector3.Distance(ankleWorld, hipWorld);
|
||||
float maxReach = ws.Geom.Legs[i].MaxLegReach * ws.GeomScale;
|
||||
Assert.True(dist3D <= maxReach + 0.10f,
|
||||
|
|
@ -1991,10 +1993,12 @@ namespace RustToDust.Tests
|
|||
|
||||
var comPos = new Vector3(view.PositionX[lane], view.PositionY[lane], view.PositionZ[lane]);
|
||||
var qYaw = new Quaternion(player.CurrRotX, player.CurrRotY, player.CurrRotZ, player.CurrRotW);
|
||||
var qTotal = Quaternion.Normalize(qYaw * Quaternion.CreateFromYawPitchRoll(0f, ws.LeanPitch, ws.LeanRoll));
|
||||
Vector3 pelvisWorld = Vector3.Transform(ws.PelvisOffset, qYaw);
|
||||
for (int i = 0; i < ws.Geom.LegCount; i++)
|
||||
{
|
||||
Vector3 hipWorld = comPos + ws.PelvisOffset + Vector3.Transform(ws.Geom.Legs[i].HipInCom * ws.GeomScale, qYaw);
|
||||
Vector3 ankleWorld = ws.FootSole[i] + new Vector3(0f, ws.Geom.Legs[i].AnkleH * ws.GeomScale, 0f);
|
||||
Vector3 hipWorld = comPos + pelvisWorld + Vector3.Transform(ws.Geom.Legs[i].HipInCom * ws.GeomScale, qTotal);
|
||||
Vector3 ankleWorld = ws.FootSole[i] + ws.FootNormal[i] * (ws.Geom.Legs[i].AnkleH * ws.GeomScale);
|
||||
float dist3D = Vector3.Distance(ankleWorld, hipWorld);
|
||||
float maxReach = ws.Geom.Legs[i].MaxLegReach * ws.GeomScale;
|
||||
Assert.True(dist3D <= maxReach + 0.14f,
|
||||
|
|
|
|||
Loading…
Reference in a new issue