Jump underwater bug fix
Previously, to jump underwater was possible as KinematicCharacterMover perceived it as a double jump.
I've added a condition when jump in mid-air is checked to check if the current mode is groundable too. This way diving and swimming requests are ignored.
@@ -689,8 +689,8 @@ private void walk(final CharacterMovementComponent movementComp, final Character
endVelocity.y = -0.0f * endVelocity.y;
}
- // Jump again in mid-air only if a jump was requested and there are jumps remaining.
- if (input.isJumpRequested() && movementComp.numberOfJumpsLeft > 0) {
+ // Jump again in mid-air only if a jump was requested and there are jumps remaining and current movement mode can be grounded.
+ if (input.isJumpRequested() && movementComp.numberOfJumpsLeft > 0 && movementComp.mode.canBeGrounded) {
state.setGrounded(false);
// Send event to allow for other systems to modify the jump force.
