Walk to swim transition question

Hi guys,

I have a beach in my scenery where the character can enter to swim in the ocean. The water is very shallow for the first couple of meters where I want my character to walk calling the walk animations from the Anim_BP. At a defined water depth I want my character to switch to swim animations in the Anim_BP. I got the walk to swim animations working, that is not the problem. I need to find a way that my character can determine the depth of water he is standing in to decide when to transition into “IsSwimming” How can I do this?

Currently my character starts swimming as soon as “Is Swimming” is triggered when actor is overlapping with the physics volume, so basically directly when touching the water. It looks strange when doing a breast stroke in 10cm of water depth.

any suggestions much appreciated!

After checking “Is Swimming”, add a branch to check the relative Z position of your character and the physics volume.

You can do this by getting the bounds of the volume and adding the Z bound component to the volume’s origin Z to get the Z position of the water’s surface (top face). Then check your character’s Z location and compare it to the water surface Z position and make your assessment from there.

e.g. Branch true if (WaterSurfaceZ - PlayerZ) > 50, false otherwise.

This will ensure the character’s center point is at least 50 units submerged before triggering swimming logic.

Hope that helps!