Welcome, Guest
Want to take part in these discussions? Sign in if you have an account, or apply for one below
-
- CommentAuthorven
- CommentTimeJan 4th 2011
I'm trying to rotate particles (mine are squares, have 64 of them) during an explosion. Everything works except rotation. Any suggestions, I did read the past posts on rotating in 3D, and thought I was implementing enough to get rotation working in 2D. Thanks.
-ven
// create particles from our existing objects
var particles:Array = Particle2DUtils.createParticles2DFromDisplayObjects( squares);
// add particles
emitter.addExistingParticles( particles, false );
// add renderer
var renderer:DisplayObjectRenderer = new DisplayObjectRenderer();
renderer.addEmitter( emitter);
addChild( renderer );
// set up the explosion - good to play with explosion strenght, depth and epsilon
emitter.addAction(new Explosion(5, (INIT_X + (width + SPC) * 4) - ((width + SPC) / 2), (INIT_Y + (height + SPC) * 4 ) - ((height + SPC) / 2), 300, 2)); // set up explosion
emitter.addInitializer( new RotateVelocity( 0, Math.PI / 2) );
emitter.addAction( new Rotate() );
emitter.addAction( new Move() ); // set to objects to move
emitter.start(); -
- CommentAuthorRichard
- CommentTimeJan 4th 2011
You've added the RotateVelocity initializer after adding the particles, so it is too late to initialize the particles then.
You need to set up the emitter first, with its initializers and actions. Then add the particles, setting the second parameter in the addExistingParticles method to true to indicate that the initializers should be applied to the particles. Then start the emitter.
1 to 2 of 2
