What is the best way to create bullet spread?


Like in the Unturned II devblog#1.


Woah, we have a Gamedev section? I’m posting here now. Anyways it depends a bit on whether you are using raycasting or actual objects. The way I’ve always done it is to add a bit of randomness to the direction of the shot, and have the maximum random area it can shoot increase the longer you hold the trigger down.


This is also how I do it, but I don’t usually have it increase. I am not a fan of that much bloom.


Here is my idea (raycast method):

  1. get player aim direction (it will probably be in a vector, just convert ti to rotator)
  2. make a new rotator with random small values on each axis
  3. add it to player aim direction to get the bullet direction
  4. convert the bullet direction to vector
  5. multiply the vector by the range of your gun
  6. raycast to that multiplied vector location
  7. get hit result
  8. do whatever you need to do with it


Best way to do bullets? plz experts