How to shake camera smoothly in first person mode?

Hey,

I need smooth first person camera shake function. I tried using many methods but I haven’t found any solutions yet. I know how to make smooth camera shake for 3rd person mode using CameraOffset but it doesn’t work with first person mode. Is there a way to do this?

Just providing this function that makes 3rd person mode shake but doesn’t work on first person mode.

local shakeIntensity = 2.9 
local shakeSpeed = 0.3
local RunService = game:GetService("RunService")
local TweenService = game:GetService("TweenService")
local humanoid = player.Character:WaitForChild("Humanoid")

function shakeCamera()
	local shakeOffset = Vector3.new(
		math.random(-shakeIntensity, shakeIntensity),
		math.random(-shakeIntensity, shakeIntensity),
		math.random(-shakeIntensity, shakeIntensity)
	)
	local originalOffset = humanoid.CameraOffset
	local currentTime = 0
	local duration = shakeSpeed
	while currentTime < duration do
		local delta = currentTime/duration
		humanoid.CameraOffset = originalOffset + shakeOffset * (1 - delta)
		currentTime = currentTime + wait()
	end
	humanoid.CameraOffset = originalOffset
end

It’ll probably need tweenservice to make it smooth but like for example this is meant to be smooth without tweens.

I am looking for this kind of smooth shaking but in a first person mode, not in a 3rd person:


(This can be found from the other post:)

Someone made a great ez shake module that is very easy to use.

2 Likes

I would definitely recommend Ez Camera Shake.

If you want to make a custom system though, the way that Ez Camera Shake works is that it modifies the camera CFrame right after the camera controller updates it using code like

RunService:BindToRenderStep("After camera", Enum.RenderPriority.Camera.Value + 1, addCameraShake)

This way the camera CFrame can be modified but the camera controller still updates the camera CFrame too.