- Home /
Question by
Lost_Syndicate · Jul 14, 2018 at 11:45 PM ·
c#cameracamera-movement
Move camera on Z axis instead of Y?
Im making a TDS Style game, where you get to control an army, and command it. Whenever i try pressing W or S, it zooms me in / out. I've tried setting it to Z, but it doesn't work. Since the camera is rotated, it probably thinks that im trying to go down, since thats where the camera is pointed. But i dont want that. here is my script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Camera_Movement : MonoBehaviour {
private void Update()
{
Vector3 dir = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
transform.Translate(dir);
/*
float x = Input.GetAxis("Horizontal");
float z = Input.GetAxis("Vertical");
transform.Translate(x, 0, z);
*/
}
}
Comment
you've said what it does and that you don't like it but you failed to mention what effect you would actually like to achieve here