I’ve “attempted” to make a script (I’m new to programming) to move the camera left/right (only left so far) when you press a key. What I’ve tried to do here is setting one Vector3 to be the Current position of the camera and overlay another Vector3 over the current to move it.
Something is wrong somewhere (No script errors tho) as Nothing happens when I hit the desired key and I can’t seem to find what is wrong
Heres part of the script:
Vector3 CamMoveLeft = new Vector3 (-13.5f, 0.0f, 13.5f);
void Start ()
{
}
void Update ()
{
Vector3 currentPosition = GetComponent<Camera> ().transform.position;
if (Input.GetButtonDown ("Fire1"))
Debug.Log (currentPosition);
if (Input.GetButtonDown ("Fire1")) {
GetComponent<Camera> ().transform.position = currentPosition + CamMoveLeft;
GetComponent<Camera> ().transform.rotation = Quaternion.Euler (45, 90, 0);
}
}
}