Torque Game EngineTorque Game Engine Documentation
Version 1.3.x

ParticleData

We have detailed the field's involved in the ParticleEmitterData and ParticleEmitterNodeData datablocks. Now we look at the ParticleData datablock itself. Whereas ParticleEmitterData and ParticleEmitterNodeData derived from GameBaseData, ParticleData does not. Rather it derives directly from the SimDataBlock datablock. Recall that SimDataBlock defines no fields which are accessible via TorqueScript, and so ParticleData defines only thei fields listed below.

Table D.19. ParticleData Member Fields

Field NameTypeDefault ValueDescription
Rendering Data
textureNameFilename0The path and file name of a texture file to be used for the particle. Must adhere to the semantics associated with the Filename datatype, as defined in the engine.
animTexNameFilename (array)0 [PDC_MAX_TEX = 50]The path and file name of additional texture files to be used if the animateTexture field is set to true. Must adhere to the semantics associated with the Filename datatype, as defined in the engine.
animateTextureBooleanFalseSpecifies whether the Particle's texture is animated. If True, the Particle's texture frames are animated at the rate specified in the framesPerSec field.
framesPerSecInteger1The number of texture frames to be displayed per second on the Particle. The value supplied must be less than 200, otherwise a console warning is generated and value is forced to 20.
useInvAlphaBooleanFalseSpecifies whether the alpha channel in texture frames should be treated as if it is inverted. It is possible to provide transparent or partially transparent textures for Particles; by default an alpha texel with a value of 0.0 implies full transparency, while an alpha texel with a value of 1.0 implies full opacity. If useInvAlpha is True, this situation is reversed, with a 0.0 alpha texel representing full opacity, and 1.0 representing full transparency.
colorsColorF (array)(1.0, 1.0, 1.0 , 1.0) [PC_COLOR_KEYS]List of colors to be used for the Particle at each time value specified in the times array field. The first entry in the colors array corresponds to the initial Particle color, and is interpolated with colors[1] until times[0] percent of the Particle's lifetime elapses, at which time colors[1] is the draw color and it begins being interpolated with colors[2]. See the times, lifetimeMS, and lifetimeVarianceMS field documentation for more information.
sizesFloat (array)1.0 [PC_SIZE_KEYS]List of sizes to be used for the Particle at each time value specified in the times array field. The first entry in the sizes array corresponds to the initial Particle size, and is interpolated with sizes[1] until times[0] percent of the Particle's lifetime elapses, at which time sizes[1] is the Particle's size and it begins being interpolated with sizes[2]. See the times, lifetimeMS, and lifetimeVarianceMS field documentation for more information.
timesFloat (array)[0.0, 1.0, 2.0 , 2.0]Array of floats; each entry is a value between 0.0 and 1.0 and represents a percentage of a Particle's lifetime. These time percentages are measured against how far along a Particle is in it's life-time to determine what color and size the Particle should be drawn with. See the documentation for the colors and sizes fields for more information. Entries should be given in ascending order, of any entry is smaller than a previous entry, it is ignored. Entries should also be between 0.0 and 1.0, if any entry is not, it is ignored, and so are all subsequent entries.
Physics Data
dragCoefficientFloat0.0Represents the physical property of general velocity drag in a Particle's physics simulation. Used to dampen a Particle's velocity, the dragCoefficient is multiplied by current velocity and the result is subtracted from the current velocity. This field's value must be non-negative, if it is less than zero, a console warning is generated, and the value is forced to zero. The actual value used is only guaranteed to be within 0.2 of the value specified, and values greater than 204.6 may not behave properly.
windCoefficientFloat1.0The engine can be made to specify a wind velocity vector, and the vector can be applied against this field so that simulated wind velocity affects a Particle's acceleration accordingly (global wind velocity is multiplied by the windCoefficient and the result is subtracted from the Particle's acceleration).
gravityCoefficientFloat0.0Scalar multiple applied to the force of gravity before it affect's the particle's acceleration. The actual value used is only guaranteed to be within 0.1 of the value specified.
inheritedVelFactorFloat0.0Scalar multiple applied to the velocity imparted to the particle when it is created. See the ejectionVelocity field documentation of the ParticleEmitterData datablock for more information.
constantAccelerationFloat0.0Represents the Particle's constant base acceleration. Upon creation, the Particle is imparted with this acceleration. Over-time during the physics simulation the particle continues to accelerate at this constant rate, though it may also be affected by drag, wind, and gravity (see the dragCoefficient, windCoefficient, and gravityCoefficient field descriptions for more information).
spinSpeedFloat0.0Used along with spinRandomMin and spinRandomMax to determine the Particle's spin speed (see the spinRandomMax field description for more information). This field's value must be between -10,000.0 and 10,000.0, otherwise a console warning is generated.
spinRandomMinFloat0.0Used along with spinSpeed and spinRandomMax to determine the Particle's spin speed (see the spinRandomMax field description for more information). This field's value must be between -10,000.0 and 10,000.0, otherwise a console warning is generated and the value is forced to -360.0. The value must also be no greater than spinRandomMax, otherwise it is reflected about spinRandomMax's value (if spinRandomMin = spinRandomMax + 100, then spinRandomMin will be adjusted to spinRandomMax - 100).
spinRandomMaxFloat0.0Used along with spinSpeed and spinRandomMin to determine the Particle's spin speed. A random number between spinRandomMin and spinRandomMax is generated and the result is added to the value specified in the spinSpeed field to determine a Particle's actual spin-speed. This field's value must be between -10,000.0 and 10,000.0, otherwise a console warning is generated and the value is forced to 360.0. The value must also be no greater than spinRandomMax, otherwise it is reflected about spinRandomMax's value (if spinRandomMin = spinRandomMax + 100, then spinRandomMin will be adjusted to spinRandomMax - 100).
Behavior Data
lifetimeMSInteger1000Used with lifetimeVarianceMS to determine the total life-time of each emitted particle. Measured in milliseconds. This field's value must be greater than zero, otherwise a console warning is generated and the value is forced to one. To save network transmission bandwidth, the value of lifetimeMS is shifted-right 5 bits, implying a loss of precision. Thus, the lifetime value used may be up to 31 milliseconds less than the value specified. After being shifted, the value is clamped to 10-bits of precision as well; thus, values of more than about 32000 milliseconds will not behave as expected.
lifetimeVarianceMSInteger0Used with lifetimeVarianceMS to determine the total life-time of each emitted particle. Measured in milliseconds. Each time a particle is created, a random number between -1*lifetimeVarianceMS and lifetimeVarianceMS is generated and added to lifetimeMS to determine the particle's total lifetime. This field's value must be no greater than that of lifetimeMS, otherwise a console warning is generated and the value is set to (lifetimeMS - 1). The lifetimeVarianceMS value is shifted and stored with 10-bit precision in the exact manner that lifetimeMS's value is.

With that, we have a reference to all of the datablocks involved in Torque's particle engine. In the next section, we continue studying the derivatives of the SimDataBlock datablock. In fact, we'll take a look at the WheeledVehicleTire and WheeledVehicleSpring datablocks, which were previously mentioned in the vehicle datablocks reference.