Flint Particle System Forum - 3D GravityWell Thu, 23 Jun 2011 13:12:57 +0100 http://flintparticles.org/forum/ Lussumo Vanilla 1.1.10 & Feed Publisher 3D GravityWell http://flintparticles.org/forum/comments.php?DiscussionID=286&Focus=1005#Comment_1005 http://flintparticles.org/forum/comments.php?DiscussionID=286&Focus=1005#Comment_1005 Sun, 06 Dec 2009 15:56:12 +0000 lee_plenty
I'm trying to build a 3D version of the GravityWell. I've used to code provided in the 2D example and used 3D classes instead. I've also looked at the version of sandersnake 3D Globe example. But unfortunatly, even though the code compiles, it doesn't show anything. I've pasted the code below. Could someone tell me what I'm doing wrong?

This is the Main.as:

package
{
import flash.display.Sprite;
import flash.filters.BlurFilter;
import flash.filters.ColorMatrixFilter;
import flash.geom.Rectangle;

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

[SWF(width='400', height='400', frameRate='61', backgroundColor='#000000')]

public class Main extends Sprite
{
private var emitter:Emitter3D;

public function Main()
{
emitter = new GravityWells();

var renderer:PixelRenderer = new PixelRenderer( new Rectangle( 0, 0, 400, 400 ), true );
renderer.addFilter( new BlurFilter( 2, 2, 1 ) );
renderer.addFilter( new ColorMatrixFilter( [ 1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0.99,0 ] ) );
renderer.addEmitter( emitter );
addChild( renderer );

emitter.start();
}
}
}

This is the GravityWell.as

package
{
import flash.geom.Point;

import org.flintparticles.common.counters.*;
import org.flintparticles.common.initializers.*;
import org.flintparticles.threeD.actions.*;
import org.flintparticles.threeD.emitters.Emitter3D;
import org.flintparticles.threeD.initializers.*;
import org.flintparticles.threeD.zones.*;
import org.flintparticles.threeD.geom.*;

public class GravityWells extends Emitter3D
{
public function GravityWells()
{
counter = new Random(0, 100);

addInitializer( new ColorInit( 0xFFFF00FF, 0xFF00FFFF ) );
addInitializer( new Position( new SphereZone ( new Point3D(200, 200, 0), 200, 0) ) );

addAction( new Move() );
addAction( new GravityWell(50, new Point3D(200, 200, 0), 200) );
addAction ( new DeathZone( new SphereZone ( new Point3D(200, 200, 0), 200, 0) ) );
}
}
} ]]>
3D GravityWell http://flintparticles.org/forum/comments.php?DiscussionID=286&Focus=1009#Comment_1009 http://flintparticles.org/forum/comments.php?DiscussionID=286&Focus=1009#Comment_1009 Mon, 14 Dec 2009 09:52:21 +0000 lee_plenty
Main.as:

package
{
import flash.display.Sprite;
import flash.filters.BlurFilter;
import flash.filters.ColorMatrixFilter;
import flash.geom.Rectangle;

import org.flintparticles.threeD.emitters.Emitter3D;
import org.flintparticles.threeD.renderers.*;
import org.flintparticles.threeD.geom.*;
import org.flintparticles.threeD.renderers.controllers.*;

[SWF(width='400', height='400', frameRate='61', backgroundColor='#000000')]

public class Main extends Sprite
{
private var emitter:Emitter3D;

public function Main()
{
emitter = new GravityWells();

var renderer:PixelRenderer = new PixelRenderer( new Rectangle( -200, -200, 400, 400 ) );
//var renderer:BitmapRenderer = new BitmapRenderer( new Rectangle( -200, -200, 400, 400 ), false );
renderer.camera.dolly( -300 );
renderer.camera.lift( 100 );
renderer.camera.target = new Point3D(400, 400, 0);
renderer.addFilter( new BlurFilter( 2, 2, 1 ) );
renderer.addFilter( new ColorMatrixFilter( [ 1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0.99,0 ] ) );
renderer.addEmitter( emitter );
renderer.x = 200
renderer.y = 200;
addChild( renderer );

emitter.position = new Point3D(200, 200, 0);
emitter.start();

var orbitter:OrbitCamera = new OrbitCamera( stage, renderer.camera );
orbitter.start();
}
}
}

GravityWells.as:

package
{
import flash.geom.Point;

import org.flintparticles.common.counters.*;
import org.flintparticles.common.initializers.*;
import org.flintparticles.common.displayObjects.Dot;
import org.flintparticles.threeD.actions.*;
import org.flintparticles.threeD.emitters.Emitter3D;
import org.flintparticles.threeD.initializers.*;
import org.flintparticles.threeD.zones.*;
import org.flintparticles.threeD.geom.*;

public class GravityWells extends Emitter3D
{
public function GravityWells()
{
counter = new Random(0, 500);
//counter = new Blast( 500 );

//addInitializer( new ImageClass( Dot, 1 ) );
addInitializer( new ColorInit( 0xFFFF00FF, 0xFF00FFFF ) );
addInitializer( new Position( new SphereZone ( new Point3D(200, 200, 0), 200, 0) ) );

addAction( new Move() );
addAction( new GravityWell(50, new Point3D(400, 400, 0)) );
addAction ( new DeathZone( new SphereZone ( new Point3D(400, 400, 0), 200, 10), true ) );
}
}
} ]]>
3D GravityWell http://flintparticles.org/forum/comments.php?DiscussionID=286&Focus=1010#Comment_1010 http://flintparticles.org/forum/comments.php?DiscussionID=286&Focus=1010#Comment_1010 Mon, 14 Dec 2009 09:52:45 +0000 lee_plenty 3D GravityWell http://flintparticles.org/forum/comments.php?DiscussionID=286&Focus=1018#Comment_1018 http://flintparticles.org/forum/comments.php?DiscussionID=286&Focus=1018#Comment_1018 Thu, 17 Dec 2009 08:24:22 +0000 Richard