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

How do you make smooth Camera Tweens?

Asked by 10 years ago

As stated in the title I was wondering how to make smooth camera tweens but also override current tweens? I know for tweening position on GUI objects you can do

local obj = script.Parent

obj:TweenPosition(UDim2.new(0, 0, 0, 0), "Out", "Linear", 1.5, true)
wait(1)
obj:TweenPosition(UDim2.new(.5, 0, .5, 0), "Out", "Linear", 1)

And after one second it stops and starts tweening to 0.5 x 0.5 scale, the thing is I was wondering if there were ways to do generally the same thing between to camera positions? I've seen games do it before (ex: Mutliple games by Quenty) but I don't understand Camera Manipulation fully even after studying it on the wiki.

1 answer

Log in to vote
1
Answered by 10 years ago

Well, there is an Interpolate method that can be used on the Camera, but the CameraType has to be "Scriptable" before you can call that method. This is basically how you would do it:

Camera.CameraType = "Scriptable"
Camera:Interpolate(
            CFrame.new(), --Replace this with the CFrame of your new CoordinateFrame
            CFrame.new(), --Replace this with the CFrame of your new Focus
            1 --Replace this with the duration of the Interpolation
        )
Camera.InterpolationFinished:connect(function() --An event that fires once the Camera has finished Interpolating
    Camera.CameraType = "Custom" --Replace "Custom" with whatever you want the cameratype to be after it's finished Interpolating
end)

That's pretty much it! Hope this helped!

Note: For more information on the Camera, click here: Camera

0
Thank you so much, this helped loads. I've seen it before but I never understood it until now (for the most part). Is there a way to stop an interpolation mid-way? VariadicFunction 335 — 10y
Ad

Answer this question