[v1.1.2] SpringShaker - Easy camera shaking manipulation using springs

SpringShaker


A physics-based camera shaker inspired by @Sleitnick’s RbxCameraShaker, built on a damped harmonic oscillator — giving shakes real weight, momentum, and natural decay.

ef06f8df692378192b0b317ab1f3cf76


Download — Documentation – Roblox Marketplace


Purpose

SpringShaker is a high-performance, client-side camera shaker designed to bridge the gap between complex physics and ease of use. Unlike traditional camera shakers that simply scale Perlin noise by a fade envelope, SpringShaker drives each shake through a damped harmonic oscillator — the same math that governs real pendulums and spring systems.

The result is camera motion with genuine mass and resistance: explosions that ring out naturally, earthquakes that swell and bleed off over time, and impacts that feel physically grounded rather than scripted.

This is my first official open-source package release. Proud to share it with both the DevForum and GitHub communities!


How to use?

A sustained earthquake that fades out smoothly after 5 seconds:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local SpringShaker = require(ReplicatedStorage.src.SpringShaker)

local Preset = SpringShaker:GetPreset("Earthquake")
SpringShaker:ShakeSustained(Preset)

task.delay(5, function()
    SpringShaker:HaltDurationWise(1) -- 1 second smooth fade out
end)

A custom mortar explosion using your own constructor:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local SpringShaker = require(ReplicatedStorage.src.SpringShaker)

local mortar = SpringShaker.new({
    Magnitude = 5,
    Roughness = 5,
    FadeInTime = 0,
    FadeOutTime = 1.8,
    Tension = 122,
    Damping = 13,
    RotationInfluence = Vector3.new(1.2, 0.5, 0.3),
})

SpringShaker:ShakeOnce(mortar)

Compare this to what other modules require — manual CFrame management and a secondary Heartbeat connection just to prevent camera drift at high FPS:

-- What you'd have to write with other modules
local camCf: CFrame
shake:BindToRenderStep(Shake.NextRenderName(), priority, function(pos, rot, isDone)
    camCf = camera.CFrame
    camera.CFrame *= CFrame.new(pos) * CFrame.Angles(rot.X, rot.Y, rot.Z)
end)
RunService.Heartbeat:Connect(function()
    camera.CFrame = camCf -- required to prevent drift at high FPS
end)

SpringShaker handles render priority, camera application, and drift prevention internally. Nothing to configure.


Installation

From GitHub:

  1. Download the .rbxm file from the latest release
  2. In Roblox Studio, go to File → Import Roblox Model and select the file
  3. Place it in ReplicatedStorage

From Roblox Marketplace:

  1. Find SpringShaker in your Toolbox
  2. Insert it directly into ReplicatedStorage

From Wally:

[dependencies]
SpringShaker = "nilleniumrust/springshaker@1.1.2"

NOTE: SpringShaker is client-only. Do not place it in server-side services such as ServerScriptService or ServerStorage.


Physics & Breakdown

The full API documentation is available on the documentation site.

SpringShaker uses a closed-form damped harmonic oscillator:

S(t) = F(t) · cos(√T · t) · e^(−D·t) · E(t)

F(t) — External noise force: (Pn(rumble) + 0.3 · Pn(jitter)) · Magnitude
cos(√T · t) — Oscillation driven by Tension
e^(−D·t) — Exponential decay driven by Damping (active only during fade-out)
E(t) — Cubic fade envelope: CurrentTime³

The Desmos graph shows how these combine in real time.

desmos

Think of it as a pendulum — the player’s camera is the pendulum bob. When F(t) fires, it gives the pendulum a violent push scaled by Roughness. The camera swings back and forth, losing momentum over time due to air resistance (Damping) and gravity (Tension). The result is physically convincing motion with a natural ring-down rather than an abrupt stop.

I highly do not recommend you set Magnitude above 10^5. This risks Resonance — a real physics phenomenon where the forcing frequency matches the system’s natural frequency, producing NaN values that cannot be rendered. SpringShaker detects and aborts this automatically.


Performance

Benchmarked in Play mode using os.clock() wrapping only the update cost — camera application excluded for fairness across all three modules.

SpringShaker — Native vs Non-Native

Instances Non-Native Avg Non-Native Peak Native Avg Native Peak
1 0.0039ms 0.0237ms 0.004ms 0.015ms
10 0.0135ms 0.0516ms 0.013ms 0.056ms
50 0.0558ms 0.2506ms 0.056ms 0.134ms
100 0.1093ms 0.1956ms 0.110ms 0.161ms
250 0.2804ms 0.6637ms 0.282ms 0.422ms

--!native provides ~25x faster per-call performance and ~28% less peak memory at scale.

Three-way comparison (all with --!native)

Instances SpringShaker RbxCameraShaker Shake
1 0.0054ms 0.0062ms 0.0081ms
10 0.0199ms 0.0159ms 0.0130ms
50 0.0636ms 0.0518ms 0.0355ms
100 0.1199ms 0.1032ms 0.0566ms
250 0.2822ms 0.2385ms 0.1369ms
1000 ~1.20ms ~0.88ms ~0.51ms

SpringShaker is the most physics-complete of the three at the cost of being the heaviest per frame. At 10 simultaneous instances — a realistic maximum for most games — total frame cost is under 0.02ms.

Memory at 1000 instances

Module Peak Retained after GC
SpringShaker ~2.5MB ~0KB
RbxCameraShaker ~0.6MB ~925KB
Shake ~0.6MB ~0KB

SpringShaker uses more peak memory due to richer physics state per instance, but releases everything completely on recycle. RbxCameraShaker retains ~925KB after GC consistently.


Presets

Preset Description
Explosion Violent initial shock that decays into heavy rumble
Landmine Sharp high-tension sting, stabilizes almost instantly
Earthquake Low-frequency rolling sway — ground liquefying feeling
Resonance Slow rhythmic wobble that builds over time
Bounce Soft fluid recoil with minimal roughness
Vibration Subtle continuous hum
ExplosiveBullet Fast sharp crack of a nearby hit
Rumble Low persistent ground vibration
Impact Sudden blunt force with quick ring-down

Special Thanks

Janitor v1.18.3 by @pobammer

17 Likes

Hey folks!

New update. [v1.1.1]

Fixed FadeOut cutting instantly due to RawTime being too large at time of call — introduced FadeOutElapsed so decay always slopes correctly from the moment halt is triggered
Fixed Halt performing a hard stop instead of routing through FadeOut
Switched physics from Semi-Implicit Euler integration to closed-form damped harmonic oscillator S(t) = F(t) * cos(sqrt(T) * t) * e^(-D*t) * E(t)
Added --!native to ShakerInstances — ~25x per-call speedup, ~28% less peak memory
Added FadeOutElapsed field to constructor
Fixed FadeIn incorrectly setting CurrentTime = 0 instead of 1 when Time == 0
Fixed IsDead crashing when Velocity is nil under new physics model
Added Rumble and Impact presets
Updated all preset values — reduced RotationInfluence ranges to prevent violent spinning
Added TripleBenchmark module comparing SpringShaker, RbxCameraShaker and Shake
Updated wally instances & API presentation
Fixed an issue where metatables did not accurately store Janitor and __PartnerLoop
Fixed an issue where upon parameters, the spring broke up effectively, shaking the camera in uncertain ways (no realism)
Fixed unstated formulas and unstable formulas which made springy effects effectively worse

Get the latest release: v1.1.1

Roblox Marketplace: (Temporarily unavailable for some reason)

marktplac lnk gon orr invald

Hi! Thanks for filling out the issue.

I am very sorry but the Roblox Marketplace link is temporarily unavailable due to false content restriction factors that limit my possibility to give out the link here. For now, you could just use the Download link for GitHub, and use the .rbxm and .rbxmx file.

The main reason behind restriction factors: Roblox AI falsely flagged my marketplace package and hid it so you couldn’t see it. I do not know what malicious factors were there, I did check everything but, for some reason Roblox still blocks it.

I’ll let you know when will it be available.

Version 1.1.2


What’s changed?

  • Added a new function of :ShakeIndividual() for individual instances that replicate on Shakes which do not use one PartnerLoop but has individual management. Specifically, it is very useful to those who want to have recoils, gun shakes, or other stuff.
  • Brandished API docs, and updated it.
  • Updated presets.lua to maximize and configurate the preferred settings. (Issue of rebounding/shaking too extremely fixed.)
  • Reverted mathematics & calculations to [v1.1] instead of new [v1.1.1] due to issues of oscillator fading
  • Added up noise + adhesive changes to the jitter and rumble features
  • Fixed FadeIn and FadeOut issues of switched mistakes

Good, but what’s new?


New function of :ShakeIndividual()

A small note; This function is still in pre-release state. Expect some bugs and issues. If you have any issues, please file here or open an issue page in GitHub

This is a short demonstration on how to use :ShakeIndividual() on such things as guns, recoils, other stuff.

local SpringShaker = require(path.To.SpringShaker) 
local SpringShakerPreset = SpringShaker:GetPreset("M2Recoil")
RunService.RenderStepped:Connect(function()
      --.. your rest code here. 
        if (...) then 
           SpringShaker:ShakeIndividual(SpringShakerPreset)
        end
end)

There is a new built-in preset for this called M2Recoil. It was added so you guys can also test how the SpringShaker really works in combat handled situations.


Re-enhanced presets.luau

One of the snappiest and buggiest area of all was presets.luau. Until then, it didn’t feel like smooth, so issues were resolved as I have correctly set it up from now. I have tested each of them. Here’s Earthquake for example, which is now fixed. (If you were using the function of :GetPreset()
628a8716071a35dc34158a77146fc12c

^ This is also using :ShakeSustained(), then stops it with HaltDurationWise().


Get it on GitHub: GitHub Release v1.1.2

Documentation: API Documentation

Unfortunately, I still cannot upload the Roblox Marketplace link here. It is because of Roblox flagging my packages without a clear reason. Also, apologies for rushed publishing in v1.1.1. I published it in 2:00 AM.

1 Like

Hey folks!
The Roblox Marketplace link is back. Now there’s no issue.
Also here’s a small demonstration from me using my module again:

Get it here on Roblox Marketplace: SpringShaker 1.1.2

Get it here on GitHub: SpringShaker 1.1.2

1 Like

Hello! I love SpringShaker’s ease of use. Would it be possible to add a way to influence the position of the camera like RotationInfluence?

Hi, thanks for the feedback!

There is a positional influence value in my code, but it is reserved and not used. I thought that the use was not necessary, but I will revert back my code to get the things up going for you.

Thank you so much! I’ve found that rotational influence can be nauseous for some players, and can mess up aim especially in games that use shift lock.

Hey folks,
New version has released. Version 1.1.3 - PRE-RELEASE UNTIL ROBLOX MARKETPLACE LINK IS AVAILABLE

Version 1.1.3


What’s changed?

  • The :ShakeIndividual() function is temporarily deprecated. Use of it can be allowed, it works, but it is not recommended for some time.
  • Added new PositionInfluence to the SpringShaker main functionality. It can now be used throughout this way.
  • Some code revamps and API fixes, debunks and other stuff.

Get it on GitHub: GitHub Release - v1.1.3

Documentation: API Documentation

NOTE: I do not know why, but the Roblox AI is so horrible that, it refuses to release my roblox models on the roblox marketplace after updating or publishing it. So I am stuck in this situation where I cannot properly upload. The Roblox Marketplace link will lead to v1.1.2, but v1.1.3 is just a pre-release here.

1 Like

No worries, I have updated my code now, and now it can use PositionInfluence as standard.

1 Like

Can there be a variant of this that does have a method of doing things similarly to this? The lack of any way for a developer to integrate it into their own custom systems (modules like this one are even useful for effects other than camera shaking too) makes this module extremely limiting and an immediate downside compared to the other modules you mention.

Hm. Very good idea. At first, I wanted SpringShaker to be friendly towards beginners and easily customizable. I didn’t expect it to be used by advanced forms, comprehensively, I’ll try to enroll the customization process if possible. Thanks for the feedback though!

1 Like