It seems that I cannot set a particle's position. This script creates particles but leaves them all at the emitter's origin.
I tried to add a `Debug.Log(p.position)` after the `PlaceParticle` call and it seemed to be spouting off correct values. But I end up with thousands of particles in the same exact spot on screen when this runs.
private var density : float = 0.5;
private var height : float = 100;
function Start() {
yield WaitForSeconds(0.1);
var radius = Stage.stage.radius * 1.5;
var area = Mathf.PI * radius * radius;
var count = density * area;
particleEmitter.Emit(count);
for (var p:Particle in particleEmitter.particles) {
PlaceParticle(p, radius);
}
}
function PlaceParticle (particle : Particle, radius : float) {
particle.position = transform.position + Vector3(
Random.value * radius,
Random.value * radius,
Random.value * height
);
if (particle.position.magnitude > radius) {
PlaceParticle(particle, radius);
}
}
Any ideas?