Torque Game EngineTorque Game Engine Documentation
Version 1.3.x

DebrisData

DebrisData datablocks are used to provide data for Debris objects, which are simple shapes in the world that don't require all the functionality of ShapeBaseData-derived shapes, and which have some unique features, like a limited lifetime, and specific bouncing behaviors. Debris objects can emit particles and produce explosions. DebrisData derives from GameBaseData.

Table D.12. DebrisData Member Fields

Field NameTypeDefault ValueDescription
Rendering Data
textureStringNULLThe texture used for the debris object.
shapeFileFilenameNULLName of the shape file to be used for the debris object. Specified as a string, but must adhere to the semantics associated with the filenamedata type, as defined in the engine.
render2DBooleanFalseSpecifies whether or not to draw a billboard for the debris object.
Special Effects Data
emittersParticleEmitterDataPtr (array)NULL [DDC_NUM_EMITTERS]Array of pointers to ParticleEmitterData datablocks which will be used to generate particle effects for the debris object. Must adhere to the semantics associated with ParticleEmitterDataPtr, as defined in the engine.
ExplosionExplosionDataPtrNULLPoints to the ExplosionData datablock which will specifies the explosion effect to use if the debris object explodes. Must adhere to the semantics associated with ExplosionDataPtr, as defined in the engine.
Physics Data
elasticityFloat0.3Used to simulate the physical property of an object's elasticity when performing bounce calculations; the higher the elasticity, the larger the magnitude of the resultant bounce velocity. Also affect's the debris object's rotation angles. If the useRadiusMass field is set to true, the friction value used in bounce velocity and rotation angle calculations is also affected by the baseRadius value; for more information, see the documentation for these fields. If value is greater than 10.0, or less than -10.0, a console warning will be generated and the value will be forced to 0.2.
frictionFloat0.2Used to simulate the physical property of friction when the debris object bounces. Resultant bounce velocity is dampened with the friction value. If the useRadiusMass field is set to true, the friction value used in bounce velocity calculations is also affected by the baseRadius value; for more information, see the documentation for these fields. If value is greater than 10.0, or less than -10.0, a console warning will be generated and the value will be forced to 0.2.
useRadiusMassBooleanFalseSpecifies whether or not the baseRadius value will affect the values of the debris object's friction, elasticity, and rotation angles fields.
baseRadiusFloat1.0If useRadiusMass is true, specifies the maximum value of the debris obect's radius field for which standard elasticity, friction, and rotation calculations apply. If the debris object's radius field is greater than the value specified in baseRadius, and the useRadiusMass field is true, then elasticity, friction, and rotation values are dampened by scaling with (baseRadius / radius).
minSpinSpeedFloat0.0A Debris object using the datablock will have a rotation speed based on a random number between minSpinSpeed and maxSpinSpeed. If the value of minSpinSpeed is less than -10,000.0, greater than 10,000.0 or greater than maxSpinSpeed, a console warning will be generated, and the values of minSpindSpeed and maxSpinSpeed will be forced to -1.0.
maxSpinSpeedFloat0.0A Debris object using the datablock will have a rotation speed based on a random number between minSpinSpeed and maxSpinSpeed. If the value of maxSpinSpeed is less than -10,000.0 or greater than 10,000.0, a console warning will be generated, and the value will be forced to 0.0.
gravModifierFloat1.0Value by which the effect of gravitational force is scaled. Value of 1.0 means no change to default gravitational force.
terminalVelocityFloat0.0The maximum velocity at which the debris may travel. If the specified value is less than or equal to 0.0001, it is ignored.
velocityFloat0.0Used along with velocityVariance to determine the debris object's initial velocity magnitude.
velocityVarianceFloat0.0Used along with velocity to determine the debris object's initial velocity magnitude. A random floating-point number will be generated between the value of (-1*velcotityVariance) and velocityVariance, and will be added to velocity to determine the Debris object's initial velocity. This means that multiple Debris objects sharing the same DebrisData datablock must not all have the same initial velocity.
lifetimeFloat3.0Used along with lifetimeVariance to determine the amount of time the Debris object will persist in the world. If value is less than zero, or greater than 1000, a console warning will be generated and the value will be set to 3.0.
lifetimeVarianceFloat0.0Used along with lifetime to determine the amount of time the Debris object will persist in the world. If value is less than zero or greater than the value of lifetime, a console warning is generated and the value is forced to 0.0.
Behavior Data
numBouncesInteger0.0Along with bounceVariance, determines the maximum number of bounces the Debris object can take. If value is less than zero, or greater than 10,000, a console warning will be generated and the value will be forced to 3.
bounceVarianceInteger0Used in conjunction with numBounces to determine the maximum number of times the debris object can bounce. Max bounces is determined by adding numBounces with a random integer from -1*bounceVariance to bounceVariance. Thus, providing a DebrisData datablock with a bounceVariance value of zero means that all debris objects using that datablock will bounce no more than numBounces times. Specifying a non-zero bounceVariance value means that multiple Debris objects sharing the same DebrisData datablock need not all have the same maximum number of bounces. If bounceVariance is less than zero, or greater than the value of the numBounces field, a console warning will be generated and the bounceVariance will be set to zero.
explodeOnMaxBounceBooleanFalseSpecifies whether the Debris object will explode after max bounces (see the numBounces and bounceVariance field descriptions).
staticOnMaxBounceBooleanFalseSpecifies whether the Debris object will be forced static after max bounces (see the numBounces and bounceVariance field descriptions).
snapOnMaxBounceBooleanFalseSpecifies whether the Debris object will snap to a flat-oriented position after max bounces (see the numBounces and bounceVariance field descriptions).
ignoreWaterBooleanTrueSpecifies whether the Debris object should bounce against water (see the numBounces and bounceVariance field descriptions).
fadeBooleanTrudeSpecifies whether the Debris object will begin fading when it's lifetime nears end. Default fade behavior is a linear progression to transparency beginning one second before lifetime limit arrives.

As the above table shows, the DebrisData fields allow the specification of varied behavior, even amongst Debris objects sharing the same datablock. Debris objects are quite useful for basic shapes which can bounce, or which must only persist for a specified period of time.