Hello!
I’ve been looking for a method to be able to limit the player’s rotation angle, or just allow it to rotate on a single axis.
The code’s I am using right now:
RunService.Heartbeat:Connect(function()
local rX = Camera.CFrame:ToOrientation()
local Val = math.clamp(math.deg(rX), -30, 30)
Camera.CFrame = CFrame.new(Camera.CFrame.p) * CFrame.fromOrientation(math.rad(Val), math.rad(170), 0)
end)
This script works well. It limits the Camera to only move on a limited angle on the X axis, and limits it from moving on the Y axis.
But, it’s not smooth at all. It keeps lagging and letting the camera off the limits every time.
Is there a built-in option in one of the camera scripts that allowed me to change the camera rotating limits?
What if you just grab the original camera’s angle (CFrame), then use some kind of funny cframe from orientation stuff to get the orientation, and limit the camera based on that?