How would i access the rotation property of workspace.CurrentCamera's CFrame

Hello, i’m trying to make debug stats for the camera, but i don’t know how to access this property of workspace.CurrentCamera.CFrame
image
I have tried finding solutions online such as Camera.CFrame:ToEulerAnglesXYZ(), but those don’t give my desired output.
Help will be appreciated.
(sorry if this post is very short)

I believe you want to convert the radian output of ToEulerAngles to degrees.

I tested this in the command line in Roblox Studio:

local rx,ry,rz = game.Workspace.CurrentCamera.CFrame:ToEulerAnglesXYZ();
rx = math.deg(rx);
ry = math.deg(ry);
rz = math.deg(rz);

local rotation = Vector3.new(rx, ry, rz)

Hope this helps! :smile:

image
image
uhh

The CFrame listed in the properties window isn’t updated every frame. There is bound to be some discrepancy between the two values. The :ToEulerAngles() function should be accurate.

i fixed the code you sent, it works now!

local rx,ry,rz = game.Workspace.CurrentCamera.CFrame:ToEulerAnglesYXZ();
rx = math.deg(rx);
ry = math.deg(ry);
rz = math.deg(rz);

local rotation = Vector3.new(rx, ry, rz)
print(rotation)

image
image

That is literally the exact same code?

I replaced it with YXZ, not XYZ.

Ohhh, I see. Happy it’s working now! :smile:

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