Torque 3D - Script Manual: ProjectileData Class Reference

TorqueScript

Main   Class List   Namespace List   Online

ProjectileData Class Reference
[Game Objects]

Stores properties for an individual projectile type. More...

Inheritance diagram for ProjectileData:

List of all members.

Public Member Functions

Callbacks

void onCollision (Projectile proj, SceneObject col, float fade, Point3F pos, Point3F normal)
 Called when a projectile collides with another object.
void onExplode (Projectile proj, Point3F pos, float fade)
 Called when a projectile explodes.

Public Attributes

int armingDelay
 Amount of time, in milliseconds, before the projectile will cause damage or explode on impact.
float bounceElasticity
 Influences post-bounce velocity of a projectile that does not explode on contact.
float bounceFriction
 Factor to reduce post-bounce velocity of a projectile that does not explode on contact.
DecalData decal
 Decal datablock used for decals placed at projectile explosion points.
ExplosionData Explosion
 Explosion datablock used when the projectile explodes outside of water.
int fadeDelay
 Amount of time, in milliseconds, before the projectile begins to fade out.
float gravityMod
 Scales the influence of gravity on the projectile.
float impactForce
bool isBallistic
 Detetmines if the projectile should be affected by gravity and whether or not it bounces before exploding.
int lifetime
 Amount of time, in milliseconds, before the projectile is removed from the simulation.
LightDescription lightDesc
 LightDescription datablock used for lights attached to the projectile.
float muzzleVelocity
 Amount of velocity the projectile recieves from the "muzzle" of the gun.
ParticleEmitterData ParticleEmitter
 Particle emitter datablock used to generate particles while the projectile is outside of water.
ParticleEmitterData particleWaterEmitter
 Particle emitter datablock used to generate particles while the projectile is submerged in water.
filename projectileShapeName
 File path to the model of the projectile.
Point3F scale
 Scale to apply to the projectile's size.
SFXTrack sound
 SFXTrack datablock used to play sounds while in flight.
SplashData Splash
 Splash datablock used to create splash effects as the projectile enters or leaves water.
float velInheritFactor
 Amount of velocity the projectile recieves from the source that created it.
ExplosionData waterExplosion
 Explosion datablock used when the projectile explodes underwater.

Detailed Description

Stores properties for an individual projectile type.

Example:
datablock ProjectileData(GrenadeLauncherProjectile)
{
 projectileShapeName = "art/shapes/weapons/SwarmGun/rocket.dts";
directDamage = 30;
radiusDamage = 30;
damageRadius = 5;
areaImpulse = 2000;
explosion = GrenadeLauncherExplosion;
waterExplosion = GrenadeLauncherWaterExplosion;
decal = ScorchRXDecal;
splash = GrenadeSplash;
particleEmitter = GrenadeProjSmokeTrailEmitter;
particleWaterEmitter = GrenadeTrailWaterEmitter;
muzzleVelocity = 30;
velInheritFactor = 0.3;
armingDelay = 2000;
lifetime = 10000;
fadeDelay = 4500;
bounceElasticity = 0.4;
bounceFriction = 0.3;
isBallistic = true;
gravityMod = 0.9;
lightDesc = GrenadeLauncherLightDesc;
damageType = "GrenadeDamage";
};

Member Function Documentation

void ProjectileData::onCollision ( Projectile  proj,
SceneObject  col,
float  fade,
Point3F  pos,
Point3F  normal 
)

Called when a projectile collides with another object.

This function is only called on server objects.

Parameters:
proj The projectile colliding with SceneObject col.
col The SceneObject hit by the projectile.
fade The current fadeValue of the projectile, affects its visibility.
pos The position of the collision.
normal The normal of the collision.
See also:
Projectile
void ProjectileData::onExplode ( Projectile  proj,
Point3F  pos,
float  fade 
)

Called when a projectile explodes.

This function is only called on server objects.

Parameters:
proj The exploding projectile.
pos The position of the explosion.
fade The current fadeValue of the projectile, affects its visibility.
See also:
Projectile

Member Data Documentation

Amount of time, in milliseconds, before the projectile will cause damage or explode on impact.

This value must be equal to or less than the projectile's lifetime.

See also:
lifetime

Influences post-bounce velocity of a projectile that does not explode on contact.

Scales the velocity from a bounce after friction is taken into account. A value of 1.0 will leave it's velocity unchanged while values greater than 1.0 will increase it.

Factor to reduce post-bounce velocity of a projectile that does not explode on contact.

Reduces bounce velocity by this factor and a multiple of the tangent to impact. Used to simulate surface friction.

Decal datablock used for decals placed at projectile explosion points.

Explosion datablock used when the projectile explodes outside of water.

Amount of time, in milliseconds, before the projectile begins to fade out.

This value must be smaller than the projectile's lifetime to have an affect.

Scales the influence of gravity on the projectile.

The larger this value is, the more that gravity will affect the projectile. A value of 1.0 will assume "normal" influence upon it. The magnitude of gravity is assumed to be 9.81 m/s/s

Note:
ProjectileData::isBallistic must be true for this to have any affect.

Detetmines if the projectile should be affected by gravity and whether or not it bounces before exploding.

Amount of time, in milliseconds, before the projectile is removed from the simulation.

Used with fadeDelay to determine the transparency of the projectile at a given time. A projectile may exist up to a maximum of 131040ms (or 4095 ticks) as defined by Projectile::MaxLivingTicks in the source code.

See also:
fadeDelay

LightDescription datablock used for lights attached to the projectile.

Amount of velocity the projectile recieves from the "muzzle" of the gun.

Used with velInheritFactor to determine the initial velocity of the projectile. This value is never modified by the engine.

Note:
This value by default is not transmitted between the server and the client.
See also:
velInheritFactor

Particle emitter datablock used to generate particles while the projectile is outside of water.

Note:
If datablocks are defined for both particleEmitter and particleWaterEmitter, both effects will play as the projectile enters or leaves water.
See also:
particleWaterEmitter

Particle emitter datablock used to generate particles while the projectile is submerged in water.

Note:
If datablocks are defined for both particleWaterEmitter and particleEmitter , both effects will play as the projectile enters or leaves water.
See also:
particleEmitter

File path to the model of the projectile.

Scale to apply to the projectile's size.

Note:
This is applied after SceneObject::scale

SFXTrack datablock used to play sounds while in flight.

Splash datablock used to create splash effects as the projectile enters or leaves water.

Amount of velocity the projectile recieves from the source that created it.

Use an amount between 0 and 1 for the best effect. This value is never modified by the engine.

Note:
This value by default is not transmitted between the server and the client.

Explosion datablock used when the projectile explodes underwater.



Copyright © GarageGames, LLC. All Rights Reserved.