Fixed shotgun bullet spread, hardcoded or an equation?

I’m working on a FPS framework and I’ve had trouble with how to make a fixed bullet spread. obviously you could easily make random bullet spread by adding a weight of like 5 degrees on a shot, but I can’t figure out how to make a fixed bullet spread without hardcoding it.

All I want to know is what the equation would be.

fixed as in it isn’t random. It stays the same with every shot in a predictable pattern.

TL;DR (I know it’s not long but it’s confusing)
how to not hardcode fixed shotgun spread.

1 Like

You could create a spread pattern the first time the shotgun is shot, then cache it so that when it is shot again it can retrieve the first spread pattern

I could, but that still doesn’t help with making the bullet spread in the first place.

Here is a video created by @sleitnick about generating planets equally in a circular play area, if you skip to 14:25 then there will be an explanation of how something like this may be done and the principle word work with shotgun spread.

I actually figured this out. I did make a post on this:

With fixed spread, does that mean you code it by yourself? You can have a list of x/y orientations and iterate through that.

Here are a few articles that will no doubt help you with this. ^ And perhaps you could use something like math.random(lowerSpread, upperSpread) with a small interval in order to add some variation to it.

fixed spread as in it stays the same with every shot and is completely predictable.

1 Like

So basically like arsenal. Then using a table filled with Vector3s and calling CFrame:ToWorldSpace(CFrame.Angles(vector)). You might need to fill the vectors with radian measures instead of degrees, because CFrame.Angles() takes radians.

1 Like