My Goal:
I want to create a function I can smoothly move the camera to a given CFrame (Note that it's a CFrame because I Need Rotation too.)
My Question:
I know that I can Change the cameras CFrame but how can I make a shmooth camerapath? What is a good method?
Note: This is NOT a request, I just want to know a method
I just made that yesterday. Use TweenService. I know there are many methods, rendrestepped, loops, interpolate, etc.. However TweenService works best, since it is coded in underlying engine code, rather than Lua. Here is an example (LocalScript in StarterPlayerScripts):
local TweenService = game:GetService("TweenService") local player = script.Parent.Parent character = player.CharacterAdded:wait() humanoid = character:WaitForChild("Humanoid") local camera = workspace.CurrentCamera camera.CameraType = Enum.CameraType.Scriptable camera.CameraSubject = workspace local target = {CFrame = CFrame.new(Vector3.new(200,100,50), Vector3.new(0,100,0))} --first vector is where camera is supposed to go --second vector is where camera should "look" at the end of tween --of course you can always set the CFrame with your preferred method, that is just example local TweeningInformation = TweenInfo.new( 3 --duration of tween in seconds Enum.EasingStyle.Linear, --tween style Enum.EasingDirection.InOut --tween style direction ) --there are lots of cool things to change here, check the wiki local moveCamera = TweenService:Create(camera,TweeningInformation,target) moveCamera:Play() wait(3) --same as tween --restore camera camera.CameraType = Enum.CameraType.Custom camera.CameraSubject = humanoid
If you are interested how it works, check the intro to my game: https://www.roblox.com/games/2418401851/Crazy-Stairs-ALPHA