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:
FoxyzandClaude Opus 5.5 committed 2026-10-02 20:15:32 +03:00
1 parent 537e72c207
commit 0bddcf4517
3 files changed
+52 -49

No files matched your search

+3 -7
View File
@@ -5,7 +5,7 @@ using Godot;
// physics tick, in this order:
// 1. discrete origin jumps made by other code (spawn, teleport markers) carry the body along;
// 2. stick: left = move (head-relative), right X = turn (snap by default, SmoothTurn for smooth),
// right Y = crouch (down lowers, up raises — RagdollDriver.StickCrouch); right A = jump;
// right Y = crouch (down lowers, up raises — RagdollDriver.StickCrouch); right A = hold to charge, release to jump;
// 3. the ragdoll's OriginCorrection (push-back at walls, floor follows the ground, falls);
// 4. True Body solve from the corrected camera/controllers, then the ragdoll's muscles.
// Waits for the calibrated BodyProfile like everything else; rebuilds on recalibration.
@@ -36,7 +36,6 @@ public partial class PlayerRig : Node
private bool _haveLastOrigin;
private Vector3 _moveVelocity;
private bool _snapArmed = true;
private bool _jumpPrev;
private readonly MeshInstance3D[] _ghosts = new MeshInstance3D[2];
private bool _rebuild = true;
private RagdollDriver _driver;
@@ -231,11 +230,8 @@ public partial class PlayerRig : Node
if (_moveVelocity != Vector3.Zero)
_origin.GlobalPosition += _moveVelocity * dt;
// Jump: right A, on the press.
bool jump = _right.IsButtonPressed("ax_button");
if (jump && !_jumpPrev)
_ragdoll.Jump();
_jumpPrev = jump;
// Jump: hold right A to charge (the legs bend), release to jump.
_ragdoll.JumpHeld = _right.IsButtonPressed("ax_button");
// Crouch: right stick held down lowers the body, up raises it back (the stick's dominant
// axis decides between crouch and turn).