Hoping I can get a bit of help because my brain is fried :(
I'm putting together a particle system to generate an explosion. I'd
like a spherical distribution on the generated particles but can't seem
to get the maths right to do it. I'm using the following initialisation
of the emitter:
rnd = 1 - randomiser.nextFloat() * variation;
float x_sign = randomiser.nextBoolean() ? 1 : -1;
float y_sign = randomiser.nextBoolean() ? 1 : -1;
float z_sign = randomiser.nextBoolean() ? 1 : -1;
float v_x = rnd * velocity * randomiser.nextFloat() * x_sign;
float v_y = rnd * velocity * randomiser.nextFloat() * y_sign;
float v_z = rnd * velocity * randomiser.nextFloat() * z_sign;
particle.velocity.set(v_x, v_y, v_z);
Visually the output looks like a cube - not exactly what I'm after. :(
Any hints on how to generate a proper sphere-looking output.
--
Justin Couch http://www.vlc.com.au/~justin/
Java Architect & Bit Twiddler http://www.yumetech.com/
Author, Java 3D FAQ Maintainer http://www.j3d.org/
-------------------------------------------------------------------
"Humanism is dead. Animals think, feel; so do machines now.
Neither man nor woman is the measure of all things. Every organism
processes data according to its domain, its environment; you, with
all your brains, would be useless in a mouse's universe..."
- Greg Bear, Slant
-------------------------------------------------------------------
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".