Hand-Held camera shake

Hi, I’m trying to make a cutscene, and it feels stiff, so camera shake will do the thing. I want it to be like a movie camera where there’s a slight camera shake, a bit like the “Original” version on this clip: I Fixed the Shakey Cam in Obi-Wan Kenobi in Less Than 5 Minutes - YouTube

Anything will help.

Calculate an arbitrary point straight in front of the camera, adjust that point using a random vector, such as a vector whose components are a bunch of random frequency sine waves. Re-aim the camera at this updated vector.

It’s currently 11 pm and I don’t want to think about what I’m writing, but I managed to make something that works. I used the spring module to make it more smooth.

4acff57873a89934ed211025bb0dd515

b0234347065a63e8e5a5806a2e6f453c

Here’s the script (with the spring module):
LocalScript.rbxm (3.3 KB)

Or you can look at it here if you want:

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

local camera = workspace.CurrentCamera
local Spring = require(script.Spring)

local CameraSpring = Spring.new(Vector3.zero)
CameraSpring.Speed = 10
CameraSpring.Damper = 0.75

local speed = 3
local intensity = 0.1
local z = -2

local random = Random.new()

RunService.RenderStepped:Connect(function(dt)
	local t = os.clock()
	local x, y = math.cos(t*speed) * intensity, math.sin(t*speed) * intensity

	CameraSpring.Target = camera.CFrame.Position + Vector3.new(x, y, 0)
	camera.CFrame = CFrame.new(CameraSpring.Position, CameraSpring.Position + Vector3.new(x*0.95, y*0.95, z))
end)

P.S. I think it won’t let you rotate the camera though.
You can just add your camera rotation here:

4 Likes

thanks a ton, works amazing and just what i needed!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.