Game Development Community

Particle Systems play on addToLevel

by Devin Horsman · in Torque Game Builder · 01/25/2010 (11:27 am) · 1 replies

When additively loading a scene, all existing particle effects play in the scene.

Anyone has a fix, I'd like to see it, in the meantime, I'm working on one.

#1
01/25/2010 (11:50 am)
ok (your mileage may vary, report any problems you have):

In t2dParticleEffect.cc replace readFieldsPostLoad with
void t2dParticleEffect::readFieldsPostLoad()
{
   //playEffect(true); // DEVIN [ http://www.torquepowered.com/community/forums/viewthread/109839 ]

   Parent::readFieldsPostLoad();
}

in the torquescript file levelManagement.cs in the scenegraph::addToLevel function, before
// And finally, perform any post creation actions
   %newScenegraph.performPostInit();

add:

// fix particle effect problems.
   for(%i = 0; %i < $LevelManagement::newObjects.getCount(); %i++){
      
      %obj = $LevelManagement::newObjects.getObject(%i);
      //echo("Looping" SPC %obj.getClassName());
      if(%obj.getClassName() $= "t2dParticleEffect"){
         //echo("playing effect");
         %obj.playEffect(true);
      }
   }