Help with smooth camera bobble

I am trying to make a smooth camera bobble for my game. It works perfectly, but the only problem is when a player stops moving, the camera instantly moves back into place creating a very unappealing look. I tried using :Lerp() but I don’t know how to use it correctly.

RunService:BindToRenderStep("CameraBobble", Enum.RenderPriority.Camera.Value, function(delta)
	local currentTime = tick()
	
	local RootVelocity = math.round(Vector3.new(HRP.AssemblyLinearVelocity.X, 0, HRP.AssemblyLinearVelocity.Z).Magnitude)
	
	if previousVelocity then
		RootVelocity = Lerp(previousVelocity, RootVelocity, .1)
	end
	
	local Walk_Y = abs(sin(currentTime * (RootVelocity/2))) * .4
	local Walk_X = cos(tick() * (RootVelocity/2)) * .3
	
	local Idle_Y
	local Idle_X
	
	if Hum.MoveDirection.Magnitude < 0 then
		
	elseif Hum.MoveDirection.Magnitude > 0 then
		
	end
	
	Camera.CFrame *= CFrame.new(0, Walk_Y * .75, 0) * CFrame.Angles(0, 0, math.rad(Walk_X * 1.5))
end)
1 Like

It’s called viewbobbing. There are many tutorials that can help, like in the Roblox Studio toolbox, YouTube or other sources.

(I won’t be helping much since I’m on a phone right now.)

I used SpringModule, it fixed the problem

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.