Im working on a custom camera with no rotation limits and im having an issue when the camera will be offset a bit on the Z axis, which is really annoying and i cant figure out how to set only the Z orientation to 0 in the cameras CFrame
Ive attached a video showing how the camera is offset a bit:
heres the code I’ve currently got:
local delta = uis:GetMouseDelta()
local x = delta.X
local y = delta.Y
local CamCFrame = cam.CFrame * CFrame.fromOrientation(math.rad(-y),math.rad(-x),math.rad(0))
local cX, cY, cZ,R00, R01, R02, R10, R11, R12, R20, R21, R22 = CamCFrame:GetComponents()
cam.CFrame = CFrame.new(
plr.Character.Head.Position.X,
plr.Character.Head.Position.Y,
plr.Character.Head.Position.Z,
R00, R01, R02, R10, R11, R12, R20, R21, R22
)