hello gamers, worst camera manipulator to ever exist here
i have this bit of an issue, i think a video will explain it very greatly:
my recoil values look like this (ignore five seven):
local staticRecoil = {
-- // PISTOLS
M1911S = {
recoilStrength = CFrame.new(0.5, 1, 0.7),
kickTime = 0.2,
recoveryTime = 0.3
},
Glock18 = {
recoilStrength = CFrame.new(0.5, 0.5, 0.5),
kickTime = 0.3,
recoveryTime = 0.2
},
Fiveseven = {
visualRecoil = -1
},
DesertEagle = {
recoilStrength = CFrame.new(2, 3, 2),
kickTime = 0.2,
recoveryTime = 0.8
},
oh notsad you stupid, why not just lower the values?
that’s the issue, even if i set the values to like a decimal number (0.2, etc.), the result is either the same, or even stronger
idk what i’m doing wrong plesae help me :(((
function recoilModule:ApplyRecoil(camera: Camera, gun: Tool)
-- get recoil values
local recoilStrength: CFrame = recoilValues[gun.Name].recoilStrength
local recoveryTime: number = recoilValues[gun.Name].recoveryTime
local kickTime: number = recoilValues[gun.Name].kickTime
-- initialize camera cframe, if it's nil
if not initialCameraCFrame then
initialCameraCFrame = camera.CFrame
end
-- setup targetCFrame
local targetCFrame = camera.CFrame * recoilStrength
-- setup times
local timeElapsed = 0
local lerpFrequency = 0.01
-- lerp the camera on intervals
while timeElapsed < kickTime do
-- increment the timeElapsed by lerpFrequency
timeElapsed += lerpFrequency
-- calculate alpha, cap to 1 because lerping alpha caps out at 1
local alpha = math.min(timeElapsed / kickTime, 1)
local pointToLookAt = CFrame.lookAt(camera.CFrame.Position, targetCFrame.Position)
camera.CFrame = camera.CFrame:Lerp(pointToLookAt, alpha)
task.wait(lerpFrequency)
end
-- after all is done, set the camera to be on that cframe
camera.CFrame = CFrame.lookAt(camera.CFrame.Position, targetCFrame.Position)
end
where are my cframe goats