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

How to use Camera Rotation correctly?

Asked by
Lineout 10
9 years ago

When you run this, the camera somehow fluctuates up and down. I want the X axis to hold math.rad(-25), but it seems as if it does not want to do that. Run this script to know what I mean:

local target = workspace.Part
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
camera.CameraSubject = target
local angle = 0

while wait() do
    camera.CoordinateFrame = CFrame.new(target.Position)  --Start at the position of the part
                           * CFrame.Angles(math.rad(-25), angle,0) --Rotate by the angle
                           * CFrame.new(0, 0, 5)       --Move the camera backwards 5 units
    angle = angle + math.rad(1)
end

Whenever I change angle (Y axis) to 0, the X axis stays in its correct position, not sure why. Any help would be appreciated, as I have trouble with using CFrames and the Camera.

Answer this question