# 3 axis movement. . . . help please!

Hi! I’m totally clueless but trying to learn the scripting aspect of Unity. I am hoping for a simple setup to have a camera move forward, backward, right, left, up and down and rotate left and right (no gravity necessary). I’d appreciate any help with the script or appreciate being directed to a tutorial regarding the matter. Thanks in advance. -paul

It sounds to me like you need a fly through script

Rather than a script that does stuff for you…

``````forward == transform.Translate(Vector3.forward * speed * Time.deltaTime);
backward == transform.Translate(-Vector3.forward * speed * Time.deltaTime);
right == transform.Translate(Vector3.right * speed * Time.deltaTime);
left == transform.Translate(-Vector3.right * speed * Time.deltaTime);
up == transform.Translate(Vector3.up * speed * Time.deltaTime);
down == transform.Translate(-Vector3.up * speed * Time.deltaTime);
``````

So all you would need is a speed. Speed could be determined by mouse, click and drag, touch and drag, keyboard or just about anything else you can imagine.

So if you were using your keyboard You could say something like this:

``````var speed = Input.GetKey(KeyCode.UpArrow) ? 1 : 0;
``````

It basically says that if the Key UpArrow is pressed then the value is 1, otherwise it is 0.

If, you wanted to get the axis from up to down, you could use something like this:

``````var speed = Input.GetAxis("Vertical");
``````

So if you wanted to move your camera forward or backward you could use something like this:

``````var MoveSpeed = 5.0;

function LateUpdate(){
var speed = Input.GetAxis("Vertical") * MoveSpeed;

transform.Translate(Vector3.forward, speed * Time.detlaTime);
}
``````

Because GetAxis can return -1 to 1, both forward and backward are covered.