|Topic was automatically imported from the old Question2Answer platform.
I’m making a shotgun type thing for my FPS, and I need to fire several bullets in a single frame. The problem is that calling randomize() randomizes the seed based on the current frame, so the rand_range() that I’m using to determine the bullet direction just fires them all to the same place. Any help is appreciated, thank you guys!
Why not first determine where all the buckshot is suppose to go, and then have the shotgun fire? Change all of the vectors of the buckshot’s pellets, and then let them fly. Also, are you calling
randomize() frequently in your script? Because the function is meant to be called once.
Ertain | 2020-09-07 09:42
I think you’re saying that i should have the vectors determined before the shotgun is fired. I think that this will work, as I only need eight different vectors, and the firing animation ensures that you won’t be able to fire twice in the span of eight frames. So I should be able to generate them right after the shotgun is fired, and then use those vectors the next time the shotgun is fired.Thank you, I’m gonna go test that out.
yortoisethetortoise | 2020-09-07 12:42