How would I use interpolate to move my camera smoothly? An example of use in a script would be great! Quoted directly from the wiki:
1 | void Interpolate ( CoordinateFrame endPos, CoordinateFrame endFocus, float duration ) |
Smoothly tweens the camera from the current coordinate frame to the supplied one with the given focus over the duration.
Here you go:
01 | wait( 1 ) |
02 | game.Players.PlayerAdded:connect( function (pl) |
03 | pl.CharacterAdded:connect( function (c) |
04 | local sclone = script:Clone() |
05 | sclone.Parent = c |
06 | end ) |
07 | end ) |
08 | local cam = game.Workspace.CurrentCamera |
09 | local cframe = cam.CoordinateFrame |
10 | local endPos = CFrame.new( 30 , 20 , 30 ) |
11 | local endFocus = CFrame.new( 4 , 0 , 4 ) |
12 | cam.CameraType = "Scriptable" |
13 |
14 | cam:Interpolate(endPos,endFocus, 5 ) |