I’ve recently been working on a viewmodel and I’ve gotten to the part of giving the gun recoil whenever it shoots. This is currently the code I have:
camera.CFrame = camera.CFrame:Lerp(camera.CFrame * CFrame.Angles(math.rad(3),0,0),0.1)
This produces a very skippy recoil as seen here:
I’ve read over a couple of posts on this and multiple have suggested using springs. I’ve never worked with springs or any module for that matter. I’m not sure what module I should use and how to even import the module into studio. I’ve tried taking other code from the forums and changing it so it would work in my situation but I just can’t seem to make the recoil smooth.
1 Like
I use BlackShibe’s spring module because he made the FPS framework tutorial…
www.roblox.com/library/5692144533
you get the module, do spring.create() with a bunch of parameters and stuff, then spring.shove to push it in a vector3
How do I import the module into the game? Again, I’ve never worked with modules so I don’t know anything about importing them
get the module so you own it, then go to toolbox, then inventory and under models you should see it
Oh, I thought there’d be a bit more work to it and not just requiring the modulescript. Alright, I’ll look into it thanks!
kartof_dev
(kartof_dev)
October 16, 2022, 10:41am
#6
I am very late but you can just use tween service and tween the cframe
You can’t, when I tried that my camera would tween to the angle but it would stay at its CFrame position to where you started the tween.
So your camera would just stop moving with your character until the tween was over.
1 Like