only moves the camera in any direction but I need the Camera to move positive along the Y Axis when pressing Q for example and Negative when pressing E.
Thx for the Answers =)
You could replace the movement code (the last 4 lines) with this code:
...
transform.position += transform.forward*moveSpeed*Input.GetAxis("Vertical")*Time.deltaTime;
transform.position += transform.right*moveSpeed*Input.GetAxis("Horizontal")*Time.deltaTime;
var vDir: float = 0;
if (Input.GetKey("q")) vDir = 1;
if (Input.GetKey("e")) vDir = -1;
transform.position += transform.up*moveSpeed*vDir*Time.deltaTime;
Notice the multiplication by Time.deltaTime: this makes the movement framerate independent, a very important thing given the wide performance variation among different machines (the velocity moveSpeed means units per second in this case). This isn’t necessary in the rotation section, because Mouse X and Mouse Y already give values that compensate the framerate.
if (Input.GetKey(KeyCode.Q))
transform.position += Vector3.up * moveSpeed * Time.deltaTime;
else if (Input.GetKey(KeyCode.E))
transform.position += -Vector3.up * moveSpeed * Time.deltaTime;
Vector3.up (and respectively .forward and .right) gives you a unit vector (direction) in world space coordinates, unlike transform.up which gives you the direction in local space.
Tip: Always multiply your movements with the current delta time to make it framerate independent