Camera CFrame.Angles X and Z axis being the same

Title is self explanatory,

Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = CFrame.new(HumanoidRootPart.Position.X+35,HumanoidRootPart.Position.Y+35,HumanoidRootPart.Position.Z) * CFrame.Angles(math.rad(0),math.rad(90),math.rad(0))

Basically changing the X and Z axis will change camera orientation in the exact same way for some reason. I have no idea why this happens sooooo any help? Also yes the code is running in a RenderStepped function.

1 Like

According to your code there, both the x and z axis are set to zero. Could you explain more about what you’re trying to accomplish?

I mean im also kinda expecting other people to try the code for themselves and to yknow, actually change the X, and Z axis. And what im trying to accomplish is basically i need a top down view of the player issue is i cannot do that since both X and Z rotate the camera sideways.

Z Pitches forward or backward (like a somersault). Y rotates like spinning a top. X rotates like doing a barrel roll (left/right).

So to look straight down rotate only Z -90 degrees. ( Pretty sure its negative but could be positive)

Another way you might do this is by using the lookAt constructor for the CFrame:

local camPos = Vector3.new(
HumanoidRootPart.Position.X+35,
HumanoidRootPart.Position.Y+35,
HumanoidRootPart.Position.Z)

Camera.CFrame = CFrame.lookAt(camPos, HumanoidRootPart.Position)

another way to set the cam position:

local camPos = Camera.CFrame:ToWorldSpace(CFrame.new(35, 35, 0)).Position
1 Like

So far the camera position does work, however again my entire issue is that X and Z rotate exactly the same way sideways (left/right).

However this did fix my issue so thank you for that!

1 Like

That’s really weird, I’ll have to test that out and see if I get the same problem, that shouldn’t be happening though as far as I know.

I’m glad the alternative worked for you though. :smiley: Happy coding.

1 Like

So far it happens with the Y axis set to 90 degrees or so, with different numbers you may get some more unexpected angles.