I used a Vector 2 so that I could control them both from one variable but have the X and Y sensitivity be different
private Camera camera;
[SerializeField] private Vector2 aimDownSightsSensorSize;
[SerializeField] private Vector2 normalSensorSize;
private RigidbodyFirstPersonController firstPersonController;
[SerializeField] private Vector2 normalSensitivity;
[SerializeField] private Vector2 adsSensitivity;
private void Start()
{
camera = GetComponentInChildren<Camera>();
firstPersonController = GetComponent<RigidbodyFirstPersonController>();
}
private void Update()
{
ProcessAimDownSights();
}
void ProcessAimDownSights()
{
if (Input.GetMouseButton(1))
{
camera.sensorSize = aimDownSightsSensorSize;
firstPersonController.mouseLook.XSensitivity = adsSensitivity.x;
firstPersonController.mouseLook.YSensitivity = adsSensitivity.y;
}
else
{
camera.sensorSize = normalSensorSize;
firstPersonController.mouseLook.XSensitivity = normalSensitivity.x;
firstPersonController.mouseLook.YSensitivity = normalSensitivity.y;
}
}