How to make a plane fly in a given direction?

Hi there guys!

I have started working on a flight game.There is one problem I have encountered and that is how to make the plane move in the direction i’m turning it in.
What I did is add a force to the rigid body so it moves forward:

if(Input.GetKey("k")){ rigidbody.AddRelativeForce(Vector3.forward * max_Rotor_Force *rotor_Velocity);}.

However this pushes the game object forward no mater which way it is facing when the plane turns.That means that after take off the plane is moving forward and if i try to turn left the plane doesn’t change it’s original trajectory and simply turn around in a circle.

What I’m wondering about is,What changes I need to add to the script so that the plane actually turns left or right and moves in that dorcetion instead of simply just moving forward along the z-axis?

Thank You!!

I’m guessing when you made “turning” you coded it so that the actual 3D model turns, but the force at which the plane is going continues to go straight.

this is because addRelativeForce moves the object in the global axis and not the object’s local axis.

What you would have to do is instead of rotating your 3D model you need to apply some addition force to your object. Such as Vector.left or Vector.right

if(Input.GetKey("l")){ 
    rigidbody.AddRelativeForce(Vector3.right*max_Rotor_Force*rotor_Velocity);
}
else if(Input.GetKey("j")){ 
    rigidbody.AddRelativeForce(Vector3.left*max_Rotor_Force*rotor_Velocity);
}

As long as you continue to hold down k so you go forward, applying a left or right force shouldn’t give you strange physics, assuming what you’re trying to accomplish. I would suggest using two different variables rather than using “max_Rotor_Force *rotor_Velocity” on the turning. Probably something with a lower value. I just copied what you already had declared.