Original Post
It doesn't seem like my fireflys are really spawning randomly... Here's the important bits of code:
#include <stdlib.h>
float random(void) {
return ((float)rand() / (float)(RAND_MAX+1));
}
void ffly::init() {
x=random()*2.0 - 1.0;
y=random()*2.0 - 1.0;
z=random()*-100.0;
} It seems that they are all spawning close to the 100.0 distance rather then being randomly spread out. If I change it to be higher, like to 1000.0, they are all grouped up down there instead... Also, Is there a better way to generate the X and Y? because the way I have it they have a smaller and smaller box to spawn in the further away you get... I want all of them spread out nicely all over, not just in a little rectangular prism. Note: Sorry for posting so much, I'm just starting this up today really, and I have lots of questions.