x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

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

Product Version: Not Selected
Tags:
more ▼

asked Apr 07 '15 at 06:28 AM in Blueprint Scripting

avatar image

Fl4MES
9 5 7 10

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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!

alt text

more ▼

answered Apr 07 '15 at 07:42 AM

avatar image

PeterLNewton
2.1k 75 36 110

avatar image Fl4MES Apr 08 '15 at 07:11 AM

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

avatar image Fl4MES Apr 08 '15 at 09:14 AM

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

avatar image RimmyD Apr 08 '15 at 03:46 PM

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.

avatar image Fl4MES Apr 10 '15 at 09:26 AM

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?

avatar image Fl4MES Aug 27 '16 at 02:14 PM

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

avatar image razmaz51 Jul 24 '18 at 12:53 PM

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

avatar image Cultusfit Feb 10 '19 at 09:16 PM

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?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question