How to jump multiple times to mid air?

Okay, so I’m writing this swimming script, but I’m have some problems on the final core pieces of it. Right now, I have the game successfully identifying whether or not your under water. When you are, it it changes basic movement controls such as speed, gravity, fall speed, etc. That way, it makes it look like your swimming through water, even though it just modifies you movements and gravity. Now, I need to make it so you can swim up and get to the surface. Right now, all you do is sink to the bottom. When you jump, you move up slowly, but eventually sink back to the bottom. I want the player to be able to press the space bar in mid air, and the character would jump again, even if they are not grounded. It’s similar to the swimming controls in Minecraft.

I’d like to simply be able to modify the existing CharacterController.js script if that’s possible. Any idea’s or alternate ways?

I don’t know how your code looks but you can add a boolean value such as “isUnderwater” to the scripts and set it to where the player can jump:

if(isGrounded || isUnderwater)
{

}

That is the approach I would probably take. Hope I helped out a little.

You can access a “IsGrounded” bool in the charactercontroller from another script, if you forcefully set that to false you’re able to jump indefinately.

Link to my answer on another question:

Double Jump?