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

Rotating the camera around the focus?

Asked by 9 years ago

Im trying to rotate the camera around the focus point. I have this for far,

        local cf = CFrame.new(cam.CoordinateFrame.lookVector*40)*CFrame.Angles(0,math.rad(rot),0)*CFrame.new(0,40,40)
        local fc = CFrame.new(cam.CoordinateFrame.lookVetcor*40)    
        cam.CoordinateFrame = CFrame.new(cf.p,fc.p)         
        rot = rot + 45      

but it doesn't work and I don't know why?

1 answer

Log in to vote
1
Answered by 9 years ago

You should look at the Wiki for Camera Manipulation! They teach and example of how to make your camera rotate around a part while teaching you about Camera Manipulation.

Here's the script they give anyway:

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

You can learn even more with the link to Camera Manipulation Here!

  • Near the Bottom of the page is "Circling the part"
0
I based the original script off that, but it still wont work ByDefault 5 — 9y
0
Go to the wiki link alphawolvess 1784 — 9y
Ad

Answer this question