How to disable jumping while swimming?

Use a simple boolean variable “IsSwimming” and add a branch to your jump button to check this variable. Set it to true when enter swimming mode, and false upon exitting swim mode. Ensure that the jumping branch is connected to “False”, or use a “not” node between “IsSwimming” and "Branch.

You could also name the boolean “CanJump” or something and use True to continue the branch execution…

As how to stop Jumping from water… Try to change “Jump Out of Water Pitch” value under Character Movement: Swimming in the Inherited CharacterMovement inside your Character BP.

Hey there,
I have added the Ability to swim up and down with my Character, but everytime the Character goes to the end of the Physics Volume he jumps out of the Water…

How can I disable this?

And if I´m already here, how to change the height of the Character, when he start swimming, without to set the Physics Volume lower? For now he start swimming when his Foot enters the Physics Volume… (PhysicsVolume begins at the Waters Surface)

Hey!

Im sure there is some settings like jump height when you out from water, but if you want disable this fully just before jump do a shapetrace or linetrace (shapetrace are better and you can use character capsule as shape size :wink: )

When your character try to jump, check with trace for watervolume if you found watervolume do not allow jump :slight_smile:

About trigger… i think engine does this automatically when charactert overlapping with watervolume…
When this happens engine change character movement mode from normal walk to swimming i guess :slight_smile:

Now the hard part, if you can override this overlap event you can implement custom logic to check character stay enough deep to switch character movement mode from walk to swimm?

Another possible method, which maybe a workaround for this.

Add new collision type with default overlap behavior.
Add a small sphere collision (and set to new collision type) to your character and attach to skeletal mesh.
Set sphere collision location where you want to switch swimming mode (pelvis, hip or something)
Now change charactet and watervolume collision type to custom (object type should be the new collision type too) and set watervolume to react for new collision type only :slight_smile:

If everything goes well watervolume will overlap only when small sphere is overlapping the volume.

Im not sue if this work because i not tested, but in theory it works.

This was the first thing I have tried, but is not working^^

The problem is, if I swim up and the character goes to top of the WaterVolume, it jumps too (without pressing the jump key).

I have tried to overwrite the “CanJump” Function if the PhysicsVolume is in Range but this only works if the Character is walking on Land, if he is in Swimming Mode, he can jump anyways…

Disabling the Jump out of Water is a weird Problem, look above on the other Answer (my comment), I have tried a lot of things, but nothing is working (yes, with trace too)…

I also tried a lot of things to change when entering the SwimmingMode and now I have found the problem, it was a huge mistake on my side, don´t enable “PhysicsOnContact” in the PhysicsVolume, with this enabled, the Character begins to swim “on contact” with the volume, if its disabled, the Character only begins swimming when the half height is in the PhysicsVolume^^