How would I make reasonable and realistic gun spread?

I’ve looked for something like this in the devforum for so long, and couldn’t find anything.

Now I know how to make spread, it’s very simple, but what really gets me is making some sort of spread algorithm.

How the algorithm should work:

Stand still without aiming - default spread
Stand still and aim - better spread
Walk without aiming - terrible spread
Walk with aiming - okay spread
Spray down - bad spread

The easiest way, and the way I did it in my own game, is to check if these conditions are met. Example:

if humanoid.MoveDirection.Magnitude > 0 then
    --add more spread, example from my game:
    --spread += hrp.Velocity.Magnitude

if self.aiming then
    --decrease overall spread, example:
    --spread -= 5

something like this should work.

1 Like