Torque Game Engine DocumentationVersion 1.3.x |
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 Name | Type | Default Value | Description |
|---|---|---|---|
| Rendering Data | |||
| texture | String | NULL | The texture used for the debris object. |
| shapeFile | Filename | NULL | Name 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. |
| render2D | Boolean | False | Specifies whether or not to draw a billboard for the debris object. |
| Special Effects Data | |||
| emitters | ParticleEmitterDataPtr (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. |
| Explosion | ExplosionDataPtr | NULL | Points 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 | |||
| elasticity | Float | 0.3 | Used 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. |
| friction | Float | 0.2 | Used 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. |
| useRadiusMass | Boolean | False | Specifies whether or not the baseRadius value will affect the values of the debris object's friction, elasticity, and rotation angles fields. |
| baseRadius | Float | 1.0 | If 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). |
| minSpinSpeed | Float | 0.0 | A 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. |
| maxSpinSpeed | Float | 0.0 | A 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. |
| gravModifier | Float | 1.0 | Value by which the effect of gravitational force is scaled. Value of 1.0 means no change to default gravitational force. |
| terminalVelocity | Float | 0.0 | The maximum velocity at which the debris may travel. If the specified value is less than or equal to 0.0001, it is ignored. |
| velocity | Float | 0.0 | Used along with velocityVariance to determine the debris object's initial velocity magnitude. |
| velocityVariance | Float | 0.0 | Used 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. |
| lifetime | Float | 3.0 | Used 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. |
| lifetimeVariance | Float | 0.0 | Used 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 | |||
| numBounces | Integer | 0.0 | Along 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. |
| bounceVariance | Integer | 0 | Used 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. |
| explodeOnMaxBounce | Boolean | False | Specifies whether the Debris object will explode after max bounces (see the numBounces and bounceVariance field descriptions). |
| staticOnMaxBounce | Boolean | False | Specifies whether the Debris object will be forced static after max bounces (see the numBounces and bounceVariance field descriptions). |
| snapOnMaxBounce | Boolean | False | Specifies whether the Debris object will snap to a flat-oriented position after max bounces (see the numBounces and bounceVariance field descriptions). |
| ignoreWater | Boolean | True | Specifies whether the Debris object should bounce against water (see the numBounces and bounceVariance field descriptions). |
| fade | Boolean | Trude | Specifies 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.