First, I would recommend stepping away from your computer for a bit. Finding the closest firing range and going there and renting a handgun and actually squeezing off a few rounds to see what it actually feels like.
Even if you have gone shooting before, I would recommend going again, but this time take it from the perspective of an scientist rather than a shooter. Ask the guys there if you can bring in a video camera, and if they are okay with it then set the tripod up right over your right shoulder and pointed down range. Try firing at different speeds, keep your target sheets and mark test cases. When you are all done go back and review the footage of your shots and compare that to your results. I think if you do that you will glean a much better perspective of how this stuff should work.
Second, I would say there are really a couple core attributes involved
Kick Strength: The vector kick is actually straight backward from the barrel, not up or in any other direction. The reason a shooters aim drifts up is because you are holding the handle mounted beneath barrel, your arm becomes like lever; your body tries to stay still while the gun tries to move back. As the energy from firing the bullet is diffused into your body, your elbow and shoulder retract and your muscles flex to offset the energy.
Player Strength: This works to offset the kick. The stronger you are the less the kick causes your aim to drift. If you were to weld a handgun to the side of a battleship and fire it, its kick would effectively be offset by the mass of the ship. So player strength is inversely related to kick strength.
Another thing to point out is one vs two handed weapons. While a shotgun or rifle might have a much higer kick than say a medium calibur handgun. Because its stabalized with two hands, your effective strength is much higher. This should be taken in to account. Try (don't try actually) shooting a shotgun single handed and you'll see what I mean.
Player Aim: This represents the players ability to hit something they are aiming at. It represented by two components, speed and accuracy. This is manifested in games as the widening reticle widening while moving and the slowly settling when slowed or stopped, but its applicable to post recoil as well.
But there is another component here that is at play, muscle memory aiming. After you fire, you need to re-aim at your target. But you can usually do it a lot faster than it initially took you to aim because of muscle memory. Using your short-term muscle memory you can reset your aim close, but not perfect, to your intended target. Then from that position you correct your aim over time to get back to your maximum potential to aim.
This is one of those cases when it helps to go to range. If you focus on your gun sights you will be suprised how much your gun is actually waving around, even when trying to hold it still.
Using these properties, the pseudo-algorthm I would make for gun recoil would look something like this:
- Use
kick_strength - player_strength
to determine kick_magnitude
- apply
kick_magnitude
to a random up-ish unit vector as kick_aim_position
. [To simulate your body diffusing kick_strength
]
- Take
initial_aim_position
and use muscle_memory_accuracy
to determine distance and pick a new point that distance away from your aim as muscle_memory_aim_position
. [To simulate re-aiming using muscle memory only.]
- Lastly settle slowly back to your
inital_aim_position
. [To simulate correcting your muscle memory with visual input, aiming back at what you want to hit]