So I have a simple FPS weapon system. It works by setting the camera subject to a part, and locking the player in first person while letting them control their own camera, no custom camera implementation. I have a gun viewmodel that is updated every frame to the CFrame of the camera.
Just a little background.
Each time the player fires the gun, camera recoil is applied. Currently, I add an offset to the existing camera’s CFrame, like so:
world_camera.CFrame *= CFrame.Angles(0, math.rad(recoil), 0)
This is actually really choppy and makes the gun hard to control with weapons that have higher recoil values, because the offset is simply higher.
I’ve tried a bunch of options, but nothing really worked well…using lerp was the closest thing I’ve got, but I feel like my entire logic for applying recoil is off. And some one gave me a good point, the weapon should also sling back to its original position, not just increasing in angle every time you fire it.
In a nutshell, I’m trying to smoothen this recoiling effect so it’s easier to aim.
Any help appreciated, thanks