Line trace out of a volume??

How would I do a line trace out of a Physics Volume and depict the height of the char to the height of the volume? I have a physics volume that acts as water and want the player to lose health if they stay under the water for long periods of time. At the moment I am just having a delay of 3 seconds and the player starts to lose health if they are swimming, but the problem with that is if they jump in the water stay 2 seconds then jump out, they still get damaged because the delay is still processing.

You could add a actor component to the head and use that to determine if the player is under water.

HTH

There is an Event called “PhysicsVolumeChanged” in your CapsuleComponent. Create it and check if the new PhysicsVolume “isWater”. if it is, set a Boolean in your Character that determines whether he is underwater or not.
(unset the Boolean if the Phyics Volume is not water).

In Tick, check whether the waterboolean is true. If it is, decrease a Timer that determines your time underwater. If the timer is <= 0, decrease your health.
Don’t forget to refill your timer when you are not underwater.

So I need to drag off the “New Volume” pin on the Physics Volume Changed node and create a variable called isWater? This sounds so simple inside my head, it’s just finding the right nodes to connect.

@Raildex_ Appreciate it, I just setup it up like this

and from event tick I just check IsUnderwater and if it’s true I call on the swimming event to instantly start damaging the player.

You should do what you do with the Health Variable with a separate timer variable.
and check in Event Tick whether the timer is <= 0. if it is, decrease health.

I was trying to Set TImer by Function Name and used the function of Drowning and set my - health in that function, but while I’m swimming around my health doesn’t go down, it only goes down 1 time when I first jump into the water. got the time set to 0.75 and looping on the timer. Any reason that is?

Because I have

Physics Volume Changed > Water Volume > Set Is Under Water

Event Tick > Branch Is Under Water > Set Swimming

Swimming Event > Set Timer by function

Just trying out different things in unreal but can’t seem to get that timer to work right.

Setting a Timer in Event Tick doesn’t make sense.

My line trace doesn’t detect water or physics volume even though I’ve set the material. it only detects on rivers, any advice?