Decreers
(Dec)
March 25, 2021, 1:04pm
#1
Hello! I’m currently working on a gun system, and I’m trying to make a camera recoil. Can anyone help me do that?
2 Likes
MrchipsMa
(MrchipsMan)
March 25, 2021, 1:10pm
#2
if you want to make a camera recoil through a part which i mean a viewmodel that has a camera bone in it then you can do renderstep for the Camera to copy the rotation of the viewmodel cameraBone if you are not making viewmodel just with tool or you dont want any camera bone then you can rotate the camera with a for i loops here are some post here that has good scripts
I have also tried making a camera recoil effect using TweenService, but that caused various problems, including the fact that the camera would be stuck in place when the tween played. My approach to this was to manually “simulate” the tween with a custom function.
This is what I attempted (I havn’t added recoil recovery yet though):
local function recoil()
local magnitude = recoilstats.Magnitude
--use magnitude = average*framecount
local numberofframes = recoilstats.Time*30 --run at 30 fps
…
If you’re into those “recoil patterns” then i’ve got a pretty nice script if you would like to use it.
Run = game:GetService("RunService")
--[[ This table controls the recoil that the gun will follow through each shot.
For example, {3, 12, -1, 0.77, -0.1}.
The way it works is the camera will move up by 12 for the first 3 shots of the gun.
After, it will move down by 1 (or up by -1 to be more technical).
The 0.77 is the alpha that will be used for lerping (how fast the recoil will move).
An…
3 Likes