Fixing camera controls

So currently my camera controls seem to be inverted, hitting the left arrow turns the camera right and vice versa. I do not want this, I want the camera to turn the direction hit. How do I convert my code to do that below:
Pretty sure I need to replace the Input.GetAxis.

public Transform target;

        public Vector3 offset;
        public float zoomSpeed = 4f;
        public float minZoom = 5f;
        public float maxZoom = 12f;

        public float pitch = 2f;

        public float currentZoom = 8f;

        public float yawSpeed = 100f;
        public float currentYaw = 180f;

        private void Update()
        {
            currentZoom -= Input.GetAxis("Mouse ScrollWheel") * zoomSpeed;
            currentZoom = Mathf.Clamp(currentZoom, minZoom, maxZoom);

            currentYaw -= Input.GetAxis("Horizontal") * yawSpeed * Time.deltaTime;

        }

        private void LateUpdate()
        {

            transform.position = target.position - offset * currentZoom;
            transform.LookAt(target.position + Vector3.up * pitch);

            transform.RotateAround(target.position, Vector3.up, currentYaw);

        }

Change -= to += on line 20.

2 Likes

ChangecurrentYaw -= Input.GetAxis("Horizontal") * yawSpeed * Time.deltaTime;tocurrentYaw += Input.GetAxis("Horizontal") * yawSpeed * Time.deltaTime;

1 Like

I repeatedly missed that is a - sign. lol was wondering why it wasn’t working right. Thanks a ton though. Have 1 other question.

How would I make the camera stay behind the player at all times?

Isn’t that what the value of “offset” is for? Or can you better describe what is happening?

Offset helps position it at the start. I want the camera update with the player’s position to always face his back. Right now you have to rotate it to get this to happen which can be a bit annoying when fighting enemies.
Example are below just in case I am not explaining it well enough. I want to to stay like in the 1st, not the 2nd.

5871628--625072--Screen Shot 2020-05-19 at 12.43.33 PM.png
5871628--625075--Screen Shot 2020-05-19 at 12.43.43 PM.png