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 8 years ago

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

01repeat wait() until workspace.CurrentCamera wait()
02 
03local target1 = workspace:FindFirstChild("A")
04local target2 = workspace:FindFirstChild("B")
05local camera = workspace.CurrentCamera
06 
07camera.CameraSubject = target1
08camera.CameraType = Enum.CameraType.Scriptable
09 
10--local angle = 1
11 
12while wait() do
13    camera.CoordinateFrame = CFrame.new(target1.Position)
14--  * CFrame.Angles(target2.Position)
15--  * CFrame.new(target2.Position)
16--  angle = angle + math.rad(.2)
17end

Thanks for your response !

1 answer

Log in to vote
0
Answered by 8 years ago

Use Lerp:

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

Answer this question