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

How to make a camera rotate around a part?

Asked by 7 years ago

So i was wanting to know how to make a players camera rotate around a part, i cant find anything on how to do it, here is what i got

local Camera = game.Workspace.CurrentCamera

while true do
Camera.Rotation = Camera.Rotation + 0,0,1
wait(.1)
end

1 answer

Log in to vote
0
Answered by 7 years ago

This should do it!

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(0, angle, 0) --Rotate by the angle
                           * CFrame.new(0, 0, 5)       --Move the camera backwards 5 units
    angle = angle + math.rad(1)
end

If you have more questions on camera manipulation, click here

Ad

Answer this question