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

How can I make a camera rotate around a Model?

Asked by 5 years ago

Please provide more explanation in your question. If you explain exactly what you are trying to accomplish, it will be much easier to answer your question correctly.

I tried rotating the model instead but that didn't work

while true do
    wait()
    script.Parent.ViewportFrame.DontChangeThisName:SetPrimaryPartCFrame(script.Parent.ViewportFrame.DontChangeThisName:GetPrimaryPartCFrame() * CFrame.fromEulerAnglesXYZ(0, 0.5, 0))
end

Any help?

0
"that didn't work" isn't of much help. User#24403 69 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago
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

This is where I got it from https://developer.roblox.com/articles/Camera-manipulation

Ad

Answer this question