Torque 3D - Script Manual: Lightning Class Reference

TorqueScript

Main   Class List   Namespace List   Online

Lightning Class Reference
[Special EffectsAtmosphere]

An emitter for lightning bolts. More...

Inheritance diagram for Lightning:

List of all members.

Public Member Functions

void strikeObject (int id=NULL)
 Creates a LightningStrikeEvent which strikes a specific object.
void strikeRandomPoint ()
 Creates a LightningStrikeEvent which attempts to strike and damage a random object in range of the Lightning object.
void warningFlashes ()
 Creates a LightningStrikeEvent that triggers harmless lightning bolts on all clients. No objects will be damaged by these bolts.
Callbacks

void applyDamage (Point3F hitPosition, Point3F hitNormal, SceneObject hitObject)
 Informs an object that it was hit by a lightning bolt and needs to take damage.

Public Attributes

Bolts

float boltStartRadius
 Radial distance from the center of the Lightning object for the start point of the bolt.
float chanceToHitTarget
 Percentage chance (0-1) that a given lightning bolt will hit something.
bool useFog
 Controls whether lightning bolts are affected by fog when they are rendered.
Colors

ColorF color
 Color to blend the strike texture with.
ColorF fadeColor
 Color to blend the strike texture with when the bolt is fading away.
Strikes

float strikeRadius
 Horizontal size (XY plane) of the search box used to find and damage Player or Vehicle objects within range of the strike.
int strikesPerMinute
 Number of lightning strikes to perform per minute.
float strikeWidth
 Width of a lightning bolt.

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

An emitter for lightning bolts.

Lightning strike events are created on the server and transmitted to all clients to render the bolt. The strike may be followed by a random thunder sound. Player or Vehicle objects within the Lightning strike range can be hit and damaged by bolts.

See also:
LightningData

Member Function Documentation

void Lightning::applyDamage ( Point3F  hitPosition,
Point3F  hitNormal,
SceneObject  hitObject 
)

Informs an object that it was hit by a lightning bolt and needs to take damage.

Parameters:
hitPosition World position hit by the lightning bolt.
hitNormal Surface normal at hitPosition.
hitObject Player or Vehicle object that was hit.
Example:
function Lightning::applyDamage( %this, %hitPosition, %hitNormal, %hitObject )
{
   // apply damage to the player
   %hitObject.applyDamage( 25 );
}
void Lightning::strikeObject ( int  id = NULL  ) 

Creates a LightningStrikeEvent which strikes a specific object.

Note:
This method is currently unimplemented.
void Lightning::strikeRandomPoint (  ) 

Creates a LightningStrikeEvent which attempts to strike and damage a random object in range of the Lightning object.

Example:
// Generate a damaging lightning strike effect on all clients
%lightning.strikeRandomPoint();
void Lightning::warningFlashes (  ) 

Creates a LightningStrikeEvent that triggers harmless lightning bolts on all clients. No objects will be damaged by these bolts.

Example:
// Generate a harmless lightning strike effect on all clients
%lightning.warningFlashes();

Member Data Documentation

Radial distance from the center of the Lightning object for the start point of the bolt.

The actual start point will be a random point within this radius.

Percentage chance (0-1) that a given lightning bolt will hit something.

Color to blend the strike texture with.

Color to blend the strike texture with when the bolt is fading away.

Bolts fade away automatically shortly after the strike occurs.

Horizontal size (XY plane) of the search box used to find and damage Player or Vehicle objects within range of the strike.

Only the object at highest altitude with a clear line of sight to the bolt will be hit.

Number of lightning strikes to perform per minute.

Automatically invokes strikeRandomPoint() at regular intervals.

Width of a lightning bolt.

Controls whether lightning bolts are affected by fog when they are rendered.



Copyright © GarageGames, LLC. All Rights Reserved.