1
\$\begingroup\$

I want to create an equation determining how fast a gun recovers back to its center after it has fired. I have a weapon system functioning based on constants (recoil amount, bullet spread, etc.) similar to modern FPS games. The weapon system is creating great realistic recoil and bullet spread when the weapons are fired. However, at what speed should each weapon return back to its center?

How do I implement it realistically? Games such as Battlefield and COD have stats for Recoil Decrease and Centerspeed respectively, however how these stats are used to determine a time or speed at which the gun rotates itself back to zero mystifies me.

I am experimenting with using a simple lerp between the weapon's current rotation (caused by recoil) to its original rotation at zero. The issue is how to determine that rate at which it returns in a realistic way. Is there a common way that this is implemented?

\$\endgroup\$
  • \$\begingroup\$ These | similar | questions might help. \$\endgroup\$ – Anko Mar 9 '15 at 11:32
  • \$\begingroup\$ What exactly is the problem with your current lerp approach? Is it too harsh and linear? \$\endgroup\$ – Anko Mar 9 '15 at 11:32
  • \$\begingroup\$ The issue is trying to find a point of reference either from real world or game statistics. For example, do I set the lerp to complete in 0.2 seconds for a handgun but 0.1 for an AR because they are easier to control? Or should it be the other way around? I'm not sure where to begin and on what factors exactly recoil recovery should be determined. For example, in COD you have the stat Centerspeed which is supposed to represent the speed at which a weapon tries to return to its center/zero. But what are the units of this and how would you calculate the time taken to return to zero? \$\endgroup\$ – FrontEnd Mar 9 '15 at 11:47
  • \$\begingroup\$ @FrontEnd From a few minuets of googling it appears both COD and BF use an acceleration based system for both the recoil and the recovery so I would assume the unit is radians/(seconds^2). Also the recovery acceleration increases over time though it never quite matches the recoil acceleration. \$\endgroup\$ – ClassicThunder Mar 9 '15 at 20:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.