• News
• About

• Industries

• Learning & Support

• Community

• Marketplace

Download

# Bullet Spread Math

I Am trying to make a dynamic bullet spread for a 2d shooter that can handle a shotgun blast to a full 360 shot pattern. I got this far.

](filedata/fetch?id=1822279&d=1602712388)

I have a Vector that holds the variables I need. Z= The amount of bullets shot, Y= The angle of the spread, X= The Start rotation point of the shots. The for loop will place the Arrow relative to its own position at the start for each shot (Spread X) then evenly rotate the arrow to from Start (X) To End (Y) , (Z) amount of times.

The result should be with X=337.5, Y= 45, Z=4. A 5 shot burst over a 45 degree angle centered from where the arrows start position is.
X=0, Y= 360, Z=3. A shot from each rotation point at 0,90,180 and ,240 degrees
X=45, Y= 360, Z=3. A shot from rotation point at 45,135,225 and ,285 degrees
X=0, Y= 360, Z=360. A shot from all rotation points from 0 to 359 degrees

Any help with this would be appreciated including advice on how to accomplish this a different way.

Only comment I have is that a for loop can take forever when dealing with shooting microseconds count…

Based on muzzle, the spread can vary a lot.
At the same time, time and movement is a factor, since you can spread shot in a wave like pattern if you know how to shoot.

The best approximation may be several projectiles over .1 sec. Or so. With variable spread.

The microseconds wont matter much it’s a top down 2d shooter like the old 1942 game. I already have the mechanics in place to add the velocity of the shooter or not. I am just trying to make a dynamic blueprint instead of a bunch of child blueprints for each pattern type. The math I need would be something like
i= Index;
Firing Degree = i*y(x-(z/y));
Maybe a cos or sin in there somewhere, I really have no idea. I’ll leave this up for a while and if I can’t get it figured out ill just do the multiple Blueprint thing.

I’d Just add it some random values maths… :rolleyes: Good luck

Solved it. So if anyone is trying to do something similar that involves calculating an even spread in a rotation, here it is.

*Note - To do a 4 shot spread in a cross formation it’s X=0 Y=270 Z=3