How to i get the X or Y or Z value of the Camera Rotation CFrame?

I’m doing a custom shift lock for a custom camera that i’m doing for my game, and i could not figure out how to get the Rotation CFrames from the camera separeted…

CFrame.Position.YPosition

or something like that

1 Like

image
and im not looking for the CFrame.Position.Y separated, im looking for the CFrame.Rotation.X/Y/Z Separated, but it just returns 0 nem i put CFrame.Rotation.X or Y or Z

you can get euler angles by two methods ToEularAnglesXYZ and ToOrientation

local camera = workspace.CurrentCamera

local cameraCFrame = camera.CFrame

-- we can use ToEulerAnglesXYZ()
local rotX, rotY, rotZ = cameraCFrame:ToEulerAnglesXYZ()

-- or using  ToOrientation()
local rotX, rotY, rotZ = cameraCFrame:ToOrientation()

print("Rotation X (Pitch):", math.deg(rotX))
print("Rotation Y (Yaw):", math.deg(rotY))
print("Rotation Z (Roll):", math.deg(rotZ))
3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.