Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Smoothly rotating the camera for recoil?

Asked by 5 years ago

This is my current code:

function recoil()
    local x = math.random(-gunData.recoil.x*100,gunData.recoil.x*100)/100
    local y = math.random(0,gunData.recoil.y*100)/100
    game.Workspace.CurrentCamera.CFrame = game.Workspace.CurrentCamera.CFrame * CFrame.Angles(math.rad(1)*y,math.rad(1)*x,0) 
end

This works pretty well, however the camera feels "jolty" and "clunky", is there a way to maybe lerp the cameras rotation without changing the CameraType to scriptable?

0
What's so bad about changing the CameraType to 'Scriptable'? TheOnlySmarts 233 — 5y
1
You may want to try tween, since they can take CFrames, they also move relatively smoothly SerpentineKing 3885 — 5y

Answer this question