Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How would I get the camera rotation CFrame?

Essentially I'm trying to get the orientation of the camera (like how parts have an orientation property), but I don't see the camera having that.

I can get the camera CFrame with game.Workspace.CurrentCamera.CFrame, but I'm not sure how to find what the rotation vector is out of this cframe.

1 answer

CFrames have a LookVector, RightVector, and UpVector properties which are the components that describes the CFrames orientation using unit vectors.

But if you were looking for angles (in radians) toEulerAnglesXYZ is a method of CFrame that returns those angles as a tuple:

local x, y, z = cf:toEulerAnglesXYZ() -- in radians

It could then be used in CFrame.Angles

CFrame.new(0, 0, 0) * CFrame.Angles(x, y, z) -- create another CFrame with a position of 0, 0, 0
-- and the same rotation as cf

1 comment

0

I comfrirm

This discussion is preserved as it was. New answers, comments, and votes are closed.