I’ve been having the same problem for ages! I am using rigidbody.AddRelativeForce to create a pushing force for my aircraft, however it is not using local coordinates! I’m using (-Vector3.forward * 150) and if I turn my aircraft it continues to push in the original direction. Eg. if I turn 180 and face the way I came, the fore now pushes be backwards! It’s really annoying me, as I have tried everything I can!
Here are the bits of the script that are relevant:
The force pushing my plane -
if(Input.GetButton ("Throttle")){ //Throttle is increased
rigidbody.AddRelativeForce(-Vector3.forward * 150);//Force pushes forwards
rigidbody.drag = 0; //Cancels Drag
}
The torque that turns my plane -
//Roll right
if(Input.GetButton ("Roll Right"))
rigidbody.AddRelativeTorque(0,0,90);
//Roll left
if(Input.GetButton ("Roll Left"))
rigidbody.AddRelativeTorque(0,0,-90);
//Pitch Up
if(Input.GetButton ("Pitch Up"))
rigidbody.AddRelativeTorque (65,0,0);
//Pitch Down
if(Input.GetButton ("Pitch Down"))
rigidbody.AddRelativeTorque (-65,0,0);
Help would be really appreciated!
Thanks