Game Development Community

Adding particle effects

by Aditya Kulkarni · in Torque Game Builder · 01/15/2010 (4:36 am) · 2 replies

am really confused about adding particle effects to the scene...am able to create the effect just fine and i can see it in the library...how do i use it in the scene?

this is what i tried, with no results...:(

new t2dParticleEffect(effect1) {
         effectFile = "subtle_ripple";
         useEffectCollisions = "0";
         effectMode = "INFINITE";
         size = "16 16";
         position = "0 0";
         scenegraph = t2dSceneGraph;
      };

effect1.playEffect();

gave me this:
t2dParticleEffect::playEffect() - Cannot Play; no emitters!

so i added the following to the above code...

%emitter = effect1.findEmitterObject("defaultEmitter");
   
   %emitter.clearDataKeys();
   // Add our keys.
   %emitter.addDataKey( 0.0, 0 );
   %emitter.addDataKey( 0.5, 5 );
   %emitter.addDataKey( 0.9, 20 );
   %emitter.addDataKey( 1.0, 50 );

gives me this now:
t2dParticleEffect::playEffect() - Cannot Play; not in a scene!

#1
01/15/2010 (9:36 am)
solved!

was calling playEffect before creating the effect...*sheepish grin*
#2
01/15/2010 (2:11 pm)
thats a valid explanation I guess ;)