Expand debug system pages and add noclip exploration
This commit is contained in:
1 parent
b915a2c2e4
commit
d7838980fd
20 files changed
+628
-47
No files matched your search
@@ -10,6 +10,7 @@ var tests = new (string Name, Action Check)[]
|
||||
("clock remainder, stall bound, reset and invalid intervals", ClockBoundaries),
|
||||
("physics consumes prior motion; fresh versus retained input order", FrameOrdering),
|
||||
("source camera query origin, hit adjustment, gain and one query per input", CameraQueryConsumer),
|
||||
("debug noclip bypasses walls/gravity/camera and exits without queued motion", Noclip),
|
||||
("turn-only speed, forward acceleration/cap and release", SpeedLimits),
|
||||
("backpedal cap and release", Backpedal),
|
||||
("yaw sign, forward half-turn and left precedence", Turning),
|
||||
@@ -124,6 +125,55 @@ static void CameraQueryConsumer()
|
||||
Check(queries == beforeQueries + 1, "no additional camera obstruction query after interpolation");
|
||||
}
|
||||
|
||||
static void Noclip()
|
||||
{
|
||||
var points = new[] {
|
||||
new Vector3(-1000, 0, -1000), new(-1000, 0, 1000), new(1000, 0, 1000),
|
||||
new Vector3(-1000, 0, -1000), new(1000, 0, 1000), new(1000, 0, -1000),
|
||||
new Vector3(-1000, -1000, 50), new(1000, -1000, 50), new(1000, 1000, 50),
|
||||
new Vector3(-1000, -1000, 50), new(1000, 1000, 50), new(-1000, 1000, 50) };
|
||||
var mesh = new Mesh(points.Select(p => new MeshVertex(p, Vector2.Zero, Vector3.One)).ToArray(),
|
||||
Enumerable.Range(0, points.Length).Select(i => (uint)i).ToArray());
|
||||
var standing = new Mesh([new(new(-20, -20, -20), Vector2.Zero, Vector3.One), new(new(20, 80, 20), Vector2.Zero, Vector3.One)], []);
|
||||
var collision = new SceneCollision(mesh);
|
||||
var rayQueries = 0; var dynamicQueries = 0;
|
||||
var simulation = new LabSimulation(collision, standing, new(0, 25, 0), 0,
|
||||
(_, _) => { rayQueries++; return null; });
|
||||
simulation.DynamicRootResolver = (a, b, r) => { dynamicQueries++; return b; };
|
||||
var entry = simulation.Position;
|
||||
simulation.Step(new(false, false, false, false, true));
|
||||
Check(simulation.PendingImpulse.Y > 0, "Fixture has queued motion before noclip");
|
||||
simulation.SetNoclip(true);
|
||||
var rays = rayQueries; var bodies = dynamicQueries;
|
||||
for (var i = 0; i < 10; i++) simulation.Step(new(true, false, false, false, true));
|
||||
Check(simulation.Position.Z > 90 && !simulation.Grounded && simulation.Jumps == 1,
|
||||
"Noclip crosses a solid wall without another gameplay jump");
|
||||
Near(simulation.PendingImpulse.Length(), 0, 0, "Noclip discards queued impulse");
|
||||
Check(rayQueries == rays && dynamicQueries == bodies && simulation.Energy == 20,
|
||||
"Noclip bypasses camera/body queries and jetpack drain");
|
||||
var height = simulation.Position.Y;
|
||||
for (var i = 0; i < 10; i++) simulation.Step(new(false, false, false, false, false, Rise: true));
|
||||
Check(simulation.Position.Y > height + 90, "Noclip ascends independently of jumping/gravity");
|
||||
simulation.Step(new(false, false, false, false, false, Descend: true, Fast: true));
|
||||
Near(simulation.Velocity.Y, -1800, .001f, "Fast descend uses bounded fly speed multiplier");
|
||||
var saved = simulation.Position;
|
||||
simulation.Step(default); NearVector(simulation.Position, saved, .0001f, "Released noclip has no momentum or gravity");
|
||||
Check(!simulation.SetNoclip(false), "Clear exit retains exploration position");
|
||||
NearVector(simulation.Position, saved, .0001f, "Disabling in clear space retains position");
|
||||
Check(simulation.Velocity == Vector3.Zero && simulation.PendingImpulse == Vector3.Zero && simulation.JumpState == 0,
|
||||
"Disabling clears fly velocity and queued gameplay work");
|
||||
simulation.Step(default); Check(simulation.Position.Y < saved.Y, "Normal gravity resumes after disabling");
|
||||
simulation.ReturnToNoclipEntry(); NearVector(simulation.Position, entry, .001f, "Explicit return restores entry");
|
||||
|
||||
simulation.Reset(); simulation.SetNoclip(true);
|
||||
for (var i = 0; i < 5; i++) simulation.Step(new(true, false, false, false, false));
|
||||
Check(!collision.CanOccupy(simulation.Position, LabSimulation.BodyRadius, simulation.BodyHeight), "Exit fixture intersects wall");
|
||||
Check(simulation.SetNoclip(false), "Embedded exit restores known entry instead of leaving the capsule trapped");
|
||||
NearVector(simulation.Position, entry, .001f, "Embedded exit restores cached position");
|
||||
simulation.SetNoclip(true); simulation.Reset();
|
||||
Check(!simulation.Noclip && !simulation.HasNoclipEntry, "Reset clears modern noclip state");
|
||||
}
|
||||
|
||||
static void SpeedLimits()
|
||||
{
|
||||
var turn = FlatSimulation();
|
||||
|
||||
Reference in new issue
Block a user