Hello everyone, i am attempting to make a VTOL(vertical take off and landing) aircraft, kind of like the CoD MW2 Osprey, and i want the thrust force to be able to apply on the angle of the engine (not only 0 and 90 but any angle in between). here is the way i am trying to do it:
public class Flight_Script : MonoBehaviour {
public float acceleration;
public float thrust;
public float thrustDir;
public Vector3 vectorThrust;
void Update () {
//thrust
vectorThrust = new Vector3 (thrust * Mathf.Cos(thrustDir), thrust * Mathf.Sin(thrustDir), 0);
thrustDir -= Input.GetAxis ("Mouse ScrollWheel") * 10;
thrustDir = Mathf.Clamp (thrustDir, 0, 90);
thrust += Input.GetAxis ("Vertical") * acceleration;
}
btw i deleted a lot from this script that has nothing to do with the thryst, if i have a missing bracket i probably deleted it by mistake. anyway, the problem i have is that when the engine rot is 90 degrees the x is something like a 45% of the thrust, and the y force is something like an 89% of the thrust. i have recently seen 2D vectors in physics and if i recall corectly that is how its done. thank you all