Download

CS:GO like spread

Hello,
I was trying to create a little recoil system as in the one used in CS:GO
I got a primary result with using the add controller Pitch/Yaw input but it was completly random

f394ac87adbd99617dcf95d120dd8098ab6b176a.jpeg

Can anyone pls help me with an idea on how to get a more custom recoil pattern as in this gif to have the same result each time instead of a new one?

M4A4-Spray-Pattern.gif

Hi,
Use tick and node “random unit vector with yaw and pitch” (i dont remember exactly name of that node)

In every fire input, increase float variable and plug that variable into pitch and yaw, with this you will shoot in random circle, set ofc some clamp value to that float and in tick continuously decrease that float value. If you want recoil to put your crosshair up, add pitch input to controller… (imo 10x pitch and 1-2× yaw for more realistic recoil.)

wouldn’t be a bad practice to use event tick for such a thing?
can’t i do it with a timeline and a lerp or something like this?

ofc you can, timeline is ideal i think, only be sure that it will be properly fired after every shot, and reset that float on respawn i think…

You need a three dimensional plot of some sorts, where one of the axis is time. The other two axis would represent the amount of recoil in X and Y directions.

Nonono.
If I was you, I’d put your spray Pattern in a curve (Vector/2D Vector).
Store it in your weapon.
In your player, store a variable called “recoil”, preferably a float in [0,1]
In your weapon, store a variable called "recoil falloff " again as a float in [0,1].
In your weapon, also store a variable called “recoil effect”, preferably [0,1/amount of bullets in round]
In your player Event Tick, “recoil” is decreased by recoil falloff of your currently equipped weapon.

Whenever the player shoots, get the position from your recoil curve with your current “recoil” and add “recoil effect” of your weapon to the current “recoil” of the player.
Add the value from the curve at the specified position to your player View

This is an idea I came up now. It certainly is not the CSGO-Spray algorithm, but it’s a start…

thnx for the explanaition, i’ll try it and repost the results