Creating lift under the wings of an aircraft?

Okay, so from my previous question I have now succeeded in adding a force to push the aircraft forward (the engine).

However, I now need to simulate the lift created underneath the wings of the aircraft, to increase the altitude of the aircraft! I’ve done my research blah blah and I’ve established that when my aircraft reaches a speed of 100 m/s, it will begin to lift off the ground but no matter what I do, I can’t get it to work!

I’m using:

public int TakeOffSpeed = 100; //Speed at which the aircraft lifts

	void Start ()
	{
		
	}
	
	void FixedUpdate () 
	{
		if(Input.GetButton ("Throttle")) //Throttle is increased using 'W' key.
			rigidbody.AddRelativeForce(0,0,-50);
	
		
		if(rigidbody.velocity.magnitude.Equals(TakeOffSpeed))
			rigidbody.AddRelativeForce (0,200,0); //Force pushing upwards

I’m not sure why it’s not working. I’ve tried different values but still nothing.

Thanks

The chance that the magnitude of the velocity will exactly equal 100 if very small. How you want to handle the issue will depend on your game mechanic. As a starting point, rewrite to:

   if(rigidbody.velocity.magnitude >= TakeOffSpeed)

You will have to reduce the amount of force being applied since this logic will add some force every frame the magnitude is above TakeOffSpeed.

If your airplane is accelerating, then this line will only be called a single time, in passing:

if(rigidbody.velocity.magnitude.Equals(TakeOffSpeed))
rigidbody.AddRelativeForce (0,200,0); //Force pushing upwards

What you are looking for is lift that applies any time the airplane is ABOVE the takeoffspeed.