Flint Particle System Forum - PV3DParticleRenderer.addParticle: null object? 2010-12-26T18:50:10+00:00 http://flintparticles.org/forum/ Lussumo Vanilla & Feed Publisher PV3DParticleRenderer.addParticle: null object? http://flintparticles.org/forum/comments.php?DiscussionID=233&Focus=850#Comment_850 2009-07-10T04:43:49+01:00 2009-07-10T04:47:26+01:00 kirbysayshi http://flintparticles.org/forum/account.php?u=130 I'm trying to get a starfield effect going, where you'll hopefully be able to eventually fly through it, literally (not just the illusion). I've made the following class trying to get the ...
I'm at a loss for what the issue is, as it seems to be happening rather deep in the Flint code. Perhaps there's a confusion between Flint's Particle object and Papervision3D's? I'm using the current version of Flint (from teh downloads page) and the trunk code of Papervision. Either way, if someone gets the following code to run, I will be excited.


package
{
import org.flintparticles.common.counters.Steady;
import org.flintparticles.threeD.actions.Move;
import org.flintparticles.threeD.emitters.Emitter3D;
import org.flintparticles.threeD.geom.Point3D;
import org.flintparticles.threeD.initializers.Position;
import org.flintparticles.threeD.initializers.Velocity;
import org.flintparticles.threeD.papervision3d.PV3DParticleRenderer;
import org.flintparticles.threeD.zones.PointZone;
import org.papervision3d.cameras.CameraType;
import org.papervision3d.core.geom.Particles;
import org.papervision3d.view.BasicView;

public class SpaceDebris extends BasicView
{
private var _emitter:Emitter3D;
private var _renderer:PV3DParticleRenderer;
private var _particles:Particles;

public function SpaceDebris()
{
super(stage.stageWidth, stage.stageHeight, true, false, CameraType.FREE);

_particles = new Particles();
scene.addChild(_particles);

_emitter = new Emitter3D();
_emitter.position.z = 100;
_emitter.counter = new Steady(10);

var startingPosition:Point3D = new Point3D(0, 0, 200);
var startingZone:PointZone = new PointZone(startingPosition);
var sPos:Position = new Position(startingZone);
_emitter.addInitializer(sPos);

var direction:Point3D = new Point3D(2, 0, 0);
var zone:PointZone = new PointZone(direction);
var vel:Velocity = new Velocity(zone);
_emitter.addInitializer(vel);

_emitter.addAction( new Move() );

_renderer = new PV3DParticleRenderer(_particles);
_renderer.addEmitter(_emitter);

_emitter.start();
startRendering();
}
}
}
]]>
PV3DParticleRenderer.addParticle: null object? http://flintparticles.org/forum/comments.php?DiscussionID=233&Focus=851#Comment_851 2009-07-10T08:45:06+01:00 2010-12-26T18:50:10+00:00 Richard http://flintparticles.org/forum/account.php?u=1 Hi You need to define a 3D object for PV3D to use when rendering the particles. e.g. these two lines from the BrownianMotion example define a grey circle as the 3D ...
You need to define a 3D object for PV3D to use when rendering the particles. e.g. these two lines from the BrownianMotion example define a grey circle as the 3D object...

_emitter.addInitializer( new PV3DObjectClass( Particle, null, 4 ) );
_emitter.addInitializer( new ApplyMaterial( ParticleMaterial, 0x666666, 1, ParticleMaterial.SHAPE_CIRCLE ) );
]]>
PV3DParticleRenderer.addParticle: null object? http://flintparticles.org/forum/comments.php?DiscussionID=233&Focus=859#Comment_859 2009-07-13T03:18:23+01:00 2010-12-26T18:50:10+00:00 kirbysayshi http://flintparticles.org/forum/account.php?u=130 Thanks for the reply Richard! I couldn't get my original original code to work, but I started over and have a simple explosion working now with the Particle renderer: package { import ...
I couldn't get my original original code to work, but I started over and have a simple explosion working now with the Particle renderer:

package
{
import org.flintparticles.common.actions.Age;
import org.flintparticles.common.actions.Fade;
import org.flintparticles.common.counters.Blast;
import org.flintparticles.common.initializers.ColorInit;
import org.flintparticles.common.initializers.Lifetime;
import org.flintparticles.threeD.actions.Move;
import org.flintparticles.threeD.emitters.Emitter3D;
import org.flintparticles.threeD.geom.Point3D;
import org.flintparticles.threeD.initializers.Velocity;
import org.flintparticles.threeD.papervision3d.PV3DParticleRenderer;
import org.flintparticles.threeD.papervision3d.initializers.PV3DObjectClass;
import org.flintparticles.threeD.zones.SphereZone;
import org.papervision3d.cameras.CameraType;
import org.papervision3d.core.geom.Particles;
import org.papervision3d.core.geom.renderables.Particle;
import org.papervision3d.materials.special.ParticleMaterial;
import org.papervision3d.view.BasicView;
import org.papervision3d.view.layer.BitmapEffectLayer;

public class SpaceDebris extends BasicView
{
private var _emitter:Emitter3D;
private var _renderer:PV3DParticleRenderer;
private var _particles:Particles;

private var emitter:Emitter3D;
private var flintRenderer:PV3DParticleRenderer;
private var bfx:BitmapEffectLayer;
private var particles:Particles;

[SWF(width='800', height='600', backgroundColor='#000000', frameRate='31')]
public function SpaceDebris()
{
super(stage.stageWidth, stage.stageHeight, true, false, CameraType.DEBUG);

camera.z = -300;
particles = new Particles();
scene.addChild(particles);

emitter = new Emitter3D();

emitter.counter = new Blast(100);

var mat:ParticleMaterial = new ParticleMaterial(0x000000, 1, 1);

emitter.addInitializer( new ColorInit( 0xFFCCCCFF, 0xFF6666FF ) );
emitter.addInitializer( new Velocity( new SphereZone( new Point3D(0, 0, 0), 100, 0) ) );
emitter.addInitializer( new Lifetime( 2 ) );
emitter.addInitializer( new PV3DObjectClass(Particle, mat, 5));

emitter.addAction( new Move() );
emitter.addAction( new Fade() );
emitter.addAction( new Age() );

emitter.position.y = -100;

flintRenderer = new PV3DParticleRenderer(particles);
flintRenderer.addEmitter( emitter );
emitter.start();
startRendering();
}
}
}


Thanks again.]]>