Integrate source airborne tilt and logical-root rendering

This commit is contained in:
UnixNight committed 2026-11-05 10:19:12 -05:00
1 parent a61f1b0284
commit 27be8ed630
36 files changed
+1953 -62

No files matched your search

+69 -3
View File
@@ -19,6 +19,8 @@ var tests = new (string Name, Action Check)[]
("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),
("Init and authored Euler keep destination and dirty ownership separate", FacingState),
("air target and pitch seed phases survive mode and route transitions", AirPitchPhases),
("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),
@@ -398,7 +400,7 @@ static void FacingOwnership()
"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.ApplyAuthoredTransform(tilted.ActorRoot,new Vector3(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");
@@ -408,6 +410,68 @@ static void FacingOwnership()
"pitch and roll settling belong to the same control-independent facing phase");
}
static void FacingState()
{
var simulation=FlatSimulation(155);
Check(simulation.FacingTarget==Vector3.Zero&&!simulation.FacingDirty,
"Init clears destination axes and dirty while STRT supplies current yaw");
simulation.ApplyAuthoredTransform(simulation.ActorRoot,new Vector3(15,275,20));
simulation.Step(default,controlled:false);
NearVector(simulation.Rotation,new(15,275,20),0,"authored current Euler survives without an active destination");
Check(simulation.FacingTarget==Vector3.Zero&&!simulation.FacingDirty,"authored write does not invent a destination write");
simulation.Step(new(true,false,false,false,false));
Check(simulation.FacingTarget==new Vector3(0,275,0)&&simulation.FacingDirty,
"accepted ground heading writes upright destination; before-step difference keeps dirty");
Check(simulation.Pitch<15&&simulation.Roll<20,"base facing consumes the new full-axis destination");
simulation.Reset();
simulation.Step(default,controlled:false);
Near(simulation.Yaw,155,0,"reset's zero destination cannot pull authored yaw toward zero");
Check(!simulation.FacingDirty,"inactive reset destination stays clean");
simulation.Step(new(true,false,false,false,false));
Check(!simulation.FacingDirty&&simulation.FacingTarget==simulation.Rotation,
"source clears dirty when all current axes already equal the written target");
}
static void AirPitchPhases()
{
var forward=new PlayerInput(true,false,false,false,true);
var simulation=FlatSimulation();
simulation.Step(forward); //Ground input, then ordinary air apply seeds−40/+10.
simulation.Step(forward);
Check(simulation.FacingTarget.X==-40&&simulation.FacingTarget.Z==0,
"ordinary airborne throttle publishes source forward pitch");
Check(MathF.IEEERemainder(simulation.Pitch,360)<0&&simulation.Velocity.Y>0,
"current pitch follows target while incoming vertical motion remains physical");
simulation.Step(new(false,true,false,true,true));
Check(simulation.FacingTarget.X==10&&simulation.FacingTarget.Z>0,
"backward target and turn lean use the updated air turn scalar");
var tilted=FlatSimulation();
for(var tick=0;tick<40;tick++)tilted.Step(forward);
Check(!tilted.Grounded&&tilted.Speed==600&&new Vector2(tilted.Velocity.X,tilted.Velocity.Z).Length()<550,
"source air pitch attenuates horizontal forward while retaining the controller speed scalar");
tilted.SetNoclip(true);
Check(!tilted.FacingDirty&&tilted.FacingTarget==tilted.Rotation,"modern noclip entry freezes the pending airborne facing request");
foreach(var retained in new[]{false,true})
{
var bubble=FlatSimulation();bubble.InputAfterPlayerUpdate=retained;bubble.GadgetMode=0;
bubble.Step(new(false,false,false,false,false,Fire:true));
Near(bubble.FacingTarget.X,retained?-10:-40,0,"first Bubble input reads pitch from its preceding apply phase");
Near(bubble.ForwardAirPitch,-10,0,"Bubble apply seeds the next input's pitch");
bubble.GadgetMode=-1;
var carried=bubble.CaptureLevelState(-1)!;
Near(carried.ForwardPitch,-10,0,"cleanup retains the field rather than inferring it from current mode");
var destination=FlatSimulation();destination.LevelCode="VR04";
Check(destination.ApplyRetainedLevelState(carried with{MovementMode=1}),"route accepts proven retained pitch fields");
Check(destination.FacingTarget==Vector3.Zero&&!destination.FacingDirty,"route Init resets destination independently of retained pitches");
destination.Step(forward);
Near(destination.FacingTarget.X,-10,0,"first ordinary air input can consume a prior Bubble pitch seed");
Near(destination.ForwardAirPitch,-40,0,"ordinary apply restores its own pitch seeds afterward");
destination.Step(forward);
Near(destination.FacingTarget.X,-40,0,"following input consumes ordinary seed");
}
}
static void ReplayRates()
{
LabSimulation? reference = null;
@@ -524,8 +588,10 @@ static void JetpackControl()
}
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");
//Recovered forward pitch attenuates horizontal travel; this verifies a
//measurable change of path without retaining the old flat-air distance.
Check(left.Position.X < -30 && right.Position.X > 30 && left.Position.Y > initialHeight,
$"powered paths change direction and retain vertical lift: left={left.Position}, right={right.Position}, initialY={initialHeight}");
var beforeBrake = left.Speed;
for (var i = 0; i < 40; i++) left.Step(new(false, true, false, false, true));
Check(beforeBrake > 0 && left.Speed == 0 && left.TurnRate == 0 && !left.Grounded,