Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Make camera movement smooth?

Hey there! I've been messing up with camera manipulation because I wanted to make a script that makes the camera follow a part, and everything is working fine. But there is something I don't like. It's not really a glitch or anything, It's actually that the camera isn't completely "smooth". When the part moves, the camera moves, and I can notice like a "trail" of the ball's movement. It is a bit "ugly" to see the ball like a laggy car. When I use cars in ROBLOX, I don't notice any trails. Is there anyway to make a camera move more "Smoothly"?

local cam = nil
local ball = nil

script.Parent.MouseButton1Click:connect (function ()
	game.ReplicatedStorage.PlayerPlaysHole1:FireServer(game.Players.LocalPlayer)
	local ball = game.Workspace.MinigolfBalls:WaitForChild("Ball".. game.Players.LocalPlayer.UserId)
	local cam = game.Workspace.CurrentCamera
	cam.CameraType = Enum.CameraType.Scriptable
	cam.CameraSubject = ball
	while true do
		wait ()
		cam.CoordinateFrame=CFrame.new(ball.CFrame.X, ball.CFrame.Y + 5, ball.CFrame.Z + 10)
	end
end)

For if you ask, the client has network ownership.

3 comments

0

try making the ball transparent or making it smaller

0

Nah It's yet small and it can not be transparent.

0

You could use game:GetService('TweenService'):Tween() or use CameraObject:Interpolate.

1 answer

✓ Accepted answer

Camera renders 60fps but wait() is 30fps, so it is not synced; 'laggy'.

You want: BindToRenderStep

--threw in some efficiency
local RS = game:GetService("RunService")
local zoom = Vector3.new(0,5,10)

RS:BindToRenderStep("asdf",Enum.RenderPriority.First.Value,function()
	cam.CFrame = CFrame.new(ball.CFrame.p+zoom)
end)

2 comments

0

Thanks! I didn't knew about BindToRenderStep

0

And also, thanks to that you answered my question I can backup from those 2 rep points I lost for downvoting two dummies...

This discussion is preserved as it was. New answers, comments, and votes are closed.