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

How to make the CurrentCamera go from point A to point B?

Asked by 7 years ago

I would like than the camera heading to part named "B", how do I proceed?

repeat wait() until workspace.CurrentCamera wait()

local target1 = workspace:FindFirstChild("A")
local target2 = workspace:FindFirstChild("B")
local camera = workspace.CurrentCamera

camera.CameraSubject = target1 
camera.CameraType = Enum.CameraType.Scriptable

--local angle = 1

while wait() do 
    camera.CoordinateFrame = CFrame.new(target1.Position)
--  * CFrame.Angles(target2.Position)
--  * CFrame.new(target2.Position)
--  angle = angle + math.rad(.2)
end

Thanks for your response !

1 answer

Log in to vote
0
Answered by 7 years ago

Use Lerp:

for i = 0,1,0.01 do
wait(0.01)
camera.CoordinateFrame = camera.CoordinateFrame:lerp(target2.CFrame, i)
end
0
Thanks you!!:) NiniBlackJackQc 1562 — 7y
Ad

Answer this question