Hi,
I have a strange bug occuring in my not yet finished game. For some
reason the particles I intend to use as flashes in a crowd of people
get added twice. It gets added on the location I want (on top of the
crowd), and on almost the same position only the negative position of
that. Also it looks like the 2nd added particles are not rendered
using the camera I specified in the scene, which made me think they
are added somewhere else. (The video will explain it better I think).

I''m using a custom very simple particle emitter, and a custom
particle class which extends the default particle class in away3d
lite. Latest SVN (from branches/lite/libs).

The custom particle class is just an extension on the default particle
with a lifetime var, which becomes zero when the particle is supposed
to 'die'. The particle emitter just checks that and removes it from
the scene. Below is a part of the code and a video which demonstrates
the bug.

video: http://www.youtube.com/watch?v=7_cI0aef_oU

>>>>> CODE
                //particles
                private var particles:Particles;
                private var particleMaterial:ParticleMaterial;
                private var bitmap:Bitmap;

                //sprite size, max sprites at one update, random position 
modifier
                private var max:int = 7;
                private var size:uint = 3;
                private var random:uint = 10;

                //list with sprites
                private var particlesList:Array;

                //on off switch
                private var emitting:Boolean;

                        if(emitting) {
                                for (var j:int = 0; j < max; j++)
                                {
                                        var _particle:TimedParticle = new 
TimedParticle
                                        (
                                                pos.x + (Math.random() * random 
- random/2),
                                                pos.y + (Math.random() * random 
- random/2),
                                                pos.z + (Math.random() * random 
- random/2),
                                                particleMaterial.clone(),
                                                true,
                                                physics
                                        )
                                        particles.layer = layer; //change this 
to constructor.
                                        particles.addParticle(_particle as 
Particle);
                                        particlesList.push(_particle);
                                }
                        }

                        //update all particles, destroy old ones
                        for (var i:int = 0; i < particlesList.length; i++) {
                                particlesList[i].update();
                                if ((particlesList[i] as 
TimedParticle).lifetimeCounter < 0) {
                                        
particles.removeParticle(particlesList[i] as Particle);
                                        particlesList.splice(i, 1);
                                }
                        }
>>>>> END


-- 
Subscription settings: http://groups.google.com/group/away3d-dev/subscribe?hl=en

Reply via email to