Querying whether or not a player is in a physics/water volume

Hello everyone!

I’m having a hard time theorizing how to solve a problem that I’m having. Specifically, I want to query if a player is in a physics volume/water volume and change the movement mode to swimming. While I know it does that automatically, it doesn’t if you change the mode while in the physics volume. I have a climbing system that lets you hang off ledges and pull yourself up, when you drop down from a ledge it sets you to falling. But when a player is in the water volume, it’ll still set to falling regardless up until you hit the floor and then it’ll change back to swimming. This is unintended.

So my end goal is how do I check to see if my character is in a physics/water volume or not, so that I can change the movement mode appropriately?

1 Like

If you’re in C++ land, you can use UMovementComponent::IsInWater(), otherwise if in Blueprint grab UMovementComponent::GetPhysicsVolume() and then check if it’s water.

1 Like

Thanks, I’ll try this out.

Thank you, that did the trick, I was able to get ‘water volume’ from ‘get physics volume’ and check that, which allowed me to switch the movement modes appropriately.