this is what im trying to go after
this is what I have at the moment
local function onInputChanged(input)
if input.UserInputType == Enum.UserInputType.MouseMovement then
local delta = input.Delta
local rootPart = character.HumanoidRootPart
local currentRotation = rootPart.CFrame.Rotation
local newRotation = CFrame.Angles(0, math.rad(-delta.X/2), 0) * currentRotation
rootPart.CFrame = CFrame.new(rootPart.Position) * newRotation
mouseDelta = delta
cameraYOffset += delta.Y/10
cameraXOffset += delta.X
cameraYOffset = math.clamp(cameraYOffset,-10,20)
cameraXOffset = math.clamp(cameraXOffset,-4,4)
end
end
local function smoothCameraTransition(startCFrame, targetCFrame, duration,resetBack)
local startTime = tick()
if not resetBack and shiftlockConnection then
RunService:UnbindFromRenderStep("CameraTrans")
shiftlockConnection:Disconnect()
end
if not resetBack then
shiftlockConnection = UserInputService.InputChanged:Connect(onInputChanged)
cameraYOffset = 0
end
RunService:BindToRenderStep("CameraTrans",Enum.RenderPriority.First.Value,function()
local et = tick() - startTime
local alpha = et / duration
if not resetBack then
startCFrame = character.HumanoidRootPart.CFrame * CFrame.new(0.7,2.5,ZOOM_DISTANCE)
targetCFrame = startCFrame + (startCFrame.LookVector * (ZOOM_DISTANCE*0.3))
else
targetCFrame = character.HumanoidRootPart.CFrame * CFrame.new(1.5,1,ZOOM_DISTANCE)
end
alpha = math.min(1,alpha)
camera.CFrame = startCFrame:Lerp(targetCFrame, alpha)
if alpha >= 1 then
--[[RunService:UnbindFromRenderStep("CameraTrans")
steppedConnection = nil]]
if resetBack then
workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
RunService:UnbindFromRenderStep("CameraTrans")
steppedConnection = nil
end
end
end)
end
This is the relevant code, I want to achieve the free-ish movement that the first video has, where the camera is able to move while being somewhat locked on