How to set the camera tilt to an angle?

Hey, How would I go about setting the camera tilt to a specific angle while the the other angles and position stay the same?
Like:

Camera.CFrame = CameraTilt(Camera.CFrame, 180)

I found this function:

But it’s deprecated.

Just rotate the current camera lmfao

2 Likes

I can do something like this
Camera.CFrame = Camera.CFrame*CFrame.Angles(0, 0, math.rad(180))
But it adds the rotation instead of setting it

Oh not tilt but i think they call it “Roll”. Basically around the Z axis.

I imagine you’d want to extract the current angles of the other axes before setting the tilt, in order to keep the tilt constant. You can use CFrame:ToOrientation, which returns a tuple of Y, X, Z rotational values.

Around the X-axis would tilt the camera as if you were nodding your head. Y-axis would rotate it as if you were spinning in circles, and Z-axis would be as if you were led on the floor rolling around.

Essentially, you need to get the current position (Camera.CFrame.Position) and rotational values of the camera, then reapply the X and Y values, and set Z as your own value.

Just keep in mind angles are in radians, so you need to make sure your custom value is converted from degrees to radians using math.rad.

9 Likes

Thank you man. This is the best explanation I’ve ever seen!

2 Likes

how can rotate the camera in Y global axis and keep the tilt?
Please add an example.
Because i didn’t understand your previous message, where i should use each thing what function should i use.