JUST MY $0.02 ... My guess is that you probably need a (theta, phi) parameterization also. Assuming that the particles are exploding in the radial direction only, I might attempt something like the following:
xnew = xold + sin(theta) * cos(phi ) * delT * randomVelocityMagnitude ynew = yold + sin(theta) * sin(phi ) * delT * randomVelocityMagnitude znew = zold + cos(theta) * delT * randomVelocityMagnitude where theta is in [0, pi] and phi in [0, 2pi], with theta measured from the z-axis and phi from the x-axis. The values of theta and phi can be precomputed and applied repeatedly at each time step. Regards Vaidya >On Thu, 26 Dec 2002 21:43:32 -0800, Justin Couch <[EMAIL PROTECTED]> wrote: >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". =========================================================================== 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".