Movin' camera in XYZ

Hi Everyone,
i completely new to unity scripting. I´m working on a camera flight through a landscape. Navigating in x and z space by pressing buttons works fine. i used this script:

 function Update () { 
      var x = Input.GetAxis("Horizontal") * Time.deltaTime * speed; 
      var z = Input.GetAxis("Vertical") * Time.deltaTime * speed; 
      transform.Translate(x, 0, z); 
 } 

but now i try to move in y direction as well as in z direction. WSAD control x&y. how can i assign other keys to move in y space? thank you for your help
dirk

You can use the Input Manager :

or use GetKey :

function Update () { 
    var x = Input.GetAxis("Horizontal") * Time.deltaTime * speed; 
    var z = Input.GetAxis("Vertical") * Time.deltaTime * speed; 
    var y : float;
    if (Input.GetKey(KeyCode.Q)) {
        y = -1.0 * Time.deltaTime * speed; 
    }
    else if (Input.GetKey(KeyCode.E)) {
        y = 1.0 * Time.deltaTime * speed; 
    }
    transform.Translate(x, y, z); 
}

thanks jay kay!

Create a new axis in the Input Manager called “Altitude” with a negative and positive button.

function Update () { 
    var x = Input.GetAxis("Horizontal") * Time.deltaTime * speed;
    var y = Input.GetAxis("Altitude") * Time.deltaTime * speed;
    var z = Input.GetAxis("Vertical") * Time.deltaTime * speed; 
    transform.Translate(x, y, z); 
} 

Input.GetButtonDown(“Fire1”);

assign Fire1 to whatever you like

Hi!

In your Scenario you are using axis, not keys at the moment.
You can add axis or keys via the Input Manager (Edit->Project Settings->Input)
You see, Horizontal and Vertical are there defined Already. You Could add an own one by increasing the Size by one and changing the name of the bottommost element to your chosen one.

[Input Manager Reference][1]

Alternately you could use Input.GetKey(KeyCode.[YourKey]) in your code to get your wanted behaviour.

br
[1]: Unity - Manual: Input Manager

Hey! Thank you. I used the solotion of save. it works. Even via iPhone (Control OSC → OSCulator → Unity)