Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


How would you simulate gun recoil in a FPS ?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 jokoon   Members   -  Reputation: 101

Like
0Likes
Like

Posted 15 March 2012 - 05:59 AM

My goal is to remake the counter strike recoil feel, especially for automatic guns, and I'm having an hard time.

I was told on math.stackexchange with this function https://www.google.fr/search?aq=f&ix=hcb&ie=UTF-8&q=plot+5x*e%5E(1-5x)+from+0+to+1
which sort of simulate some sort of impulse, to tweak its quickness I just have to change '5' to something else, and it still results with something between 0 and 1.

For single shots it behave quite nicely, but with automatic guns in counter strike, the recoil sort of accumulate and adds up to an higher angle.

Any idea with some kind of equation or algorithm ?

Sponsor:

#2 softdev   Members   -  Reputation: 100

Like
0Likes
Like

Posted 18 March 2012 - 11:08 PM

By the looks of the plot in the link you provided, the curve looks right to what you said. I changed the 5 in the exponent to 9 and got the spike I think you are referring to. To cut a long story short, unless you have a downward force applied through whatever physics engine you use, it won't work. However it works perfectly fine if you simply limit the y with whatever you get for the result. So each gun can have a different limit. This would be up to you and how you are processing the recoil. Don't change the curve, the algorithm is fine. Just don't forget, that if you later want to use more accurate physics for the character (ie. 3rd person view), you are getting a visual translation as opposed to a gravity calculation.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS