Torque 3D - Script Manual: Debris Class Reference

TorqueScript

Main   Class List   Namespace List   Online

Debris Class Reference
[Special Effects]

Base debris class. Uses the DebrisData datablock for properties of individual debris objects. More...

Inheritance diagram for Debris:

List of all members.

Public Member Functions

bool init (string inputPosition="1.0 1.0 1.0", string inputVelocity="1.0 0.0 0.0")
 Manually set this piece of debris at the given position with the given velocity.

Public Attributes

Debris

float lifetime
 Length of time for this debris object to exist. When expired, the object will be deleted.

Static Public Attributes

static bool isRenderable
 Disables rendering of all instances of this type.
static bool isSelectable
 Disables selection of all instances of this type.

Detailed Description

Base debris class. Uses the DebrisData datablock for properties of individual debris objects.

Debris is typically made up of a shape and up to two particle emitters. In most cases Debris objects are not created directly. They are usually produced automatically by other means, such as through the Explosion class. When an explosion goes off, its ExplosionData datablock determines what Debris to emit.

Example:
datablock ExplosionData(GrenadeLauncherExplosion)
{
   // Assiging debris data
   debris = GrenadeDebris;

   // Adjust how debris is ejected
   debrisThetaMin = 10;
   debrisThetaMax = 60;
   debrisNum = 4;
   debrisNumVariance = 2;
   debrisVelocity = 25;
   debrisVelocityVariance = 5;

   // Note: other ExplosionData properties are not listed for this example
};
Note:
Debris are client side only objects.
See also:
DebrisData
ExplosionData
Explosion

Member Function Documentation

bool Debris::init ( string  inputPosition = "1.0 1.0 1.0",
string  inputVelocity = "1.0 0.0 0.0" 
)

Manually set this piece of debris at the given position with the given velocity.

Usually you do not manually create Debris objects as they are generated through other means, such as an Explosion. This method exists when you do manually create a Debris object and want to have it start moving.

Parameters:
inputPosition Position to place the debris.
inputVelocity Velocity to move the debris after it has been placed.
Returns:
Always returns true.
Example:
// Define the position
%position = "1.0 1.0 1.0";

// Define the velocity
%velocity = "1.0 0.0 0.0";

// Inform the debris object of its new position and velocity
%debris.init(%position,%velocity);

Member Data Documentation

Length of time for this debris object to exist. When expired, the object will be deleted.

The initial lifetime value comes from the DebrisData datablock.

See also:
DebrisData::lifetime
DebrisData::lifetimeVariance


Copyright © GarageGames, LLC. All Rights Reserved.