I have this script that shakes your camera on the x, y and z axis. I want the camera to shake on the z axis the most and less on the other two so it is more realistic. I turned the intensity of the shaking up so I can show you guys my problem.
here’s my code:
local camera = workspace.Camera
local intensity = 20
local speed = .25
local function LerpCameraRotation(speed:number, rotation:CFrame)
task.spawn(function()
for i = 0, 1, speed do
local targetCFrame = camera.CFrame * rotation
camera.CFrame = camera.CFrame:Lerp(targetCFrame, i)
task.wait()
end
end)
end
while task.wait(speed/5) do
local rotationX = Random.new():NextNumber(-intensity, intensity)/100
local rotationY = Random.new():NextNumber(-intensity, intensity)/50
local rotationZ = Random.new():NextNumber(-intensity, intensity)/50
LerpCameraRotation(.25, CFrame.Angles(math.rad(rotationX), math.rad(rotationY), math.rad(rotationZ)))
end
Here’s a video:
As you can see the screen only shakes on the x axis when the camera type is set to scriptable. This is a big problem because I want it to shake the most on the x axis. I assume this might just be a studio feature but im not 100% sure.