How to create bullet spread?
I am just starting out in ue4 and i have no idea how to create bullet spread. At the moment i am spawning the bullet actor with the transformation of the camera that i am looking through so that it is spawned right in the middle. However, i would like the to spawn the actor in random locations along the camera to create the illusion of bullet spread.
asked Apr 11 '19 at 08:56 PM in Blueprint Scripting
if thats the case then you would just need to add a certain amount to your current spawn location. basically you take the spawn location you have then use a vector + vector, for the second value you will want to drag off the pin (drag left) and search for make vector. then for each of the y and Z plug in a random float in range, for the random you will want a min of say -30 and a max of 30 (you will need to tweak the values to your liking).
with all that said bullet spread is usually done for spread at distance, think shotgun where projectiles being at one point and spread as they move. since your spawning a projectile actor and presumably its just moving forward like the first person template, you would just need to add a slight adjustment to the rotation instead of location. it will be basically the same process as above but with rotators instead of vectors.
Edit: added picture. note i was working with third person so i added a little script to spawn the projectile in front of the character.
Follow this question
Once you sign in you will be able to subscribe for any updates here