How to make a car not able to move in midair

The title says it!
Well i tried putting a boolean and a ontrigger function and so on but
it still doesn’t work!
Heres the code i made

public var forwardSpeed : float = 3;
public var turnSpeed : float = 2;


function Update() {
	
	var forwardMoveAmount = Input.GetAxis("Vertical")*forwardSpeed;
	var turnAmount = Input.GetAxis("Horizontal")*turnSpeed;
	
	
	transform.Rotate(0,turnAmount,0);
	
	
	rigidbody.AddRelativeForce(-forwardMoveAmount,0,0);
	
}

if distance from ground to wheels is not mathf.approximately 0 then do not rotate.

You should be using a rigidbody which done properly would deal with that for you but if you want a simple car mechanics system just basically do a if airborne dont turn