Camera bobbling effect not working in first person after attaching camera to head

So I made this camera bobbling effect β†’ https://gyazo.com/eea213683e9fe86fa595bc6ff0498268

the code is as follows

local runService = game:GetService("RunService")

local char = script.Parent

local humanoid = char:WaitForChild("Humanoid")

function updateBobbleEffect()
	local currentTime = tick()
	if humanoid.MoveDirection.Magnitude > 0 then
		local bobbleX = math.cos(currentTime * 7) * .47
		local bobbleY = math.abs(math.sin(currentTime * 7)) * .47
		local bobble = Vector3.new(bobbleX, bobbleY, 0)

		humanoid.CameraOffset = humanoid.CameraOffset:lerp(bobble, .50)
	else
		humanoid.CameraOffset = humanoid.CameraOffset * .50

	end
end
runService.RenderStepped:Connect(updateBobbleEffect)

Now after using the Realism open source module to make my body parts visible, my bobbling effect is gone, likely due to the camera attaching itself to the head (which I want for other anims)
final product : https://gyazo.com/950486fa61b4444dc933084175451369
I tried several methods but I can’t seem to retain the bobbling effect while the camera is attached to the head, any help or corrections?

1 Like

CameraBobble.rbxl (54.1 KB)

Here is a place file with realism working alongside a more advanced camera bobbling effect that also lerps the camera so the movement feels more fluid.

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