Quantcast

[FIXED] Better Camera Shake V4 (Pseudo-random noise generation | W/ cam rot, fov, magn, fade)

Cyclically's Camera Shake V4

Simple camera shake script I made that uses perline noise for smooth shake transitioning unlike the old one you all use. Keep in mind that this must be put in a LocalScript

ok so many updates but this one is final. yeah this one is the real deal, perlin noise camera shake unlike those other trash fe2 camera shake. imagine just randomizing ur camera offset everywhere and call it a shake effect LOL
--// Cyclically's Camera Shake V4
local function shakeCam(strength, magnitude, fade, duration) -- Strength: Strength of the shake | Magnitude: Speed of the shake | Fade: How slow the shake fades away | Duration: Duration of the shake effect
	local lp, saveTick, getnoise, fade, trauma, fov, r1, r2, r3, r4, r5 = game.Players.LocalPlayer, tick(), function(...) return math.noise(...) * 2 - 1 end, math.clamp(fade, 0, duration), strength, workspace.CurrentCamera.FieldOfView, math.random() * math.random(-1, 1), math.random() * math.random(-1, 1), math.random() * math.random(-1, 1), math.random() * math.random(-1, 1), math.random() * math.random(-1, 1)
	if lp.Character and lp.Character:FindFirstChild("Humanoid") then
		spawn(function()
			repeat
				local cduration, shake = tick() - saveTick, math.pow(trauma, 2)
				workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame * (CFrame.new(Vector3.new(getnoise(r1, cduration * magnitude), getnoise(r2, cduration * magnitude), getnoise(r3, cduration * magnitude)) * shake) * CFrame.Angles(0, 0, (getnoise(r4, cduration * magnitude) * 0.1 * shake)))
				workspace.CurrentCamera.FieldOfView = fov + getnoise(r5, cduration * magnitude) * shake
				if cduration < duration then
					local dT = game:GetService("RunService").RenderStepped:Wait()
					trauma = math.clamp(trauma - (saveTick * trauma / math.clamp(tick() - fade, 0, tick())) * dT, 0, strength / 5)
				end
			until cduration >= duration
			workspace.CurrentCamera.FieldOfView = math.ceil(fov)
		end)
	end
end
while wait(2) do
	shakeCam(5, 10, 2, 2) -- Shake the camera with the given parameters.
end

Test out the shake here: https://www.roblox.com/games/3881670490/Camera-Shake

Perlin noise is the foundation of many procedural texture and modelling algorithms. It can be used to create marble, wood, clouds, fire, and height maps for terrain. It is also very useful for tiling grids to simulate organic regions, and blending textures for interesting transitions.

Shaking effects—either generated randomly or through pseudo-random noise—can be used for more than just camera impacts. A lower frequency noise can simulate a handheld camera. UI elements can benefit from shake as well; added to dialogue text, the jittery motion can create a sense of fear or panic, while player health indicators can shake each time damage is taken.

3 Likes

Ok cool

Ok cool

I am going to test this out
And give credits since i’m not mean
yep i am going ot start to make better scripted games soon, i just need the time :confused:

1 Like

Ok cool

Ok cool

Ok uncool

Ok very cool

Ok coolio

Ok coolers

Ok coolestio

Ok coolestial

what is happening lmao

Ok I’m cool and I played in your VIP server when it was your B-Day and you friended me :sunglasses:

“an inside joke.” -sowonpai, 2019

1 Like

Ok coolombicosidodecahedron

Ok Cyclicoolio

Ok coolumbia

Ok Coolkidclub

Ok coolesian