Skip to content

Fix the jump state bug#138

Merged
viddie merged 1 commit into
viddie:mainfrom
Kongtiao552:physics-log-fix
Jun 6, 2026
Merged

Fix the jump state bug#138
viddie merged 1 commit into
viddie:mainfrom
Kongtiao552:physics-log-fix

Conversation

@Kongtiao552

Copy link
Copy Markdown
Contributor

On the current version if you keep holding the first jump, and then press the second jump, and then release the second jump, the physics inspector would still think you're holding 2 jumps after you released the second jump.

I believe the issue is this method:

private void UpdateJumpState() {
//Log($"Pre frame: Jump.Check -> {Input.Jump.Check}, Jump.Pressed -> {Input.Jump.Pressed}, Held Jump Last Frame -> {PhysicsLogHeldJumpLastFrame}, Holding Second Jump -> {PhysicsLogHoldingSecondJump}");
if (Input.Jump.Check) {
if (PhysicsLogHeldJumpLastFrame && Input.Jump.Pressed) {
PhysicsLogHoldingSecondJump = !PhysicsLogHoldingSecondJump;
}
PhysicsLogHeldJumpLastFrame = true;
} else {
PhysicsLogHeldJumpLastFrame = false;
PhysicsLogHoldingSecondJump = false;
}
}

This is my understanding of the issue: I kept holding the first jump, so Input.Jump.Check was always true -> I pressed the second jump, so PhysicsLogHoldingSecondJump was set to true -> I released the second jump while keeping holding the first jump, but PhysicsLogHoldingSecondJump was still true.

This pull request makes it check how many jump keys are held manually, instead of using Input.Jump.Check and Input.Jump.Pressed. From what I've tested, it works pretty fine and fixes the issue.

@viddie viddie merged commit f6af53e into viddie:main Jun 6, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants