I’m trying to make the camera only rotate perfectly on the X and Y axis, like so:
I have been able to make the camera rotate, but I haven’t been able to restrict it to a perfect X/Y axis like above.
Code:
if Input.KeyCode == Enum.KeyCode.Thumbstick2 then
local MoveY = Input.Position.Y
local MoveX = Input.Position.X
if MoveY >= 0.5 or MoveY <= -0.5 then
Camera.CFrame = Camera.CFrame * CFrame.fromEulerAnglesXYZ(MoveY * RotateSpeed, 0, 0)
elseif MoveX >= 0.5 or MoveX <= -0.5 then
Camera.CFrame = Camera.CFrame * CFrame.fromEulerAnglesXYZ(0, -MoveX * RotateSpeed, 0)
end
end