I'm working for the first time with a particle sstem in Irrlicht 0.11.
With this code, I have a little problem : the particle emitter moves like if it was on a line (the particles are emitted, with the good texture, colors..., the affectors works, but I would like that the emitter stand at it place)
I've also add a water plane and use the terrain generator => they work very well.
Code :
Code: Select all
// create a particle system
IParticleSystemSceneNode *pParticleSys = 0;
pParticleSys = pScenemgr->addParticleSystemSceneNode( false );
pParticleSys->setPosition( vector3df(7.5,1,1) );
pParticleSys->setScale( vector3df(1,1,1) );
pParticleSys->setParticleSize( dimension2d<f32>(5.0f, 5.0f) );
// create an emitter
IParticleEmitter* pPEmit = pParticleSys->createPointEmitter(
vector3df( 0.0f, 0.07f, 0.0f ),
100, 1000,
SColor( 0,255,180,0 ),
SColor(0,255,255,0),
20000, 40000, 90 );
pParticleSys->setEmitter( pPEmit );
// on peut le dropper maintenant
pPEmit->drop();
// prepare a fade out to destroy particles
IParticleAffector* pPAffect = pParticleSys->createFadeOutParticleAffector();
pParticleSys->addAffector( pPAffect );
pPAffect->drop();
// create a gravity affector
pPAffect = pParticleSys->createGravityAffector();
pParticleSys->addAffector( pPAffect );
pPAffect->drop();
// no lighting
pParticleSys->setMaterialFlag( EMF_LIGHTING, false );
// set particles' texture
pParticleSys->setMaterialTexture( 0, pDriver->getTexture("halo.bmp") );
// add alpha support for fade out
pParticleSys->setMaterialType( EMT_TRANSPARENT_VERTEX_ALPHA );