Jump: hold right A to charge (legs bend), release to jump
Tap hops ~0.16 m, full charge ~0.68 m, a real crouch charges too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
537e72c207
commit
0bddcf4517
3 files changed
+52
-49
No files matched your search
+17
-15
@@ -114,8 +114,9 @@ public partial class RagdollSpike : Node3D
|
||||
_phases.Add(("climbs a wall hand over hand (grab, pull, regrab higher)", SetupClimbWall, TickClimbWall, 8f, FinishClimbWall));
|
||||
_phases.Add(("walks off a 1 m ledge and lands: a dip the view follows, no bounce", () => SetupLedgeTop(1f), TickDrop, 4f, () => FinishDrop(1f)));
|
||||
_phases.Add(("big fall (5 m): legs fold fully, then it recovers", () => SetupLedgeTop(5f), TickDrop, 5f, () => FinishDrop(5f)));
|
||||
_phases.Add(("standing jump", Rest, t => TickJump(0f), 4f, () => FinishJump(crouched: false)));
|
||||
_phases.Add(("jump from a crouch goes higher", Rest, t => TickJump(0.45f), 4.5f, () => FinishJump(crouched: true)));
|
||||
_phases.Add(("jump: a tap of A hops", Rest, t => TickJump(0f, 0.05f), 4f, () => FinishJump(0)));
|
||||
_phases.Add(("jump: holding A to charge jumps much higher", Rest, t => TickJump(0f, 0.6f), 4.5f, () => FinishJump(1)));
|
||||
_phases.Add(("jump: a tap from a real crouch beats a standing tap", Rest, t => TickJump(0.45f, 0.05f), 4.5f, () => FinishJump(2)));
|
||||
_phases.Add(("looks down past vertical while crouched (body doesn't flip around)", Rest, TickLookDown, 5f, FinishLookDown));
|
||||
_phases.Add(("stick crouch lowers the body and the view, and stands back up", Rest, TickStickCrouch, 6f, FinishStickCrouch));
|
||||
_phases.Add(("standing on a seesaw tips it (body weight reaches movable ground)", SetupSeesaw, _ => { }, 3f, FinishSeesaw));
|
||||
@@ -783,11 +784,11 @@ public partial class RagdollSpike : Node3D
|
||||
|
||||
// ---------------------------------------------------------------- jump
|
||||
|
||||
private float _jumpStand, _jumpApex, _jumpEyeErr, _standJumpApex;
|
||||
private float _jumpStand, _jumpApex, _jumpEyeErr, _tapApex;
|
||||
private bool _jumpPressed;
|
||||
|
||||
// Optionally squat (eyes `crouch` lower) first, then press jump at 2 s; the player keeps the pose.
|
||||
private void TickJump(float crouch)
|
||||
// Optionally squat (eyes `crouch` lower) first, then hold A from 2 s for `hold` s; the player keeps the pose.
|
||||
private void TickJump(float crouch, float hold)
|
||||
{
|
||||
float k = Mathf.SmoothStep(0f, 1f, Mathf.Clamp((_t - 0.8f) / 0.8f, 0f, 1f)) * (crouch > 0f ? 1f : 0f);
|
||||
_headLocal = new Transform3D(new Basis(Vector3.Right, -0.2f * k), new Vector3(0f, EyeHeight - crouch * k, -0.05f * k));
|
||||
@@ -804,11 +805,9 @@ public partial class RagdollSpike : Node3D
|
||||
_jumpEyeErr = 0f;
|
||||
_jumpPressed = false;
|
||||
}
|
||||
if (_t >= 2f && !_jumpPressed)
|
||||
{
|
||||
_ragdoll.JumpHeld = _t >= 2f && _t < 2f + hold;
|
||||
if (_t >= 2f)
|
||||
_jumpPressed = true;
|
||||
_ragdoll.Jump();
|
||||
}
|
||||
if (_jumpPressed)
|
||||
{
|
||||
_jumpApex = Mathf.Max(_jumpApex, pelvis - _jumpStand);
|
||||
@@ -816,16 +815,19 @@ public partial class RagdollSpike : Node3D
|
||||
}
|
||||
}
|
||||
|
||||
private bool FinishJump(bool crouched)
|
||||
private bool FinishJump(int kind)
|
||||
{
|
||||
GD.Print($"RAGDOLL: {(crouched ? "crouched" : "standing")} jump: hips rose {_jumpApex:F3} m above the standing stance, eye vs camera max {_jumpEyeErr:F3}, grounded {_ragdoll.Grounded}, jumping {_ragdoll.Jumping}, snaps {NewSnaps}");
|
||||
string what = kind == 0 ? "standing tap" : kind == 1 ? "full charge" : "tap from a crouch";
|
||||
GD.Print($"RAGDOLL: {what}: hips rose {_jumpApex:F3} m above the standing stance, eye vs camera max {_jumpEyeErr:F3}, grounded {_ragdoll.Grounded}, jumping {_ragdoll.Jumping}, snaps {NewSnaps}");
|
||||
bool ok = _finite && NewSnaps == 0 && _ragdoll.Grounded && !_ragdoll.Jumping && _jumpEyeErr < 0.12f && _origin.Origin.Length() < 0.15f;
|
||||
if (!crouched)
|
||||
if (kind == 0)
|
||||
{
|
||||
_standJumpApex = _jumpApex;
|
||||
return ok && _jumpApex > 0.3f && _jumpApex < 0.65f;
|
||||
_tapApex = _jumpApex;
|
||||
return ok && _jumpApex > 0.03f && _jumpApex < 0.35f;
|
||||
}
|
||||
return ok && _jumpApex > _standJumpApex + 0.1f;
|
||||
if (kind == 1)
|
||||
return ok && _jumpApex > _tapApex + 0.25f && _jumpApex < 0.9f;
|
||||
return ok && _jumpApex > _tapApex + 0.1f;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------- looking down past vertical
|
||||
|
||||
Reference in new issue
Block a user