squarefeet / ShaderParticleEngine

A GLSL-heavy particle engine for THREE.js. Originally based on Stemkoski's great particle engine (see README)
http://squarefeet.github.io/ShaderParticleEngine/
MIT License
850 stars 115 forks source link

Random rotation of individual particles #114

Closed davidrichard23 closed 7 years ago

davidrichard23 commented 7 years ago

Hi, I'm having trouble figuring out how to give individual particles a random rotation direction and speed. Using Emitter.angle seems like I'm only able to set the rotation direction for all particles. The spread value is probably the answer but I'm not really sure of how to use it. Here's what I have:

angle: { value: [ -Math.PI, Math.PI ], randomise: true, }

mwcz commented 7 years ago

I got something similar working with the following:

            angle: {
                value: [0],
                spread: [2*Math.PI, 0],
            },

Each particle is spawned with a random rotation between -2Pi..2Pi radians, then spends its life rotating back to 0 radians.