У меня поворот камеры реализован через Rotate()
public class CameraController : MonoBehaviour
{
public Transform Player;
[SerializeField] public Joystick JoystickPlayer;
public float TouchX;
public float TouchY;
public float Sensitivity = 200f;
void LateUpdate()
{
TouchY = JoystickPlayer.Horizontal * Sensitivity * Time.deltaTime;
TouchX = JoystickPlayer.Vertical * Sensitivity * Time.deltaTime;
Player.Rotate(TouchY * new Vector3(0, 1, 0));
transform.Rotate(-TouchX * new Vector3(1, 0, 0));
}
}
Скрипт прикреплен к камере. Как можно ограничить поворот камеры по X?