Set up a 3D fly through (cont'd)

Hi, I have just asked a question about 3D fly through. Thank you very much for answering. I got the following scripts from the answer:

function FixedUpdate() {
// Calculate the move direction
moveDirection = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
moveDirection = transform.TransformDirection(moveDirection);
moveDirection *= speed;
// Move the controller
var controller : CharacterController = GetComponent(CharacterController);    controller.Move(moveDirection * Time.deltaTime);}

The scripts work well. However, I can only go left, right, forward and backward as I press the arrow keys. Can I also go up and down (i.e., in the y direction). How to do it? Many thanks.

The added keys work well. Thanks again!

You should edit your old question instead of posting a new one.

The middle "0" on the vector moves in the y-axis. Add a key for it:


    moveDirection += Vector3.up * moveSpeed;


    moveDirection += Vector3.up * -moveSpeed;


something like that