How do I make an Underwater breathing blueprint

I want to make an Under water breathing blueprint, as when my character is under water this bar starts to decrease and when he is above water this bar first gets full and then disappears. Help me guys, Ive been trying to figure this out for a while now

On the Character Class

If you check the Movement Mode, you can get if they’re swimming. Then you can get the current PhysicsVolume from the Character Movement, and from there check if its a water volume which I already assume it is. This CheckIfUnderWater will get the current PhysicsVolume, check Actor bounds against the player’s Z and if it meets a certain condition to save the time they entered. Then use this timestamp to check how long they’ve been underwater. A cheaper check would be to send a line trace from the Actor location straight up, and make your Volume block Camera traces.

I hope this helps!

Thanks for the Help!
Ill try this and let you know how it works.

Hey, I tried your technique but I still cant figure out what to do next, btw Im just starting out. Will be glad if you can walk me through the steps.
Thanks a lot

You need to define for yourself when a player in under water. This is based on what sort of game you are playing. Often people use a volume and do a check to see if the camera/head is within it. This would be done in the CheckIfUnderWater function SilentX’s Timers reference in the image above.

You will need to be tracking the characters breath as a Variable which you increment/decrement based on his status above/below water. This could exist and be managed on your character.

After that you will need to learn about showing user interface through either UMG or the HUD to display the breath. I recommend you do a simple search or two and read up on this and create a new post specifically about it. Should be able to find plenty.

I made a stamina mechanism that way, so what you’re saying is I can implement a breathing mechanism the same way?
Ill try using different variable’s but how do I check if the player is underwater?
Can I call the Post Process Volume in the My_Character Blueprint?

Thanks Peter and Rimmy. I got it to work, you guys rock!!

what is that node in the blueprint that has “swimming” on it? how do I get it?

Found this and it is great. Helped some.
But what I can’t seem to do is set the water volume to actually return a trace.

I’m using a physics volume with water volume ticked. I presume in the collisions I will have to do something like set it to block camera?