x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How to disable jumping while swimming?

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)

Product Version: UE 4.16
Tags:
more ▼

asked Jul 14 '17 at 07:41 AM in Blueprint Scripting

avatar image

Killerzwerg
1 1 3 4

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

3 answers: sort voted first

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.

more ▼

answered Jul 14 '17 at 05:40 PM

avatar image

Fristomer
1 3 5 5

avatar image Fristomer Jul 14 '17 at 05:41 PM

You could also name the boolean "CanJump" or something and use True to continue the branch execution...

avatar image Killerzwerg Jul 15 '17 at 03:07 AM

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...

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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.

more ▼

answered Aug 02 '17 at 12:13 AM

avatar image

Phantas
1

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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 ;) )

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

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 :)

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 :)

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.

more ▼

answered Jul 14 '17 at 08:28 AM

avatar image

AmphDev
1.5k 15 9 33

avatar image Killerzwerg Jul 15 '17 at 03:16 AM

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^^

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question