EZ Camera Shake ported to Roblox

Ok im having a big problem with it

If we make simply

CurrentCamera.CFrame *= ShakeCFrame

This is gonna aways add CFvalues to the previous, and its not what it is meant to do unless your camera is still, so its not a propper way to use along with the default camera settings.

Does someone know where can I find the current rotation of the camera as it should be without the shaker CF at the default CameraModule, so I can apply this module correctly?

Uh, nevermind, i solved it by changing the :Start() method to

function CameraShaker:Start()
   if (self._running) then return end
   self._running = true
   local callback = self._callback
   game:GetService("RunService"):BindToRenderStep(self._renderName, self._renderPriority, function(dt)
	    profileBegin(profileTag)
	    local cf = self:Update(dt)
	    profileEnd()
	    callback(cf * self._oldCF:Inverse())
	    self._oldCF = cf
    end)
end

I saved the last shakerCF in a variable and subtracted it on the next change

2 Likes

hey dude i ran into a problem.i dont know how to change the fade out time from local script
for example:
camshake:Shake(CameraShaker.Presets.Explosion)

i wanna change the roughness,magnitude,fadeout time from local script

For magnitude you can do:

Shake:SetScaleMagnitude(num)

though I’m not sure about the rest. Your best bet is to look through the module scripts and do CTRL/CMD + F to search for key words.

aight lemme try that real quick

Thanks to you, I was able to realize it quickly Thank you.

1 Like

How did you end up fixing it? it’s happening to me.

is there any way to make a shake return back into original camera cframe after its done?

This is really cool and i love it thats its really smooth but if you are going to call it easy to use atleast provide full example as i got confused in many parts of the script trying to figure it out

Either way the result was really good and i loved it

Has anybody had this problem where the camera shake module shakes the camera violently when a player joins the game? I can’t seem to figure out what the issue is.

1 Like

I’m not calling the :Shake() method either, I’ve only started the CameraShaker instance.

i have a problem with RemoteEvent so i want to make shake it from local script to server but its not working. why? here is script

local camera = workspace.CurrentCamera

local CameraShaker = require(game:GetService('ReplicatedStorage'):WaitForChild("CameraShaker"));
local camShake = CameraShaker.new(Enum.RenderPriority.Camera.Value, function(shakeCf)
	camera.CFrame = camera.CFrame * shakeCf
end)

camShake:Start()


game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(function()
	camShake:Shake(CameraShaker.Presets.Explosion)
end)

I think you have to create a new CameraShake object with CameraShaker.new() and THEN use CameraShakeObject:Start() and CameraShakeObject:Shake(CameraShakerObject.Presets.Explosion)

1 Like

Hello, I am getting an error with the first script (CameraShaker) when I activate it. Here is it : ReplicatedStorage.CameraShaker:89: RenderPriority must be a number (e.g.: Enum.RenderPriority.Camera.Value)

If anyone could help, it would be very nice.

I’ve been having the same exact problem, I could not t find any way to replicate this issue and I just don’t know how to fix it.

1 Like

Oh my god, how did you port this??
Anyways, i’ve given you a “shoutout” on my latest module. It works best with yours, sooo…
Anyways, thanks for this!

I feel like this is what happens when 1000 people hit you with Error in Slap Battles

Anyways, I dont think so for me. I’ll try it later and see what happens. But I think you should just use “CameraOffset” for now.

Does anyone know how to make the camera shake with a remote event with a tuple that says which preset is meant to be used?

fire the remote with

remote:FireClient(player, CameraShaker.Presets.Explosion)

and then have the client do

remote.OnClientEvent:Connect(function(preset)
      camShake:Shake(preset)
end)
1 Like

I used this in unity and it works just as well in Roblox. Really good stuff here.

1 Like