Camera shakes violently at high speeds

So I am making a project where you swing around buildings in a FFA and fight with swords, however, for this not to be bland, I want to add some camera effects. An idea that instantly came to my head was that whenever the player reaches a high speed while swinging the camera will shake more and more the faster they go.

I’ve already tried using the EZCamera plugin, however, the preset system etc is really new to me and I dont know how to operate it.

Other than that, I don’t know what else to add, so i’m really just wondering where to start off with this.

this reply is late ye ik

try this, this is not that good but at least it can do something
put it in StarterCharacterScript

local tween = game:GetService("TweenService")

local clamp = math.clamp
local cos = math.cos
local rng = math.random
local sign = math.sign
local sin = math.sin

local player = game.Players.LocalPlayer
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
local HRP = character:WaitForChild("HumanoidRootPart")

local startSpeed = 20 -- Set the starting speed before the shaking starts
local intensity = 0.3 -- Set the intensity multiplier of the shaking
local shakeSpeed = 10 -- Set the speed of the shake, higher value means faster
local maxOffset = 0.5 -- Set the max offset of the shaking
local controlledSide = true -- Use this if you want the side(left/right & up/down) of the camera to be controlled by the script or to be randomized

local dead = false

local oldPos = HRP.Position
local distance, xOffset, yOffset, t
intensity = intensity*100

local tweenInfo = TweenInfo.new(1/shakeSpeed - 0.01, Enum.EasingStyle.Linear, Enum.EasingDirection.In)

humanoid.Died:Connect(function()
	dead = true
	wait()
	tween:Create(humanoid, tweenInfo, {CameraOffset = Vector3.new(0,0,0)}):Play()
end)

local function controlSides()
	if not controlledSide then return end
	t = tick()
	xOffset *= sign(cos(t*5 + 1))
	yOffset *= sign(sin(t*6 + 1))
end

while not dead do
	distance = ((HRP.Position - oldPos).magnitude)*shakeSpeed
	
	if distance >= startSpeed then
		if not controlledSide then
			xOffset = clamp(rng(-intensity,intensity)/100 * (distance - startSpeed)/10, -maxOffset, maxOffset)
			yOffset = clamp(rng(-intensity,intensity)/100 * (distance - startSpeed)/10, -maxOffset, maxOffset)
		else
			xOffset = clamp(rng(0,intensity)/100 * (distance - startSpeed)/10, -maxOffset, maxOffset)
			yOffset = clamp(rng(0,intensity)/100 * (distance - startSpeed)/10, -maxOffset, maxOffset)
			controlSides()
		end
		
		tween:Create(humanoid, tweenInfo, {CameraOffset = Vector3.new(xOffset,yOffset,0)}):Play()
	else
		tween:Create(humanoid, tweenInfo, {CameraOffset = Vector3.new(0,0,0)}):Play()
	end
	oldPos = HRP.Position
	wait(1/shakeSpeed - 0.01)
end
1 Like

Personally, I am a sword fight clanner. I have my camera sensitivity to 7.6. I do agree that shaking your camera constantly all of a sudden can cause reach.

1 Like