Code: Select all
switch (ParticleType)
{
case 1:
if (pnc3 == 9) {
pnc3 = 0;
}
if (pNode3[pnc3]->getParent()->getName() != "root node")
{
pNode3[pnc3]->getParentSceneNode()->removeChild(pNode3[pnc3]->getName());
}
pParent->addChild(pNode3[pnc3]);
pNode3[pnc3]->setPosition(Offset);
pNode3[pnc3]->setDirection(Direction);
pEmitter3[pnc3]->setDuration(Duration);
pEmitter3[pnc3]->setEnabled(true);
pnc3++;
return true;
break;
The idea is this effect is non critical and can be robbed from one place to another as when bullet get farenough from the firing ship it isnt important to keep the effects on it but to move them to the new bullets being fired.
But to the problem at hand the code still runs fine (well doesnt crash) and the bullets still fire and collide fine but after the first ten bullets the particls shut are not visable.
I have attempted to reattach the particle system when i remove the node from the parent (the bullet) but that crashes as it has the particle system attached. I have tried to refresh the emitter pointer still doesnt work.
Im kinda at a lose for why i cant remove and readd a node and keep the particle system running.
