Does anyone know how to find the direction the player’s camera is pointing in? (Orientation)

I was making a 3d minimap with a viewport frame and wanted to make it so the orientation of the minimap was in accordance to the direction that the player’s camera was pointing in . I tried and tried to convert the camera’s look vector to orientation but was unable and couldn’t figure it out. I even looked at fms but I couldn’t understand them and they didn’t really apply to my situation.

Does anyone know how to find the direction the player’s camera is pointing in? (Orientation)

3 Likes

Try getting angle of player camera’s look vector:

local LookVector = game.Workspace.CurrrentCamera.CFrame.LookVector
local Angle = math.atan2(LookVector.X, LookVevtor.Z)

Then use CFrame.Angles() to change ViewportFrame Camera angle (not sure where is correct, change to Y or Z if I’m wrong):

ViewportCam.CFrame = CFrame.new(PlrPos) * CFrame.Angles(Angle,0,0)
1 Like

simply put

local X, Y, Z = camera.CFrame:ToEulerAnglesXYZ()

and for orientation use math.deg

Im a bit late but this method will not work. the angles will be off.
the correct method is:

local RadianOrientation = Vector3.new(Cam.CFrame.Rotation:ToOrientation())
local DegreeOrientation = Vector3.new(math.deg(RadianOrientation.X),math.deg(RadianOrientation.Y),math.deg(RadianOrientation.Z))

this should give you the Camera Orientation as seen in the Properties window.

idk why so many people post the EulerAngles answer because it is off. it will give you multiple degrees of an angle off from the actual thing and cause failure when you need an accurate camera orientation.

edit: i found the original post i got that info from, here is the link if anyone needs it.

2 Likes