EZ Camera Shake ported to Roblox

You can put it anywhere a LocalScript can access, since you have to require it from a LocalScript. Somewhere like ReplicatedStorage works fine.

5 Likes

Ok, Thanks!

2 Likes

A little late, sorry, but I came back to this after deciding to not work with the horribly unreadable (microoptimized lollllllllllllll) version I wrote (it’s also a singleton :C )

What’s the use of having roughMod and magnMod versus just updating the Magnitude and Roughness properties?

2 Likes

I don’t remember, sorry. I pretty much translated this directly from C# to Lua without many modifications to the actual code logic. I might have some time tomorrow to look at it

5 Likes

Thank you for this! Looks VERY smooth!!! :heart_eyes::heart_eyes:

6 Likes

This is really interesting. I really appreciate your efforts to bring easily accessible things from the more mainstream third party platforms to Roblox. I hope myself and others help continue that effort!

3 Likes

Just a normal half-day at work for Crazyman32

11 Likes

How do you even use this module?

1 Like

I spent a good half hour trying to figure it out until I realized I needed to use camShake:Start() in order for any effects to run. Just look at his example code here and in the module.

1 Like

Sorry, yeah I based the API exactly from the original C# code. I probably could have made it a little more intuitive for Roblox. Maybe I’ll make a modification sometime soon that’s a bit easier to use!

3 Likes

It doesn’t work if I try to tween while it’s active so I had to disable it.

I have moved the code to a GitHub repository. Feel free to make pull requests to improve the code or submit issues for bugs that you find.

3 Likes

Small necro bump here but, how does magnitude & roughness effect things? I’ve been playing around with the module for a few days and I’m not really sure what magnitude & roughness controls/does.

Good question. It’s basically amplitude and frequency.

Magnitude = Amplitude. The outputted vector will be scaled with the magnitude. Essentially you will have a larger radius of movement. Code.

Roughness = Frequency (kind of). The algorithm uses perlin noise to generate the random movements, and the speed at which it scans through the noise function is scaled by the roughness. Code.

7 Likes

With Roblox’s faster Lua VM, it’s unnecessary to cache table access like local V3 = Vector3.new (doing so now incurs a minor performance penalty).

2 Likes

Since the code is on Github, you can submit a PR to fix it if you’d like. I wouldn’t recommend spending time on it if you have better things to be doing though – the performance difference is likely very minimal.

2 Likes

I have a plane taking off cutscene, and I’d like to make this as realistic as possible by including a minor shake effect. However, since the CFrame is already set every frame, will this mess it up? If so, how would I get around it?

1 Like

Sorry for the necrobump but is there a way to make it so the camera shake is consistent with FPS? In the GIF below, when my FPS is ~400, the camera shake moves the screen a lot more while when my FPS is 30, it barely moves the screen.

https://gyazo.com/6b68b44fe8c2bdd19cd6189c9133f0ef

8 Likes

That’s pretty strange, CameraShaker:Update scales based on time since last frame. Is the same problem present comparing say 30 fps to 60fps? I have never heard of having over 60 FPS in roblox forever, that sounds like something weird.

I believe the problem is still present even when comparing the shakes between 30fps and 60fps.

I’m using an fps unlocker to get my fps over 60.