I am trying to make a camera wobble for a drunk state in my game. I am using camera cframe matrix alongside a tween in order to achieve this.
I am not getting the results I want and the camera seems to be going in a different direction to where I want it to go.
I haven’t been able to find much on this topic online or I am unsure where to look.
local Run = game:GetService("RunService")
local TS = game:GetService("TweenService")
local DrunkTweenInfo = TweenInfo.new(4, Enum.EasingStyle.Cubic, Enum.EasingDirection.InOut)
local Cam = game.Workspace.Camera
local LeftCamWarpData = CFrame.new(0, 0, 0, 1, 0, 0, 0.4, 1, 0, 0, 0, 1)
local RightCamWarpData = CFrame.new(0, 0, 0, 1, 0, 0, -0.4, 1, 0, 0, 0, 1)
local LeftCamWarp = TS:Create(Cam, DrunkTweenInfo, {CFrame = Cam.CFrame * CFrame.new(0, 0, 0, 1, 0, 0, 0.4, 1, 0, 0, 0, 1)})
local RightCamWarp = TS:Create(Cam, DrunkTweenInfo, {CFrame = Cam.CFrame * CFrame.new(0, 0, 0, 1, 0, 0, -0.4, 1, 0, 0, 0, 1)})
Run.RenderStepped:Connect(function()
while true do
LeftCamWarp:Play()
wait(3)
RightCamWarp:Play()
wait(3)
end
end)