Flint Particle System Forum - How to spin/rotate a sphere of existing particles in an emitter? 2011-12-11T11:11:51+00:00 http://flintparticles.org/forum/ Lussumo Vanilla & 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 2011-06-23T16:24:17+01:00 2011-06-24T13:15:41+01:00 RPath http://flintparticles.org/forum/account.php?u=191 Hello Richard & forum users - I have a (hopefully) simple question that I'm not finding a straightforward answer to elsewhere in the forum or in the example files. I'm trying to make a 3D emitter ... 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 2011-07-15T17:40:06+01:00 2011-12-11T11:11:51+00:00 Richard http://flintparticles.org/forum/account.php?u=1 The only option I can think of is the brute force approach - rotate all the particles. You'll need a transform matrix for the rotation and to apply it to the position vector of each of the particles.