Help with smooth camera

I want to have a smooth camera that 1. you can manually move with right click and 2. doesn’t break shiftlock. I’m trying to make it follow your body (obviously) with a delay on all axis. something like the elden ring camera movement.

Here’s my code right now:

local RunService = game:GetService("RunService")
local Players = game:GetService("Players")

local camera = workspace.CurrentCamera
local head = script.Parent:WaitForChild("Head")
local subject = script:WaitForChild("Subject")

subject.Position = head.Position

local WEIGHT = 10

local function updateSubject()
	if not Players.LocalPlayer or not Players.LocalPlayer.Character or not Players.LocalPlayer.Character:FindFirstChildOfClass("Humanoid") then
		return
	end

	local targetPosition = head.CFrame * CFrame.new(0, 0, 0) -- Adjust the offset as per your need
	subject.Position = subject.Position:Lerp(targetPosition.p, 1 / WEIGHT)
	camera.CameraSubject = subject
end

RunService:BindToRenderStep("UpdateSubject", Enum.RenderPriority.Camera.Value, updateSubject)

everything works except for shiftlock.

PLEASE HELP, thx.

I can share this, but past that I’m not sure what else:


The key to is being “smooth” is having a small enough lerp alpha, but I think also using time.wait(deltaTime). At least, that’s what I’m doing when moving the camera. :person_shrugging:

1 Like

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