Match Jimmy controller arithmetic and facing to original probes
This commit is contained in:
1 parent
42ea2b8cd5
commit
0e2f426d42
60 files changed
+6027
-48
No files matched your search
@@ -18,6 +18,7 @@ var tests = new (string Name, Action Check)[]
|
||||
("turn-only speed, forward acceleration/cap and release", SpeedLimits),
|
||||
("backpedal cap and release", Backpedal),
|
||||
("yaw sign, forward half-turn and left precedence", Turning),
|
||||
("active heading clears stale turn while control lock retains facing", FacingOwnership),
|
||||
("fixed-step input replay independent of presentation rate", ReplayRates),
|
||||
("jump rises, falls and returns to support", JumpLanding),
|
||||
("held zero-burn jump repeats and release stops repetition", HeldJump),
|
||||
@@ -358,8 +359,9 @@ static void Turning()
|
||||
left.Step(new(false, false, true, false, false));
|
||||
right.Step(new(false, false, false, true, false));
|
||||
forwardLeft.Step(new(true, false, true, false, false));
|
||||
Check(left.Yaw > 0 && right.Yaw < 0, "left/right yaw signs");
|
||||
Near(left.Yaw, -right.Yaw, .00001f, "opposed keyboard yaw symmetry");
|
||||
Check(left.Yaw > 0 && MathF.IEEERemainder(right.Yaw,360)<0, "left/right yaw directions across source wrap");
|
||||
Near(left.Yaw, 1.2333333f, .00001f, "left facing increment");
|
||||
Near(right.Yaw, 359, .00001f, "source negative-add truncation at zero seam");
|
||||
Near(forwardLeft.Yaw, left.Yaw / 2, .00001f, "Up halves target turn offset");
|
||||
Near(forwardLeft.Speed, 60, 0, "Up plus turn performs both speed increments");
|
||||
Check(left.Velocity.X < 0 && right.Velocity.X > 0, "keyboard side-velocity signs for next physics pass");
|
||||
@@ -375,6 +377,37 @@ static void Turning()
|
||||
SameState(both, leftOnly, "Left has precedence when Left and Right are held together");
|
||||
}
|
||||
|
||||
static void FacingOwnership()
|
||||
{
|
||||
var active = FlatSimulation();
|
||||
var neutral = FlatSimulation();
|
||||
foreach (var simulation in new[] { active, neutral })
|
||||
for (var tick = 0; tick < 12; tick++) simulation.Step(new(false, false, true, false, false));
|
||||
var heading = active.Yaw;
|
||||
active.Step(new(true, false, false, false, false));
|
||||
neutral.Step(default);
|
||||
Near(active.Yaw, heading, .0001f, "Up writes current heading instead of retaining the old turn destination");
|
||||
Check(neutral.Yaw > heading, "neutral input retains the prior facing destination");
|
||||
|
||||
var locked = FlatSimulation();
|
||||
locked.Step(new(false, false, true, false, false));
|
||||
locked.PrepareForScript();
|
||||
var before = locked.Yaw;
|
||||
locked.Step(new(true, false, false, true, true), controlled: false);
|
||||
Check(locked.Yaw > before && locked.Speed == 0 && locked.ControllerSteps == 1 && locked.Jumps == 0,
|
||||
"base facing advances its retained target during control lock while input and jump remain gated");
|
||||
|
||||
var tilted = FlatSimulation();
|
||||
tilted.SeedBubbleTilt(new(350, 0, 10));
|
||||
tilted.Step(new(true, false, false, false, false));
|
||||
Check(tilted.Pitch > 350 && tilted.Pitch < 351 && tilted.Roll < 10 && tilted.Roll > 9,
|
||||
"ground heading levels all axes by the shortest arc through the zero seam");
|
||||
var pitch = tilted.Pitch;
|
||||
tilted.Step(default, controlled: false);
|
||||
Check(tilted.Pitch > pitch && tilted.Roll < 9.25f,
|
||||
"pitch and roll settling belong to the same control-independent facing phase");
|
||||
}
|
||||
|
||||
static void ReplayRates()
|
||||
{
|
||||
LabSimulation? reference = null;
|
||||
@@ -412,7 +445,7 @@ static void JumpLanding()
|
||||
Check(sawFall && largestHeight - floor > 100, "jump rises and enters descending phase");
|
||||
Check(simulation.Grounded && simulation.Jumps == 1 && simulation.Landings == 1, "released jump lands once");
|
||||
Near(simulation.Position.Y, floor, .01f, "landing returns feet to supporting floor");
|
||||
Near(simulation.Velocity.Y, 0, 0, "landing clears downward velocity");
|
||||
Near(simulation.Velocity.Y, 0, 0, "capsule compatibility landing retains its baseline vertical velocity");
|
||||
}
|
||||
|
||||
static void HeldJump()
|
||||
@@ -489,7 +522,7 @@ static void JetpackControl()
|
||||
right.Step(new(true, false, false, true, true));
|
||||
Check(!left.Grounded && left.JetpackEffectVisible, "steering occurs during powered flight");
|
||||
}
|
||||
Check(straight.Position.Z > 400 && left.Yaw > 20 && right.Yaw < -20,
|
||||
Check(straight.Position.Z > 400 && left.Yaw > 20 && MathF.IEEERemainder(right.Yaw,360)<-20,
|
||||
"powered Up moves from rest and Left/Right turn while airborne");
|
||||
Check(left.Position.X < -50 && right.Position.X > 50 && left.Position.Y > initialHeight,
|
||||
"powered paths change direction and retain vertical lift");
|
||||
|
||||
Reference in new issue
Block a user