Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Stopping CFrame.Angles in the Z?

Asked by
Edenojack 171
8 years ago

I'm trying to rotate a camera without adding any roll to it. So far I believe the angles I want to use are:

    local X = Camera.CoordinateFrame*CFrame.Angles(-math.rad(type.Delta.y),0,0)
    local Y = CFrame.new()*CFrame.Angles(0,-math.rad(type.Delta.x),0)

with type.Delta being the mouse movement. But then, I'm at a loss of how to apply this to the camera. I have CFrame position for it, but I need a way of applying the angles to it :/

1 answer

Log in to vote
0
Answered by
guges 15
8 years ago

You can use CFrame.Angles(X, Y, 0) to rotate on the x and y axis' and leave the z axis alone.

workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame * CFrame.Angles(X, Y, 0)

This will rotate the currentcamera in the x and y axis' by X and Y, respectively. CFrames carry both attitude and position, so you can just multiply one by a CFrame.Angles() to rotate by the respective angles.

0
I've just fixed it but thank you very much for the answer! Edenojack 171 — 8y
Ad

Answer this question