Hello everyone, I’m back again. This time, I want to make a screen shake system similar to that found in YBA. Unfortunately, I’m not sure exactly how it’s done. From this example:
https://streamable.com/ sw01x1
It seems like the camera is being rotated instead of moved around like in other games for screen shake. I’ve attempted to emulate it with this:
local StartTick = tick()
local Character = Player.Character
local Humanoid = Character.Humanoid
while tick() - StartTick < TotalDuration do
local ShakeRotation = Vector3.new(math.random(-Intensity, Intensity), math.random(-Intensity, Intensity), math.random(-Intensity, Intensity))
local TargetCFrame = CurrentCamera.CFrame * CFrame.Angles(math.rad(ShakeRotation.X), math.rad(ShakeRotation.Y), math.rad(ShakeRotation.Z))
local CameraTween = TweenService:Create(CurrentCamera, TweenInfo.new(ShakeDuration), {CFrame = TargetCFrame})
CameraTween:Play()
wait(ShakeDuration)
end
But it causes the camera’s rotation to snap back to it’s base position at the start of every tween. On top of that, I can’t think of a way to have it go back to it’s normal position since if the player rotates their camera manually during it it’d snap back to the position before they moved it during the shake.
Is YBA’s Screen Shake really rotational? If so, how can I recreate it, fixing the aforementioned problems?