Flint Particle System Forum - 3D GravityWell 2011-06-23T13:13:07+01:00 http://flintparticles.org/forum/ Lussumo Vanilla & Feed Publisher 3D GravityWell http://flintparticles.org/forum/comments.php?DiscussionID=286&Focus=1005#Comment_1005 2009-12-06T15:56:12+00:00 2011-06-23T13:13:07+01:00 lee_plenty http://flintparticles.org/forum/account.php?u=284 Hi, 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. ...
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 2009-12-14T09:52:21+00:00 2009-12-14T09:53:20+00:00 lee_plenty http://flintparticles.org/forum/account.php?u=284 Got it! I think it was because somehow my emitter was not on the right spot....I think. Anyway, with this piece it works as intended: Main.as: package { import flash.display.Sprite; import ...
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 2009-12-14T09:52:45+00:00 2009-12-14T09:53:52+00:00 lee_plenty http://flintparticles.org/forum/account.php?u=284 - 3D GravityWell http://flintparticles.org/forum/comments.php?DiscussionID=286&Focus=1018#Comment_1018 2009-12-17T08:24:22+00:00 2011-06-23T13:13:07+01:00 Richard http://flintparticles.org/forum/account.php?u=1 Glad you found the answer. Three-D is so much more complicated because of camera position, lens angle etc.