How would you do it?
I already found this function for an impulse (helped by math.SE). It works for single shots, but not for automatic weapons.
Any ideas?
How would you do it?
I already found this function for an impulse (helped by math.SE). It works for single shots, but not for automatic weapons.
Any ideas?
Just combine the individual shots' impulses? Something like this:

You could of course add realism:
Particularly when firing on automatic, humans have a tendency to get used to the recoil. Basically, there is some factor that decreases the recoil impulse down to some point. The first shot recoils hard and the following shots add to the kick, but each with decreasing force, until some saturation in the soldier's capability for holding the gun steady is reached. This could be done with a function that modulates that impulse function based on the time since the last shot and the number of shots taken in the same chain of automatic fire.
A slight random factor is also always present in reality.
well basically, just have some kind of (semi-randomized) rotation that will cause the gun to jerk in an upward direction, and just apply it for every shot