Hey! I been trying to create my first gun system recently, I’ve used raycasting to detect if a player is infront, I’ve used UIS to detect inputs, I’ve made an ammo system, I’ve made a Semi system, I’ve done a lot no problem.
However, here comes my issues. Shiftlock system and Recoil. I’ve been trying to create Recoil and a shiftlock system, both being extremely smooth. I’ve been recommended springs, and I’ve done research for about a day now, I simply can’t find anything that tells me how springs work scripting wise and how I can replicate a shiftlock system smoothly and gun recoil with them. I’ve simply read posts about specific modules, however, I was wondering if I could create and learn it myself.
If anyone can help me out, preferably someone who has used springs for gun systems thank you.
to make the character face the camera use this.
put it in a renderstep or heartbeat
local rootPart = Character:FindFirstChild(“HumanoidRootPart”)
local rx, ry, rz = Camera.CFrame:ToOrientation()
rootPart.CFrame = CFrame.new(rootPart.CFrame.p) * CFrame.fromOrientation(0, ry, 0)
Should have been more specific, it’s also an Over the Shoulder thing, so it has to be on the right and can easily have it’s values changed to be on the left. I want to use a spring for this as I heard this is the smoothest way.
What they mean to search for springs is a spring like movement for the recoil which you can find in many topics by searching for recoil and look at many resources ( such as this cool module: Physics Based Spring Module by @bhristt ) with spring based scripts. You can integrate these resources into a script for your recoil.