Getting the X Orientation of my Camera

[UPDATE] I just figured out how to get the Angle with ToEularAnglesXYZ

	local x,y,z = workspace.CurrentCamera.CFrame:ToEulerAnglesXYZ()
	workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame * CFrame.Angles(x,math.rad(Door2.Orientation.Y + 90),0)

I tried it but nothing changed : So now I need help on making the X Stay the same

How would I go about getting the X Orientation of my Camera?

What are you trying to do?

  • Im trying to change the Y Orientation of my Camera only but the X Orientation seems to be affected aswell.

My Code

workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame * CFrame.Angles(0,math.rad(Door2.Orientation.Y + 90),0)

As you can see that my code only wanted to affect the Y Angle, but it affects the X Angle also as can be seen at the GIF Below so I decided that if I can get the Recent X angle then I could do something like

(RecentXAngle,math.rad(Door2.Orientation.Y + 90),0)

So my X Angle wouldnt have to change anymore.
Note that if its not possible to get the X Orientation then is there any way to counteract it?

I did manage to change the Y orientation, the only problem is the X Orientation.

GIF
https://gyazo.com/9f39d5a0d0cb016bf11955341edf3ff6

As the GIF Shows that the camera goes down

2 Likes

do something like this

local camOrientationX = select(1, camera:ToOrientation()) --untested
2 Likes
local x, y, z = camera.CFrame:ToEulerAnglesYXZ()

print(x)
4 Likes