feat(movement): spacebar charged jump with skill-based height
Hold spacebar to charge (0→1 over 1s), release to jump. Height from GetJumpHeight formula using Jump skill via PlayerWeenie. Jump physics use MotionInterpreter.jump() → LeaveGround() → get_leave_ground_velocity(). JumpExtent is returned in MovementResult (non-null when jump fires this frame) so GameWindow can log and eventually send the server jump packet. Double-jump is prevented by jump_is_allowed() checking Contact+OnWalkable flags before allowing another jump. Tests updated to use charge-then-release pattern matching the new input model. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
5cb14da714
commit
0bec5d5296
3 changed files with 46 additions and 10 deletions
|
|
@ -108,8 +108,11 @@ public class PlayerMovementControllerTests
|
|||
var controller = new PlayerMovementController(engine);
|
||||
controller.SetPosition(new Vector3(96f, 96f, 50f), 0x0001);
|
||||
|
||||
var input = new MovementInput(Jump: true);
|
||||
controller.Update(0.016f, input);
|
||||
// Charged jump: hold for a full charge (1s dt), then release to fire.
|
||||
// A full charge gives enough Vz that the player clears the 0.05-unit
|
||||
// ground-snap threshold within the same integration frame.
|
||||
controller.Update(1.0f, new MovementInput(Jump: true)); // full charge
|
||||
controller.Update(0.016f, new MovementInput(Jump: false)); // release → jump fires
|
||||
|
||||
Assert.True(controller.IsAirborne);
|
||||
Assert.True(controller.VerticalVelocity > 0f);
|
||||
|
|
@ -122,8 +125,9 @@ public class PlayerMovementControllerTests
|
|||
var controller = new PlayerMovementController(engine);
|
||||
controller.SetPosition(new Vector3(96f, 96f, 50f), 0x0001);
|
||||
|
||||
// Jump
|
||||
controller.Update(0.016f, new MovementInput(Jump: true));
|
||||
// Charged jump: hold for a full charge, then release.
|
||||
controller.Update(1.0f, new MovementInput(Jump: true)); // full charge
|
||||
controller.Update(0.016f, new MovementInput(Jump: false)); // release → jump fires
|
||||
float z1 = controller.Position.Z;
|
||||
|
||||
// A few frames of rising
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue