You can interpolate the camera’s CFrame every frame instead of instantly setting it:
game:GetService('RunService').RenderStepped:Connect(function()
workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame:Lerp(
CFrame.lookAt(
Vector3.new(0, 10, 0), -- Position Vector3
Player:GetMouse().Hit.Position -- lookAt Vector3
),
0.1 -- must be between 0 and 1! to reduce sensitivity, try reducing the number (this is already 10% of the original speed)
)
end)
You’ll have to limit the amount of rotation on each individual axis. I was working on a project some time ago that used this same feature. The only thing I did different is that instead of lerping I tweened the camera’s CFrame:
local interpolationTime = 0.2 -- reduce sensitivity
local curMouseHit = mouse.Hit.Position
if userInputService:GetMouseLocation() ~= lastMousePos then
lastMousePos = userInputService:GetMouseLocation()
-- if you want the camera to always follow the mouse even when it isn't being moved, just comment out the line above
local forwardVector = (cam.CFrame.Position - curMouseHit).Unit
local upVector = Vector3.new(0, 1, 0)
local rightVector = forwardVector:Cross(upVector)
local upVector2 = rightVector:Cross(forwardVector)
local newCFrame = CFrame.fromMatrix(cam.CFrame.Position, -rightVector, upVector2)
local curX, curY, curZ = newCFrame:ToOrientation()
if math.deg(curY) > 0 then
curY = -curY
end
local xLimit = math.clamp(math.deg(curX), -40, -10) -- customize the clamping values. These are specific to how the camera I was using is rotated, and will most likely be different for yours
local yLimit = math.clamp(math.deg(curY), -151.47, -118.53)
local zLimit = math.clamp(math.deg(curZ), -6.88, 6.88)
newCFrame = CFrame.new(newCFrame.Position) * CFrame.fromOrientation(math.rad(xLimit), math.rad(yLimit), math.rad(zLimit))
local camInterpolation = tweenService:Create(
cam,
TweenInfo.new(interpolationTime, Enum.EasingStyle.Sine, Enum.EasingDirection.In),
{
CFrame = newCFrame
}
)
camInterpolation:Play()
end
You’d have to get the default rotation of the camera position you’re using. Then just add or subtract 45 degrees to appropriate axis. I might work on a better solution, and if I do I’ll update the post and let you know