Ok but do you want the code? Or a binary or the entire project? (that will be some work...)
But i havent changed anything in the engine regarding the particle systems.
This is the code:
1. This is how i create them:
Code: Select all
void world::createEffect( vect3d pos,char * textureName,float emissionTime,float force,float spawnMin,float spawnMax,float lifeMin,float lifeMax,float sizeMin,float sizeMax,SColor startColorMin/*=white*/,SColor startColorMax/*=white*/,SColor fadeColor/*=SColor(0,0,0,0)*/,float fadeColorTime/*=100*/,float gravity/*=0*/,float gravityDelay/*=1000*/,float endScale/*=1*/,float radius/*=1*/,int blendType/*=1*/,vector3df speedVector/*=vector3df(0,0,0)*/,float maxAngles/*=360*/,vector3df systemSpeed/*=vector3df(0,0,0)*/,gameObject * followThis/*=0*/ )
{
objectList.push_back(new gameObject);
gameObject * o=objectList.back();
o->curIt=objectList.end();
o->curIt--;
theNewObject=o;
o->type=-1; //is effect
o->pos=pos;
o->team=-1;
o->removeMe=0;
o->speed=systemSpeed;
o->lockedTarget=0;
o->shootingUnit=0;
o->node=0;
o->followThis=followThis;
o->psTimeLeft=emissionTime/1000.0;
o->timeLeft=emissionTime/1000.0+0.5+lifeMax/1000.0;
o->ps = gfx.smgr->addParticleSystemSceneNode(false);
o->ps->setPosition(pos);
if(!speedVector.getLength())
speedVector=vector3df(0,force,0);
scene::IParticleEmitter* em = o->ps->createSphereEmitter(
vect3d(0,0,0), //position offset
radius, //radius of emitter
speedVector, //dir/speed
spawnMin,spawnMax, //emissions min/max
startColorMin,startColorMax, //start color min/max
lifeMin,lifeMax,
maxAngles, //maxAngleDegrees
dim2df(sizeMin,sizeMin),dim2df(sizeMax,sizeMax));
o->ps->setEmitter(em);
em->drop();
scene::IParticleAffector* paf;
paf = o->ps->createFadeOutParticleAffector(fadeColor,fadeColorTime);
o->ps->addAffector(paf);
paf->drop();
if(gravity){
paf = o->ps->createGravityAffector(vect3d(0,gravity,0),gravityDelay);
o->ps->addAffector(paf);
paf->drop();
}
if(endScale!=1){
paf = o->ps->createScaleParticleAffector(dim2df(endScale,endScale));
o->ps->addAffector(paf);
paf->drop();
}
o->ps->setMaterialFlag(video::EMF_LIGHTING, false);
sprintf(tempText,"gfx/particles/%s.png",textureName);
o->ps->setMaterialTexture(0, gfx.driver->getTexture(tempText));
if(blendType==1)
o->ps->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR);
if(blendType==2){
o->ps->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL);
}
}
2. During update this is all I do (move). Otherwise i dont deal with them.
Code: Select all
gameObject->ps->setPosition(gameObject->pos);