Announcement

Collapse
No announcement yet.

How to properly calculate shotgun spread?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • replied
    Shooter game has some spread code in it.

    Leave a comment:


  • replied
    6 concentric rings. Each bullet has a Min & Max dist from center, and a random 360. Less random, more control.

    Leave a comment:


  • replied
    Originally posted by ExtraLifeMatt View Post
    Random is random. You can get all 6 shots on the same point in theory. If you want it to respect distances between shots, you have to throw away values that are too close to already existing shots.

    For a fixed spread, you would just use sin/cos to build your shot points.

    You should look at Unreal Tournaments Flak canon code as that's essentially the same thing as a shotgun.
    I've implemented a function to make the spread "semi-fixed" random, dividing the spherical coordinates to multiple sections.

    By doing this, bullets are not close to each other, respecting the distance between bullets.

    Leave a comment:


  • replied
    Random is random. You can get all 6 shots on the same point in theory. If you want it to respect distances between shots, you have to throw away values that are too close to already existing shots.

    For a fixed spread, you would just use sin/cos to build your shot points.

    You should look at Unreal Tournaments Flak canon code as that's essentially the same thing as a shotgun.

    Leave a comment:


  • started a topic How to properly calculate shotgun spread?

    How to properly calculate shotgun spread?

    I'm currently using 6 bullets, and the spread is calculated using
    Code:
     FMath::VRandCone
    .

    Sometimes, bullets are too close to each other and, the target is receiving 3 or more bullets from far distance.

    So, the questions are

    1- Is it possible to make FMath::VRandCone respect a distance between each random value?

    2- If not, how do we create a fixed spread?
Working...
X