Hello, simple topic ( i think ), I am making a screen… tilt thingy that uses cframe.angles to manipulate the camera.
However, the camera changes on the X and Y axis, but not on the Z axis.
– Code with camera moving on Y axis:
function screen_shake_(left, right, intensity) -- code for screen shake involving angles to left and right
local left_ = CFrame.Angles(0, math.rad(left), 0)
local right_ = CFrame.Angles(0, math.rad(right), 0)
local shake_left = camera.CFrame * left_
local shake_right = camera.CFrame * right_
camera.CFrame = shake_left:Lerp(shake_right, intensity) -- works
end
–Code with camera moving on Z axis:
function screen_shake_(left, right, intensity) -- code for screen shake involving angles to left and right
local left_ = CFrame.Angles(0, 0, math.rad(left))
local right_ = CFrame.Angles(0, 0, math.rad(right))
local shake_left = camera.CFrame * left_
local shake_right = camera.CFrame * right_
camera.CFrame = shake_left:Lerp(shake_right, intensity) -- doesnt work
end
Now, I COULD fix this by setting the CameraType to Scriptable, however, I need the camera to follow the player at all times because they could be moving while the tilt is happening.
Any idea on how I could make this work?
Thanks in advance.