EZ Camera Shake ported to Roblox

This is honestly super cool and easy to use! I wanted to play around with it so I made a little view bobbing script that triggers the shake while walking. However, I wasn’t sure how to make a custom preset so I just edited the Rough Driving one.

2 Likes

(I didn’t know the music was on. I was listening to the Roblox copyright replacement music :sob:)

You can change the rotation and position influence with the custom shake methods

local Camera = workspace.CurrentCamera
local Shaker = CameraShaker.new(Enum.RenderPriority.Camera.Value+1, function(ShakeCF)
	Camera.CFrame *= ShakeCF
end)
Shaker:Start()
Shaker:ShakeOnce(1, 1, 1, 1, Vector3.zero, Vector3.new(1,1,1)) -- Magnitude, Roughness, fadein and fadeout time and the last 2 Vector3 values are position influence and rotation influence
Shaker:StartShake(1, 1, 1, Vector3.new(0.5,0.5,0.5), Vector3.new(1,1,1)) -- same thing but for sustained shakes (like earthquakes) you can also just copy values off the presets and edit the influence
1 Like

sup this is a cool module that i’ve been using for 4 years now really helps me with camera stuff

I want to share this fix for all who has fps problem.
The problem is if we change the fps, the camera shook more

My friend asked to sleitnick for fps fix and he replied to us.

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")

local CameraShaker = require(ReplicatedStorage.CameraShaker)
local CAMERA = workspace.CurrentCamera

-- Copied from example. Just added prevCamCf
local prevCamCf = CAMERA.CFrame
local camShake = CameraShaker.new(Enum.RenderPriority.Camera.Value, function(shakeCf)
    prevCamCf = CAMERA.CFrame
    CAMERA.CFrame = CAMERA.CFrame * shakeCf
end)

-- The fix:
-- Reset the camera on the first RenderPriority, before cam scripts run:
RunService:BindToRenderStep("ResetCF", Enum.RenderPriority.First.Value, function(dt)
    CAMERA.CFrame = prevCamCf
end)

camShake:Start()
camShake:ShakeSustain(CameraShaker.Presets.Bump)

This method can be useable in this module and current latest shake module
Thanks to sleitnick for helping us! :grin:

2 Likes

If you want, you could also use RunService.Heartbeat to reset the CFrame, since that runs after all the rendering is done too. Either work!

2 Likes

Is that will make lag? SLEOW grigjrtxzassad

I got a simpler solution for the high fps problem so basically what I did is changed the main module scripts line 154 and 155 to include " * dt * 70 " at the end. I don’t know if this is a perfect solution because is I just figured it out. The * 70 is the shake intensity over all you can change it to your liking