Game Development Community

Multiple Debris?

by Mike Damert · in Torque Game Engine · 07/04/2003 (8:14 am) · 4 replies

I'm trying to get an explosion to have multiple types of debris. So in the datablock ExplosionData, I have a debris variable set and a bunch of variables set for that Debris. What I would like to be able to do is to have 2 different types of debris: one with particles and one with mesh objects.

The way I would like to accomplish this is to have 2 Debris variables within the ExplosionData, like an array of Debris variables. Is this possible? If not, is there a better way to do it?

#1
07/04/2003 (11:52 am)
This is possible but you can't have multiple debris values set in one ExplosionData datablock. However, you can have an ExplosionData datablock spawn sub explosions which in turn can call an addition debris. Here is a rough example, I'll leave you to fill in the rest of the values:

datablock ExplosionData(SomeExplosion)
{
   // ...
   // set our normal values
   // ...

   // spawn sub explosions (up to 3 I believe)
   subExplosion[0] = SomeSubExplosion1;
   //subExplosion[1] = SomeSubExplosion2;
   //subExplosion[2] = SomeSubExplosion3;

   // spawn our debris 
   debris = SomeDebris;
   // ...
   // rest of our debris values
   // ...

   // ...
   // rest of our datablock values
   // ...
};

datablock ExplosionData(SomeSubExplosion1)
{
   // ...
   // datablock values
   // ...

   // spawn our debris
   debris = SomeDebris;
   // ...
   // rest of our debris values
   // ...
};

And that will do the trick.
#2
07/05/2003 (11:23 am)
Works like a charm. Thanks so much!!

It took me a long time to figure out that datablocks had to be in some sort of order in the code; that's why it took a long time for me to actually get the effect to work.
#3
07/09/2003 (9:07 am)
I have a new problem...I'm trying to get multiple instances of a single Debris model. Is there some variable in the DebrisData datablock that would enable me to make multiple instances of the same *.dts model? As in, could I somehow make this datablock create the 3d sprites as if they were particles?

Here's what I have:

datablock DebrisData(GroundDebris)
{
   shapeFile = "debris.dts";
   lifetime = 3.0;
   minSpinSpeed =   10.0;
   maxSpinSpeed = 1000.0;
   elasticity = 0.2;
   friction = 0.2;
   numBounces = 4;
   staticOnMaxBounce = false;
   gravModifier = 5.0; //use slightly less than normal gravity
   snapOnMaxBounce = false;
   fade = false;
}

Thanks in advance!
#4
04/25/2008 (3:45 am)
Mike said: "datablocks had to be in some sort of order in the code"
And the order is that you need to define the subexplosion data block first, then the main explosion datablock.

And also, if I get the second question right:
"Is there some variable in the DebrisData datablock that would enable me to make multiple instances of the same *.dts model? As in, could I somehow make this datablock create the 3d sprites as if they were particles?"

you can create many particles by putting/modifying the following lines in the explosion datablock:
debrisNum = 8;
debrisNumVariance = 2;




I know this is an old thread but I just wanted to make it clear for future references to here. This info is still valid in TGE 1.5.2