How would i rotate a already tilted camera horizontally?

Im trying to rotate a camera that tilts down.

The problem is that if the camera is tilting -30 degrees down, and i try to rotate it horizontally it starts tilting up instead. I want it to tilt down, even when rotating it on the y axis (horizontally)

This is how it looks https://i.gyazo.com/dc02290f4425b417bee8c76d2d408fef.mp4 (sorry i dont know how to embed gyazo videos)

Currently the code looks like this

Cam.CFrame = CFrame.new(Pos.X, Cam.CFrame.Y, Pos.Z) * CFrame.Angles(math.rad(-30), yRotation, 0)

yRotation is the current y rotation in degrees. Or in other words the horizontal orientation.

I have tried searching or asking on discord servers, but got no answer.

2 Likes

I got a slightly cheaty solution from a discord server, by separating the cframes i can make it work

Like this

Cam.CFrame = CFrame.new(Pos.X, Cam.CFrame.Y, Pos.Z) * CFrame.Angles(0, yRotation, 0) * CFrame.Angles(math.rad(-30),0,0)

Probably not the best solution, but it works at least.

If you got a better solution, please send it here

3 Likes