Debris

consoledoc.h

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

More...

Debris

float

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

Public Static Attributes

bool

Disables rendering of all instances of this type.

bool

Disables selection of all instances of this type.

Public Functions

bool
init(string inputPosition, string inputVelocity)

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

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.

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.

Debris

float lifetime 

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.

Public Static Attributes

bool isRenderable 

Disables rendering of all instances of this type.

bool isSelectable 

Disables selection of all instances of this type.

Public Functions

init(string inputPosition, string inputVelocity)

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.

return:

Always returns true.

// 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);