Flint Particle System Forum - How to spin/rotate a sphere of existing particles in an emitter? Sun, 11 Dec 2011 11:28:18 +0000 http://flintparticles.org/forum/ Lussumo Vanilla 1.1.10 & Feed Publisher How to spin/rotate a sphere of existing particles in an emitter? http://flintparticles.org/forum/comments.php?DiscussionID=492&Focus=1656#Comment_1656 http://flintparticles.org/forum/comments.php?DiscussionID=492&Focus=1656#Comment_1656 Thu, 23 Jun 2011 16:24:17 +0100 RPath An example of what I'm going for is here: http://professionalpapervision.wordpress.com/2009/04/22/flash-cs4-planetarium-in-49-lines/
I'll eventually be placing a number of the spheres in 3D space and want them all spinning individually, so using the OrbitCamera isn't an option. "Pure AS3" code follows:

package
{
import flash.display.Sprite;
import flash.geom.Rectangle;
import flash.geom.Vector3D;

import org.flintparticles.threeD.emitters.Emitter3D;
import org.flintparticles.threeD.renderers.PixelRenderer;

[SWF(width='500', height='500', frameRate='31', backgroundColor='#000000')]

public class ParticleSphere extends Sprite
{
private var emitter:Emitter3D;
private var renderer:PixelRenderer;

public function ParticleSphere()
{
emitter = new Sphere();
renderer = new PixelRenderer( new Rectangle( 0, 0, 500, 500 ), false );
renderer.camera.dolly( -300 );
renderer.addEmitter( emitter );
addChild( renderer );
emitter.start( );
}
}
}

package
{
import flash.geom.Vector3D;
import org.flintparticles.common.counters.Blast;
import org.flintparticles.common.initializers.*;
import org.flintparticles.threeD.actions.Move;
import org.flintparticles.threeD.activities.RotateEmitter;
import org.flintparticles.threeD.emitters.Emitter3D;
import org.flintparticles.threeD.initializers.*;
import org.flintparticles.threeD.zones.SphereZone;

public class Sphere extends Emitter3D
{
public function Sphere()
{
counter = new Blast( 250 );

addInitializer( new ColorInit( 0xFFCCCC00, 0xFF00FF00 ) );
addInitializer( new Position ( new SphereZone( new Vector3D( 0, 0, 0 ), 50, 0 ) ) );

addAction( new Move() );

addActivity( new RotateEmitter (new Vector3D(0,10,0),2));
}
}
}

- Rich P. ]]>
How to spin/rotate a sphere of existing particles in an emitter? http://flintparticles.org/forum/comments.php?DiscussionID=492&Focus=1667#Comment_1667 http://flintparticles.org/forum/comments.php?DiscussionID=492&Focus=1667#Comment_1667 Fri, 15 Jul 2011 17:40:06 +0100 Richard