Hello! I was following an tutorial to get more experience on some functions and decided to make my own recoil system. It is a lot primitive yet, i don’t have much time but i’m implementing.
All done using C++, but in the editor you can edit: Fire rate, recoil strength, recoil direction and the time to reset recoil.
Some primary rules on the system:
If you have stopped to shoot, quickly changed your target and started to shoot again before the reset time has finished, the recoil will follow your previous spray. So you need to wait the time becomes zero to shoot again with the recoil going only up. (Like in the video.)
You can hold the left mouse button to get a automatic shoot, but if you click every time, only will fire agreeding your fire rate. (First example in video)
Pistol doesn’t have the automatic function, if you hold the button, will shoot one time and nothing more. You have to click. (Only will shoot agreeding your fire rate²)
If you think that can be more “randomized”, the idea its more skill and less luck, on the video, the recoil strength is not much but i can’t control perfectly, it’s linear but if you try to control, becomes randomized. The game i’m planning don’t have too much close distances, so, the strength don’t need to be so high.
Edit: The change of direction is much accentuated for debug reasons. You can make it softly.