Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Stopping CFrame.Angles in the Z?

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

✓ Accepted answer

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.

1 comment

0

I've just fixed it but thank you very much for the answer!

This discussion is preserved as it was. New answers, comments, and votes are closed.