Contents

Console Objects Fields and Methods Quick Reference Part 2



This quick reference guide was taken directly out of The Game Programmer's Guide to Torque by Edward Maurina. It's an outstanding resource - a must for anyone wanting to get serious about programming in Torque.


AudioEmitter



Audio emitters are non-visible objects that can be placed in the game world and are used to produce 2D and 3D sound in game. All sounds produced by these emitters are networked. Therefore, all audio profiles, and other sound entities used by emitters must use the datablock keyword (not new).

Fields

Field Name Description Sample or Range
coneInsideAngle Sweep angle of inner cone. [0..360]
coneOutsideAngle Sweep angle of Outside cone. [0..360]
coneOutsideVolume Maximum gain in Zone C (see above). [0.0, 1.0]
coneVector Audio emitter’s eye (pointing) vector. information only (use visual feedback to direct sound)
Description Optional Audio Description Audio Description
enableVisualFeedback Enable visual effects showing audio-cones, facing, and on-off indication. [ false , true ]
fileName Relative or absolute path to sound file. Filename
is3D Enables 3D sound. [ false , true ]
isLooping Enable looping. [ false , true ]
loopCount -1 – Loop infinitely.

0 – Loop once and only once.
1 – Loop once, possibly twice.

(N > 1) – Loop N times.
See Description
maxDistance Outer boundary for 3D sound sphere. Sound turns on-off here at this distance from 3D emitter. [ referenceDistance , inf )
maxLoopGap Maximum delay between subsequent loop. -
minLoopGap Minimum delay between subsequent loop. -
outsideAmbient If true, plays outside only (turns off when player is inside interior). [ false , true ]
position Optional audio profile. AudioProfile
Profile Maximum gain distance. Inner-cone gain is maxed when player is within this distance of 3D emitter. [ 0.0 , maxDistance ]
ReferenceDistance Distance at which sound turns on to 100% of current maximum gain. [ 0.0 , inf.0 )
type Audio type. There can be multiple numeric audio types, each with its own globally controlled max gain. [ 0 , inf )
useProfileDescription Use audio profile instead of values set via inspector. [ false , true ]
volume Emitter’s maximum gain. [ 0.0 , 1.0 ]



AudioProfile



This is a special type of data block used to describe 2-D and 3-D sounds. It can be created using the new keyword or the data block keyword. In the prior case, the audio description is intended to be used for 2-D sounds usually for interfaces and other client-side sounds. Space In the latter case, the audio description is intended to be used for networked sounds. This is a crucial difference.

Fields

Field Name Description Sample or Range
description AudioDescription to use with this AP. see type
environment - ignore - --
fileName Path to WAV or OGG file. ~/path/filename.wav
preload If set to true, file is pre-loaded, otherwise it is loaded on-demand. [ false , true ]


Camera



The camera class is a lightweight class use to represent the position in view of the camera in the game world. It is derived from shape base, and adds no new fields of its own. It adds a few new methods, used to enable free fly mode and orbiting mode.

Globals

Variable Name Description Sample or Range
Camera::movementSpeed Controls the free camera movement speed. [ 0 , inf )


Console Method Summaries

getPosition
setFlyMode
setOrbitMode


Console Methods

getPosition()

Purpose
Use the getPosition method to find the current world position of the camera.

Returns
Return a vector containing the XYZ position of the camera.



setFlyMode()

Purpose
Use the setFlyMode method to toggle the camera between free fly mode and attached mode. In the prior mode, the camera is able to move about the game world free of an avatar, it is in effect the avatar. The latter mode, is when the camera is attached to another object, the control object.

Returns
No return value.

Notes
When if fly-mode, $Camera::movementSpeed controls the movement rate of the camera.



setOrbitMode( orbitObject , transform , minDistance , maxDistance , curDistance , ownClientObject )

Purpose
Use the setOrbitMode method to force the camera to orbit any particular game base object with a starting position and orientation and at a fixed minimum and maximum distance.

Syntax
orbitObject
– The object to orbits about.
transform – A matrix describing both the position and orientation of the camera.
minDistance – The minimum distance the camera is allowed to be from the object it is orbiting about.
maxDistance – The maximum distance the camera is allowed to be from the object it is orbiting about.
curDistance – The starting position of the camera from the object it is orbiting about. Note, this overrides the position portion of the transform, forcing the camera to be at this distance from the object.
ownClientObject – Set this to true if the object the camera is orbiting is owned by the client that owns the camera, otherwise set to false.

Returns
No return value.



CameraData



This is the data block that goes with the camera. It is used to do find any special attributes the camera should have, if it is not in fact to deriving these attributes from the object that it is attached to.

ConsoleLogger



This class is supplied to allow us to capture the output of the console and redirected to a file. Is useful in a variety of situations. It can be set to capture all output, only warnings, or only errors.


Fields

Field Name Description Sample or Range
level Logging level for this logger. normal, warning, error


Debris



Debris objects are used to represent the refuse left behind by an exploding or destroyed object. However, this object is versatile enought to be used for various purposes, to include a rockfall that blocks the road, the remains of a fallen building, etc.


Fields

Field Name Description Sample or Range
lifeTime Lifetime of debris in seconds. [ 0.0 , inf.0 )


Console Method Summaries

init()


Console Method

init( position , velocity )

Purpose
Use the init method to set the initial position and velocity of a debris object.

Syntax
position
– A three-element floating-point vector representing the starting location of the debris object in the game world.
velocity – A three-element floating-point vector representing the direction and magnitude of the debris object's original path.

Returns
Returns true on sucess or false on failure.


DebrisData



The data block that goes with debris. This class is used to describe most of the behavior of the debris.

Fields

Field Name Description Sample or Range
baseRadius Debris starts at minimum of this distance from creation point. Requires useRadiusMass to be true. ( 0.2 , inf.0 )
bounceVariance Total bounces == numBounces +/- bounceVariance. ( 0 , numBounces )
elasticity How bouncy is this debris? Values > 1.0 add energy to the system. [ 0.0 , inf.0 )
emitters[0]
emitters[1]
ParticleEmitterData datablocks used to trail particles behind moving debris. ParticleEmitterData
explodeOnMaxBounce Does this debris explode when it hits maxBounce count? [ false , true ]
Explosion ExplosionData datablock used for exploding debris. ExplosionData
fade If set to true, the debris will start to fade from view in the last second of its liftetime. [ false , true ]
friction How much friction is applied when thid debris slides? [ 0.0 , 1.0 ]
gravModifier How much does gravity affect this debris? ( -inf.0 , inf.0 )
ignoreWater If set to false, debris will bounce off of water, else it will sink. [ false , true ]
lifetime Total life of particle == lifetime +/- lifetimeVariance in milliseconds. [ 0.0 , inf.0 )
lifetimeVariance Total life of particle == lifetime +/- lifetimeVariance in milliseconds. [ 0.0 , lifetime )
maxSpinSpeed Maximum angular rotation of debris in degrees-per-second. ( -inf.0 , inf.0 )
minSpinSpeed Minimum angular rotation of debris in degrees-per-second. ( -inf.0 , inf.0 )
numBounces Total bounces == numBounces +/- bounceVariance. [ 0 , inf )
render2D If this field is set to true, debris will render a billboard using texture as the image source. [ false , true ]
shapeFile The file to be used for this debris' mesh. ~/path/filename
snapOnMaxBounce If set to to true, and staticOnMaxBounce is also true, this debris will 'stick' in its last contact orientation on the surface it contacted. [ false , true ]
staticOnMaxBounce If set to to true, the debris will be replaced (temporarily) with a static shape. This shape will still be destroyed after the debris's total lifetime expires. [ false , true ]
terminalVelocity Maximum velocity at which this debris will fall (or rise). [ 0.0 , inf.0 )
texture A texture to be used for rendering a billboard, if render2D is set to true. ~/path/filename
useRadiusMass If set to true (and baseRadius > 0.2) , the initial rendering position of the debris will be at a random position baseRadius from the creation point. [ false , true ]
velocity Total initial velocity == velocity +/ velocityVariance. [ 0.0 , inf.0 )
velocityVariance Total initial velocity == velocity +/ velocityVariance. [ 0.0 , velocity )


DecalData



A data block describing an individual decal.

Fields

Field Name Description Sample or Range
sizeX The horizontal width in meters. [ 0.0 , inf.0 )
sizeY The vertical height in meters. [ 0.0 , inf.0 )
textureName The full path to the texture to use this decal. ~/path/filename


DecalManager



All details are managed by the decal manager which provides a few global variables for managing the number of decals that are visible at any one time and the lifetime of the decal. As well we can disable all decals.

Globals

Variable Name Description Sample or Range
$pref::decalsOn If set to true, decals are enabled, otherwise no decals will render. [ false , true ]
$pref::Decal::maxNumDecals Maximum decals allowed at any one time. Once this limit is breached, old decals start to be removed as new decals are added. [ 0 , inf )
$pref::Decal::decalTimeout Time in milliseconds it takes for a decal to be destroyed. [ 0 , inf )


EditManager



While editing, it is possible to set bookmarks on the current position of the camera and then come back to that position by going back to the bookmark. Up to 10 bookmarks can be set. Setting a previously set bookmark will overwrite the old bookmark setting with a new bookmark setting. Bookmarks are not saved between sessions.

Console Method Summaries

setBookmark
gotoBookmark


Console Methods

gotoBookmark( slot )

Purpose
Use the gotoBookmark method to move the camera to the bookmark specified by slot.

Syntax
slot
– An integer between 0 and 9.

Returns
No return value.

See Also
setBookmark



setBookmark( slot )

Purpose
Use the setBookmark method to set a bookmark on the current position of the camera. To bookmark is saved in a position specified by slot.

Syntax
slot
– An integer value between zero and nine.

Returns
No return value.

See Also
gotoBookmark


Explosion



The explosion class is used to represent various pyrotechnic displays. It is in fact a combination of multiple other classes used simultaneously or in sequence to produce various special effects.

ExplosionData



This is the data block that goes with the explosion class. It is used to describe all of the action be its of an individual explosion.

Fields

Field Name Description Sample or Range
camShakeAmp The camera shake amplitude for all three axes: X, Y, and Z. "1.0 2.0 3.0"
camShakeDuration Time in seconds the shaking will occur over. ( -inf.0 , inf.0 )
camShakeFalloff Magnitude by which shaking decreases over distance to camShakeRadius. ( -inf.0 , inf.0 )
camShakeFreq The camera shake frequency for all three axes: X, Y, and Z. "1.0 2.0 3.0"
camShakeRadius Radius about the explosion in which shaking will be applied. ( -inf.0 , inf.0 )
Debris DebrisData datablock to use for this explosion. see type
debrisNum Total debris produced == debrisNum +/- debrisNumVariance. ( -inf , inf )
debrisNumVariance Total debris produced == debrisNum +/- debrisNumVariance. ( -inf , inf )
debrisPhiMax Maximum degrees of angular debris projection about the Y axis. ( -inf.0 , inf.0 )
debrisPhiMin Minimum degrees of angular debris projection about the Y axis. ( -inf.0 , inf.0 )
debrisThetaMax Maximum degrees of angular debris projection about an arbitray axis in the X-Z plane. ( -inf.0 , inf.0 )
debrisThetaMin Minimum degrees of angular debris projection about an arbitray axis in the X-Z plane. ( -inf.0 , inf.0 )
debrisVelocity Initial debris projection velocity == debrisVelocity +/- debrisVelocityVariance. ( -inf.0 , inf.0 )
debrisVelocityVariance Initial debris projection velocity == debrisVelocity +/- debrisVelocityVariance. ( -inf.0 , inf.0 )
delayMS Delay explosion 'effect' by delayMS +/- delayVariance after explosion object is created. ( -inf , inf )
delayVariance Delay explosion 'effect' by delayMS +/- delayVariance after explosion object is created. ( -inf , inf )

emitter[0]
emitter[1]
emitter[2]
emitter[3]

ParticleEmitterData to play when explosion occurs. Up to four are allowed. see type
explosionscale The scale of this explosion. "1.0 2.0 3.0"
explosionShape An optional shape that can be displayed at the time of the explosion with an (also) optional 'ambient' animation. ~/path/filename
faceViewer Keep particles facing viewer. [ false , true ]
lifetimeMS Total life of explosion == lifetimeMS +/- lifetimeVariance. ( -inf , inf )
lifetimeVariance Total life of explosion == lifetimeMS +/- lifetimeVariance. ( -inf , inf )
lightEndColor Ending color of light (emitted by explosion). "1.0 0.5 0.5"
lightEndRadius Ending radius of light (emitted by explosion). ( -inf.0 , inf.0 )
lightStartColor Starting color of light (emitted by explosion). "1.0 0.5 0.5"
lightStartRadius Starting radius of light (emitted by explosion). ( -inf.0 , inf.0 )
offset Explosion effects offset from explosion creation point. ( -inf.0 , inf.0 )
particleDensity Total number of particles to eject. ( -inf , inf )
particleEmitter The emitter description (ParticleEmitterData) for this explosion. see type
particleRadius Maximum radius from effect center at which particles will be randomly created. ( -inf.0 , inf.0 )
playSpeed Overall rate of this explosion. Scales all effects. ( -inf.0 , inf.0 )
shakeCamera If set to true, enables camera shaking. [ false , true ]

sizes[0]
sizes[1]
sizes[2]
sizes[3]

Key-framing size controls for particles.

"1.0 2.0 3.0"
"1.0 2.0 3.0"
"1.0 2.0 3.0"
"1.0 2.0 3.0"

soundProfile description see type

subExplosion[0]
subExplosion[1]
subExplosion[2]
subExplosion[3]
subExplosion[4]

Sub-explosions to play as part of this explosion. Up to five sub-explosions are allowed.Using parent explosions as sub-explosions or as children of sub-explosions will create an infinte loop of explosions. ExplosionData datablock

times[0]
times[1]
times[2]
times[3]

Key-framing time controls for particles.

[ 0.0, times[1] ]
[ times[0], times[2] ]
[ times[1], times[3] ]
[ times[2], 1.0 ]


Table of Contents || Part 1 || Part 3 || Part 4 || Part 5 || Part 6 || Part 7 || Part 8 || Part 9 || Part 10 || Part 11 || Part 12 || Part 13 || Part 14 || Part 15