If you’ve ever played the Roblox game Nullscape, one of the first ever enemies you’ll encounter is this bell (footage not mine, credit’s to @GhoulFMJ on Youtube):
It doesn’t kill you, however, when you touch it, your camera shakes in a really trippy way. I’m just really fond of it, so I wanted to try recreating it.
Here’s my recreation:
I recreated the effect by applying a sine wave that slows down to a halt at 3 seconds, to:
- an applied
CFrame.Angles()to the camera - the camera’s
FieldOfViewproperty
I’m pretty sure this is how they were able to do the effect of objects “tilting in proportion”. Here’s the code I used for the effect:
local TWS = game:GetService("TweenService")
local RNS = game:GetService("RunService")
local camera = workspace.CurrentCamera
local renderConn
local ratioValue = Instance.new("NumberValue")
local function Shake()
ratioValue.Value = 1 -- set to default value
local tween = TWS:Create(
ratioValue,
TweenInfo.new(3, Enum.EasingStyle.Quart, Enum.EasingDirection.Out),
{Value = 0}
)
tween:Play() -- tween to 0 to replicate the "slowing down to a halt" effect
tween.Completed:Once(function()
renderConn:Disconnect()
end)
-- apply sine wave + ratioValue to applied CFrame.Angles() and camera.FieldOfView
renderConn = RNS.RenderStepped:Connect(function(deltaTime)
local sinWave = (1 * ratioValue.Value) * math.sin(5*os.clock())
camera.FieldOfView = 70 - (60 * ratioValue.Value)
-- extra note: im also pushing back the camera to minimize the "zooming in" effect of the FOV
camera.CFrame *= CFrame.new(15 * sinWave, 0, (30) * ratioValue.Value) * CFrame.Angles(math.rad(1 * sinWave), 0, math.rad(10 * sinWave))
end)
end
while true do
Shake()
task.wait(4)
end
It might not be the most accurate, you’d just have to tinker a bit more with the values.