Flint Particle System Forum - how to take away3d primitive as a particle? Tue, 13 Dec 2011 03:05:17 +0000 http://flintparticles.org/forum/ Lussumo Vanilla 1.1.10 & Feed Publisher how to take away3d primitive as a particle? http://flintparticles.org/forum/comments.php?DiscussionID=474&Focus=1604#Comment_1604 http://flintparticles.org/forum/comments.php?DiscussionID=474&Focus=1604#Comment_1604 Mon, 18 Apr 2011 09:44:57 +0100 jack1505 I am learning to develop a 3d program with away3d and flint. Can I create custom particles based on the primitives (for example, a polygon)? I got the error message that away3d.primitives::RegularPolygon@3b5f971 can not be converted to flash.display.DisplayObject.
The codes are as follows:

var particles:Vector.<Particle> = new Vector.<Particle>();
var rp:RegularPolygon;
var p:Particle3D;
...
p=new Particle3D();
p.position= new Vector3D(rp.x,rp.y,rp.z,1);
p.image = rp;
particles.push(p);

Some codes will be helpful.
Thanks.
Jacky ]]>
how to take away3d primitive as a particle? http://flintparticles.org/forum/comments.php?DiscussionID=474&Focus=1612#Comment_1612 http://flintparticles.org/forum/comments.php?DiscussionID=474&Focus=1612#Comment_1612 Wed, 20 Apr 2011 08:52:49 +0100 Richard Away3DRenderer to render particles as away 3d objects.

A couple of the examples on this site have Away3D versions (Fire and Smoke and Brownian Motion) which you may find useful. ]]>
how to take away3d primitive as a particle? http://flintparticles.org/forum/comments.php?DiscussionID=474&Focus=1617#Comment_1617 http://flintparticles.org/forum/comments.php?DiscussionID=474&Focus=1617#Comment_1617 Mon, 25 Apr 2011 12:52:47 +0100 jack1505 how to take away3d primitive as a particle? http://flintparticles.org/forum/comments.php?DiscussionID=474&Focus=1631#Comment_1631 http://flintparticles.org/forum/comments.php?DiscussionID=474&Focus=1631#Comment_1631 Tue, 03 May 2011 09:05:47 +0100 jack1505
renderer = new Away3DRenderer( scene );
......

var ExplosionEmitter:Emitter3D = new Emitter3D();

var particles:Vector.<Particle> = createSphereParticles();
ExplosionEmitter.addParticles( particles, false );

ExplosionEmitter.addInitializer( new Velocity( new SphereZone( new Vector3D(), 200 ) ) );
ExplosionEmitter.addInitializer( new Lifetime( 3 ) );

ExplosionEmitter.addAction( new Age( Quadratic.easeIn ) );
ExplosionEmitter.addAction( new Move() );
ExplosionEmitter.addAction( new Accelerate( new Vector3D( 0, -50, 0 ) ) );

renderer.addEmitter( ExplosionEmitter );
ExplosionEmitter.start();

public function createSphereParticles():Vector.<Particle>
{
var particles:Vector.<Particle> = new Vector.<Particle>();
var p:Particle3D;
var i:int;
var sphere:Sphere;

for(i=0;i<100;i++)
{
p=new Particle3D();
p.position= new Vector3D(0,50,0 ,0);

sphere = new Sphere();
sphere.radius = 6;
sphere.segmentsW = 3;
sphere.segmentsH = 2;

p.image = sphere;
particles.push(p);

}
return particles;
} ]]>
how to take away3d primitive as a particle? http://flintparticles.org/forum/comments.php?DiscussionID=474&Focus=1637#Comment_1637 http://flintparticles.org/forum/comments.php?DiscussionID=474&Focus=1637#Comment_1637 Mon, 09 May 2011 08:38:16 +0100 Richard
package
{
import away3d.containers.View3D;
import away3d.primitives.Sphere;

import org.flintparticles.common.actions.Age;
import org.flintparticles.common.counters.Blast;
import org.flintparticles.common.easing.Quadratic;
import org.flintparticles.common.initializers.Lifetime;
import org.flintparticles.threeD.actions.Accelerate;
import org.flintparticles.threeD.actions.Move;
import org.flintparticles.threeD.away3d.Away3DRenderer;
import org.flintparticles.threeD.away3d.initializers.A3DObjectClass;
import org.flintparticles.threeD.emitters.Emitter3D;
import org.flintparticles.threeD.initializers.Position;
import org.flintparticles.threeD.initializers.Velocity;
import org.flintparticles.threeD.zones.PointZone;
import org.flintparticles.threeD.zones.SphereZone;

import flash.display.Sprite;
import flash.events.Event;
import flash.geom.Vector3D;

[SWF(width='400', height='400', frameRate='60', backgroundColor='#808080')]

public class Main extends Sprite
{
private var emitter : Emitter3D;
private var view : View3D;
private var renderer : Away3DRenderer;

public function Main()
{
emitter = new Emitter3D();
emitter.counter = new Blast( 100 );

emitter.addInitializer( new A3DObjectClass( Sphere, { radius:6, segmentsW:3, segmentsH:2 } ) );
emitter.addInitializer( new Position( new PointZone( new Vector3D( 0, 50, 0 ) ) ) );
emitter.addInitializer( new Velocity( new SphereZone( new Vector3D(), 200 ) ) );
emitter.addInitializer( new Lifetime( 3 ) );

emitter.addAction( new Age( Quadratic.easeIn ) );
emitter.addAction( new Move() );
emitter.addAction( new Accelerate( new Vector3D( 0, -50, 0 ) ) );

view = new View3D( { x:200, y:200 } );
addChild( view );
renderer = new Away3DRenderer( view.scene );
renderer.addEmitter( emitter );

emitter.start();

addEventListener( Event.ENTER_FRAME, render, false, 0, true );
}

private function render( ev : Event ) : void
{
// render the view
view.render();
}
}
}
]]>