using UnityEngine; using Cinemachine; public class CameraController : MonoBehaviour { [SerializeField] private GameObject cam; public float scrollSpeed; public Vector2 sens; private Vector2 defaultMaxSpeed; private void Start() { defaultMaxSpeed *= 0; } private void Update() { defaultMaxSpeed = new Vector2(cam.GetComponent().m_XAxis.m_MaxSpeed, cam.GetComponent().m_YAxis.m_MaxSpeed); if (Input.GetMouseButtonDown(1)) { defaultMaxSpeed = sens; } if (Input.GetMouseButtonUp(1)) { defaultMaxSpeed *= 0; } cam.GetComponent().m_XAxis.m_MaxSpeed = defaultMaxSpeed.x; cam.GetComponent().m_YAxis.m_MaxSpeed = defaultMaxSpeed.y; float scroll = Input.GetAxis("Mouse ScrollWheel"); cam.GetComponent().m_Offset.z += scroll * scrollSpeed; } }