How to add recoil to a gun while maintaining a 3rd person view camera lock

I am making a gun that is supposed to have a third person view camera lock, and also have a little recoil when the gun is shot. The issue is I use RenderStepped to constantly update the camera CFrame to stay in the third person view. The way I added recoil was by lerping the camera CFrame. So whenever the third person view is activated there is no recoil.

Is there a way to add recoil without changing the camera’s CFrame? or maybe is there a way to add recoil without changing the camera’s CFrame.

2 Likes

I have a very basic solution.
This is my old recoil script. Indeed, it is very basic and disappointing, but it get the job done.
This will work on First Person Camera and Third Person Camera.
Method : Multiplying camera current CFrame with CFrame.Angles

local function changeCamaraRecoilUp(numberOfStep, maxValue, minValue, waitNumber)
	for Count = numberOfStep, 1, -1 do
		local ValX = maxValue / minValue
		
		camera.CFrame = camera.CFrame * CFrame.Angles(ValX, 0, 0) -- camera is game.Workspace.CurrentCamera
		task.wait(waitNumber) 
	end
end

tool.Activated:Connect(function()
   changeCamaraRecoilUp(3, 1, 60, 0.006)
end)
5 Likes

For anyone in the future needing help, just change the camera offset of the player’s humanoid. This will allow you to change the camera’s CFrame while maintaining the camera offset.