Recover sphere response and correct Jimmy ceiling cancellation

This commit is contained in:
UnixNight committed 2026-10-26 16:09:19 -04:00
1 parent 6a7a53c90d
commit 57dfcc64bb
37 files changed
+1324 -18

No files matched your search

+24 -5
View File
@@ -17,6 +17,7 @@ public sealed class LabSimulation
public const float BodyRadius = 24; // Provisional, not a recovered collider dimension.
private readonly SceneCollision collision;
private readonly Func<Vector3, Vector3, SupportHit?>? cameraRay;
private readonly Func<Vector3, Vector3, SupportHit?>? ceilingRay;
private readonly Vector3 sourceStart;
private readonly float startYaw, modelMinimumY, rootHeight, startFloor;
private float targetYaw, extraAirAcceleration, shadowDistance, lateralContribution;
@@ -60,6 +61,7 @@ public sealed class LabSimulation
public int PhysicsSteps { get; private set; }
public int ControllerSteps { get; private set; }
public int EffectSteps { get; private set; }
public int CeilingHits { get; private set; }
public int Jumps { get; private set; }
public int Landings { get; private set; }
public int WallHits { get; private set; }
@@ -73,10 +75,12 @@ public sealed class LabSimulation
* Matrix4x4.CreateTranslation(Position - new Vector3(0, modelMinimumY, 0));
public LabSimulation(SceneCollision collision, Mesh standingPose, Vector3 start, float yaw,
Func<Vector3, Vector3, SupportHit?>? cameraRay = null)
Func<Vector3, Vector3, SupportHit?>? cameraRay = null,
Func<Vector3, Vector3, SupportHit?>? ceilingRay = null)
{
this.collision = collision;
this.cameraRay = cameraRay;
this.ceilingRay = ceilingRay;
sourceStart = start;
startYaw = yaw;
var bounds = standingPose.Bounds();
@@ -106,7 +110,7 @@ public sealed class LabSimulation
Grounded = true;
Noclip = HasNoclipEntry = false;
Steps = Jumps = Landings = WallHits = 0;
PhysicsSteps = ControllerSteps = EffectSteps = 0;
PhysicsSteps = ControllerSteps = EffectSteps = CeilingHits = 0;
Travel = MaximumRise = 0;
CameraEye = DesiredEye().Eye;
}
@@ -155,10 +159,12 @@ public sealed class LabSimulation
// This reconstructs the player/input/fire partial order, not the full
// scene registry, original cadence or original collision response.
StepPhysics();
if (controlled && !InputAfterPlayerUpdate) StepInput(input);
//42469F..4246DC reasserts ordinary grounded radius before ownership
//checks. The scooter's separate radius160 policy remains unimplemented.
if (Grounded) InteractionRadius = 60;
if (controlled && !InputAfterPlayerUpdate) StepInput(input);
//424BE0..424C34 runs this wrapper before437940's ownership gate.
StepCeiling();
if (controlled) StepPlayer(input);
var effect = JetpackBurst.StepEffect(jumpState, Grounded, FixedStepClock.Step, Energy, LevelCode);
jumpState = effect.State; Energy = effect.Energy; JetpackEffectVisible = effect.Visible;
@@ -174,6 +180,19 @@ public sealed class LabSimulation
Speed = 0; Velocity = Vector3.Zero;
}
private void StepCeiling()
{
if (Velocity.Y <= 0 || ceilingRay == null
|| ceilingRay(ActorRoot, ActorRoot + Vector3.UnitY * 150) == null) return;
Velocity = Velocity with { Y = (float)Math.Min(-Velocity.Y * .6, -85) };
CeilingHits++;
//425120 leaves hold, mode, pending impulse and acceleration intact.
//Full sound/selected-gadget cleanup callbacks remain a separate gap.
if (movementMode != 1) return;
jumpState = jumpState with { JumpState = 0, EffectRemaining = 0 };
forceFall = true;
}
/// <summary>Authored AI root/Euler writes. They do not reset body motion or
/// destination yaw61C; the full logical/render Euler model remains separate.</summary>
public void ApplyAuthoredTransform(Vector3 root, float yaw)
@@ -326,7 +345,7 @@ public sealed class LabSimulation
}
}
Grounded = result.Grounded && velocity.Y <= 0;
if (Grounded && velocity.Y < 0 || result.HitCeiling && velocity.Y > 0) velocity.Y = 0;
if (Grounded && velocity.Y < 0 || result.HitCeiling && velocity.Y > 0 && ceilingRay == null) velocity.Y = 0;
if (Grounded) { extraAirAcceleration = 0; forceFall = false; }
Velocity = velocity;
if (!wasGrounded && Grounded) Landings++;
@@ -363,5 +382,5 @@ public sealed class LabSimulation
step is >= 80 and < 120, step is >= 60 and < 95, false, step < 180);
public bool SmokePassed => Steps >= 240 && Travel > 50 && MaximumRise > 20 && Jumps > 0 && Landings > 0 && Grounded;
public string Report => $"Walk checkpoint: steps={Steps}, controller={ControllerSteps}, physics={PhysicsSteps}, effect={EffectSteps}, travel={Travel:F2}, jumps={Jumps}, landings={Landings}, max rise={MaximumRise:F2}, wall hits={WallHits}, grounded={Grounded}, feet={Position}.";
public string Report => $"Walk checkpoint: steps={Steps}, controller={ControllerSteps}, physics={PhysicsSteps}, effect={EffectSteps}, travel={Travel:F2}, jumps={Jumps}, landings={Landings}, max rise={MaximumRise:F2}, wall hits={WallHits}, ceiling hits={CeilingHits}, grounded={Grounded}, feet={Position}.";
}