Simple plane controller, question about axis inversion

Hello

Im doing a plane controller in CSharp, it rotate the plane up and down, right and left

The strange thing is when i write

transform.Rotate( Input.GetAxis(“Vertical”), 0.0f, Input.GetAxis(“Horizontal”)

the control is totaly messed up !

It rotate the plane up and down when i press the left and right button

And so it rotate left and right de plane when i press up and down

So i had to change the code to this

public class Controller : MonoBehaviour {

    // Use this for initialization
    void Start () {
        Debug.Log("controller script added to :" + gameObject.name);
       
    }

    // Update is called once per frame
    void Update() {
        transform.Rotate( Input.GetAxis("Horizontal"), 0.0f, Input.GetAxis("Vertical") );
    }
}

This code came from this guy,

actually a very good tutoriel, and yeah im totaly noob in C and other coding stuff so i had to find this trick myself and im asking myself why i had to do that

And what is this 0.0f in the middle of the code ?

transform.Rotate( Input.GetAxis(“Vertical”), 0.0f, Input.GetAxis(“Horizontal”)

I think Vertical and Horizontal are like some kind off a call to the controller, something coded in the unity engine…

Dunno its very strange

Have a nice dev day

The guy add some problem to, he had a different solution

After you finish with that tutorial, try browsing around (and using) some material in here: Learn

:slight_smile: Welcome to Unity.

And yes, the vertical and horizontal axes are created in the axis manager; You can change or add to them. Those are just some of the defaults.
The ‘0’ in the middle of the code, is of course the y-axis. :slight_smile:

Thanks mate

Im so happy is so easy to make my plane move around with just 2 lines of Code !

// Update is called once per frame
    void Update() {

        transform.position += transform.forward * Time.deltaTime * 90.0f ;

        transform.Rotate( Input.GetAxis("Vertical"), 0.0f, -Input.GetAxis("Horizontal") );
    }