Can't set CFrames orientation to what i want it to be, have been trying to solve this for hours

I’m trying to set the orientation of a camera to -25, 45, 0 via a script for a ViewportFrame. Here’s how it looks with a manually inserted camera with the correct orientation:

But when i actually try the game it looks like this:

Here’s my script for creating the camera and setting up the CFrame:

local camera = Instance.new("Camera")
camera.CFrame = CFrame.new(2.5,1.5,2.5)*CFrame.Angles(math.rad(-25), math.rad(45), math.rad(0))
	
camera.Parent = unboxedGui.Laser
unboxedGui.Laser.ViewportFrame.CurrentCamera = camera

I don’t understand why it’s not working, maybe im misunderstanding what the docs about CFrames are saying?

1 Like

You’ll want to use fromOrientation instead of Angles.

The reason for this is that the angles are applied in different orders for the different functions which changes the result. The order in which they’re applied is important.

See CFrame | Roblox Creator Documentation for more details.

1 Like

Thank you so much, your solution finally fixed the issue.

1 Like

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