Add Gravity Depending On Speed?

Hi, I am new to Unity3d and would like some help creating a project.
I am trying to add a downwards force depending on speed, for my plane.
Code:

   rigidbody.AddRelativeForce (Vector3.down * 500); 
//gravity code here

So far this moves the plane forwards but I would like for it to fall slightly. Speed will change in future so can someone please help me write something that is relevant to the current speed of the plane. (ticking gravity does not work, and isn’t what I am looking for)

Thanks!!

rigidbody.velocity will give you the current velocity vector, which represents both speed and direction.

You can check the vector’s x, y, or z components to examine movement on a particular axis.

For example, you could check if we’re falling:

if (rigidbody.velocity.y < 0) {
    Debug.Log("Falling");
}

Total speed is equal to the vector’s magnitude:

var speed = rigidbody.velocity.magnitude;

If you are doing gravity yourself make sure its ticked off.

Also if you want gravity to always be down, dont use relative force otherwise when the plane tilts fowards gravity will be down and back, which may look weird :stuck_out_tongue:

And rigidbody.velocity will get a Vector3 of the current speed of the rigidbody, gettings its magnitude will get you a single float for its speed.