I'm trying to make my own first person camera controls in unity that use both thumbsticks on a joypad. I have this working fine. However, when I move the right thumb stick (the one uses to look left / right & up / down the camera begins to constantly update.
Here is my joypad movement code:
// Update is called once per frame
void Update()
{
float speed = transform.localEulerAngles.y + Input.GetAxis("LeftRight") * sensitivityX;
rotationY += Input.GetAxis("UpDown") * sensitivityY;
rotationY = Mathf.Clamp(rotationY, minimumY, maximumY);
transform.localEulerAngles = new Vector3(-rotationY, speed, 0);
}
To control the left thumb stick, I've simply attached the my script to a first person character controller Unity provide.
I know my code is updating every frame, but I assumed that it would only update as and when I press the right thumb stick. If that isn't the case, is there a way I can limit it to only increment when I move the right thumb stick?