Detect if a vehicle is mid-air

In the Advance Vehicle C++ project, the vehicle pawn’s IsFlying() function looks like this:

inline bool UNavMovementComponent::IsFlying() const
	return false;

Obviously this is useless. I’m wondering if Unreal Engine provides utility function to detect that my vehicle is not longer touching the ground.

There’s the IsFalling() function that usually takes place when a walking character is in mid-air. Does that also exist with vehicle pawns?

They both return false in NavMovementComponent.h. AFAIK the only difference between IsFalling() and IsFlying() is that IsFalling() is supposed to return true only when moving downwards in air while IsFlying() will return true when moving up or down in mid-air.

IsFalling etc. will not work for vehicles.

Instead you need to do a line trace to see if there is anything within a metre of the bottom of the vehicle. See the following. SQ_Go is the road sound producer which is on the bottom of the vehicle. It goes silent when the vehicle is in the air. The line trace does the check for this. It triggers TRUE if a line drawn 1m directly down from the vehicle hits anything. Hence by doing a NOT of the result you know if you are in the air.

Hope this solves your problem

For anyone using the vehicle movement component…

You can drag from the vehicle movement component and use the GetWheels function to return an array of wheels that you can then plug into the IsInAir Function as shown below.


I’ve found this topic looking for solution in 2022’ . Your solution is the easiest and the fastest for vehicle. Thanks so much!!!