Swimming forward when trying to swim backward

embe

New member
Continuing the conversation from Discord, as this appears to be a bug: the player swims forward when pressing the back key in first person view above surface (version 2.0.3 of the swimming pack). This problem does not occur under water.

And a quick question while I'm at it: is there a way to make the player go under water when jumping into the water, instead of automatically floating on the surface? For example, is there a variable that makes the player end up under water if its velocity or fall height is a certain value? (I saw something similar for the dive ability, but I'm looking to implement that for a normal jump).
 
Thanks for posting that here. The reason why the character is moving forward with a surface swim in first person view is because of root motion. We don't have a backwards swim animation so when the animation plays it is playing the forward swim motion. In third person the character rotates to move towards the camera so they are still moving forward. For this particular setup the correct approach is to add a backwards swim animation which we will do for the next update.

If you don't have a backwards swim animation you can disable root motion on the Ultimate Character Locomotion component as well as disable the Use Root Motion override that is set on the ability (under the general foldout).

In terms of going under water, you can reduce the buoyancy of the swim ability, and then also reduce the Retrained Gravity Amount. This will allow your character to sink deeper into the water.
 
Thanks! Swimming backwards works when disabling root motion, but unfortunately that disables the ability to go underwater. With root motion enabled I'm able to just look down and press swim forward to dive under water, but when I disable it I can't do that even if I press the Action button which is assigned to "Start Underwater Swim" or change the "Start Underwater Swim Pitch".

Also, changing buoyancy and gravity doesn't make the player go under water for me when jumping into it (with or without root motion). Is there another way?
 
The character goes underwater because of the y change with root motion. Right now it will take modification within Swim.UpdatePosition and needing to modify the DesiredMovement value so the character can go underwater without root motion.

Also, changing buoyancy and gravity doesn't make the player go under water for me when jumping into it (with or without root motion). Is there another way?
In the demo scene I dropped the character about 1 unit above the water and they stayed underwater when I set the surface and underwater buoyancy to 0, and then also set the Min Underwater Swim Depth to 0.
 
Back
Top