Download

Actor Airtime Detection?

Long story short: I have a fall damage system in place and it works fine.
But it works off the fact that if the player is in the air at any given time, then they will take fall damage.
I was wondering if it was possible to detect HOW long the player has been in the air, but so it doesn’t detect jumping or launching.
Also I apologise if this ends up in the wrong thread.

Hey there,

the CharacterMovementComponent has a node called “IsFalling” or something like that.

Create a float variable for “TimeInAir”. Add the “EventTick” to your Graph (if you don’t have that yet).
Use the “IsFalling” node (boolean) and if this is true (Branch), let the EventTick add the DeltaSeconds to the variable.

DeltaSeconds are basically the difference between two ticks. So if it lags, it still adds the correct value to it.
It results in 1 second per second (if that makes sense).

Then, there is an event called “OnLanded”. If that happens you simply check the Number, apply the Damage you want
and then set the number back to 0.0.

That should do what you want.

For the damage you could use a “Range Clamp” for floats, or your own logic.

Using Time to determine the damage is not a reliable approach. Think about trampolines:
Unbenannt.jpg

The best approach is to use the velocity to determine the fall damage because that’s how you get hurt in reality.

Another common approach is to track the max velocity achieved when falling, and when you land apply damage based on that

All true, he asked for Air Time though :stuck_out_tongue: So I basically answered his question.
Velocity would be a better solution, I agree (: