Hello ! I clamped my camera Yaxis,and it is all ok,but if i countinue to move my mouse(up/dpown),the value of Input.GetAxis(“Mouse Y”)continue increse or decrease(dipend if im moving up or moving down the mouse),how can i limit the mouse movement,or how to reset the value of input.GetAxis(“Mouse Y”)?
Thanks in advance
You can use the following code to limit the mouse movement (limiting ‘Mouse Y’), you can specify the ‘minY’ and ‘maxY’ values in ‘Mathf.Clamp’ as per your requirement
private float positionY;
private void Update()
{
positionY += Input.GetAxis("Mouse Y");
positionY = Mathf.Clamp(positionY, minY, maxY);
transform.position = new Vector3(transform.position.x, positionY, 0);
}
Thank You very much!