- Home /
Question by
Magi4ever · Apr 12, 2014 at 04:12 PM ·
javascriptparticlesskyboxrain
Rain Particle random start
I have an asset that i downloaded that is for rain that uses this code
var burstEnergy : float = 10.0;
var explosionObject : Transform;
function LateUpdate () {
var theParticles = particleEmitter.particles;
var liveParticles = new int[theParticles.length];
var particlesToKeep = 0;
for (var i = 0; i < particleEmitter.particleCount; i++ )
{
if (theParticles[i].energy > burstEnergy)
{
theParticles[i].color = Color.yellow;
// We have so much energy, we must go boom
if (explosionObject)
Transform.Instantiate(explosionObject,
theParticles[i].position,
Quaternion.identity );
} else {
liveParticles[particlesToKeep++] = i;
}
}
// Copy the ones we keep to a new array
var keepParticles = new Particle[particlesToKeep];
for (var j = 0; j < particlesToKeep; j++)
keepParticles[j] = theParticles[liveParticles[j]];
// And write changes back
particleEmitter.particles = keepParticles;
}
How can i make this particle start randomly. Also how do i make the skybox change from the sunny day to a different skybox?
Thanks!!
Comment
"Also how do i make the skybox change from the sunny day to a different skybox?"
Please keep your questions to a single issue. Open this as a separate question or do some searching on UA. Changing the skybox has been covered before.