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)
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.
answered Jul 14 '17 at 05:40 PM
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.
answered Aug 02 '17 at 12:13 AM
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.
answered Jul 14 '17 at 08:28 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here