Contents

Console Objects Fields and Methods Quick Reference Part 9


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.

Precipitation




Fields

Field Name Description Sample or Range
boxHeight Height of box (around camera) where precipitation occurs. ( 0.0 , inf )
boxWidth Width of box (around camera) where precipitation occurs. ( 0.0 , inf )
doCollision Allow precipitation to collide with objects vs. fall through. [ false , true ]
maxMass Maximum mass per drop. [ minMass , inf )
maxSpeed Maximum speed per drop. [ minSpeed , inf )
maxTurbulence Max turbulence to apply per drop. [ 0.0 , inf )
minMass Minimum mass per drop. [ 0.0 , maxMass ]
minSpeed Minimum speed per drop. [ 0.0 , maxSpeed ]
numDrops Approximate number of drops allowed to exist at any one time. ( 0 , inf )
rotateWithCamVel Drops rotate to face camera. [ false , true ]
turbulenceSpeed Velocity (of drops) at which turbulence kicks in. [ 0.0 , inf )
useTurbulence Enable turbulence effect. [ false , true ]


Console Method Summaries

modifyStorm setPercentage


Console Methods

modifyStorm( percentage , time )

Purpose
Use the modifyStorm method to adjust the percentage of raindrops falling over time period.

Syntax
percentage
– Percent of raindrops to render. [ 0.0 , 1.0 ]
time – Period of transition in seconds.( 0.0 , inf )

Returns
No return value.

See Also
setPercentage



setPercentage( percentage )

Purpose
Use the setPercentage method to imediately adjust the percentage of raindrops falling.

Syntax
percentage
– Percent of raindrops to render. [ 0.0 , 1.0 ]

Returns
No return value.

See Also
modifyStorm


PrecipitationData



Fields

Field Name Description Sample or Range
dropSize Render size for drops. ( 0.0 , inf )
dropTexture Texture file (4 x 4 bitmap array) to use for drops. texture Path
soundProfile Looping 2D audio profile to play with precipitation. Audio Profile Name
splashMS Life of splashes in milliseconds. ( 0 , inf )
splashSize Size of splashes. ( 0.0 , inf )
splashTexture Texture to use for splashes (4 x 4 bitmap array). texture path
useTrueBillboards Drops behave like true (non axis-aligned) billboards. [ false , true ]


Projectile



Fields

Field Name Description Sample or Range
initialPosition Position that projectile starts at. "1.0 2.0 3.0"
initialVelocity Starting velocity of projectile. "1.0 2.0 3.0"
sourceObject description ( -inf , inf )
sourceSlot description ( -inf , inf )


ProjectileData



Fields

Field Name Description Sample or Range
armingDelay The number of ticks that must pass after the Projectile is created before it can explode. Valid range is 0 to Projectile::MaxLivingTicks (4095 by default). ( -inf , inf )
bounceElasticity Used to simulate the Projectile's bounce elasticity, if it collides with something but does not explode. The bounce elasticity scales the velocity from a bounce, after friction is taken into account. [ 0.0 , 0.999 ]
bounceFriction On bounce, reduce projectile velocity by this factor and a multiple of the tangent to impact. ( -inf.0 , inf.0 )

decals[0]
...
decals[5]

Array of pointers to DecalData datablocks. A non-NULL decal object will be randomly chosen from the array when the Projectile collides with the terrain or an interior. DecalData datablock
explosion ExplosionData datablock used when the Projectile object blows up out of water. see type
fadeDelay The number of ticks that must pass after the Projectile is created before it will begin becoming transparent. Projectile's opacity will follow a linear degression starting fadeDelay number of ticks after it is creating and ending at lifetime number of ticks. Valid range is 0 to Projectile::MaxLivingTicks (4095 by default). ( -inf , inf )
gravityMod If isBallistic is true, scales the effect of gravity on the Projectile. Valid range is 0.0 to 1.0. ( -inf.0 , inf.0 )
hasLight Specifies whether the Projectile object sheds light when not in water. If so, a point light object is used with the radius and color specified in the lightRadius and lightColor fields. [ false , true ]
hasWaterLight Specifies whether the Projectile object sheds light when in water. If so, a point light object is used with the radius and color specified in the lightRadius and waterLightColor fields. [ false , true ]
isBallistic Specifies whether the Projectile will be affected by gravity, and whether it can bounce before exploding. [ false , true ]
lifetime The number of ticks the Projectile should survive for. Also used along with fadeDelay to determine the transparency of the Projectile object at a given time. See the fadeDelay field documentation for more information. The valid range for lifetime values is 0 to Projectile::MaxLivingTicks (4095 by default). ( -inf , inf )
lightColor The projectile's point light color for use when not in water. "1.0 0.5 0.5"
lightRadius The projectile's point light radius. Valid range is 1.0 to 20.0 ( -inf.0 , inf.0 )
muzzleVelocity Note: this field currently has no tangible effect in the engine simulation itself, but it is useful in script, and its valid range is checked by the engine. Valid range is from 0.0 to 10,000.0 ( -inf.0 , inf.0 )
particleEmitter ParticleEmitter datablock used to generate particles for the projectile when it is out of water, and when entering or leaving water. see type
particleWaterEmitter ParticleEmitter datablock used to generate particles for the projectile when it is under water, and when it is entering or leaving water. see type
projectileShapeName The name of the shape file for the Projectile object. Must adhere to the semantics associated with the Filename datatype as defined in the engine. ~/path/filename.dts
sound AudioProfile used to generate the Projectile object's sound. see type
Splash SplashData datablock used in the generation of splash effects when the Projectile is entering or leaving water. see type
velInheritFactor Note: this field currently has no tangible effect in the engine simulation itself, but it is useful in script, and its valid range is checked by the engine. Valid range is from 0.0 to 1.0. ( -inf.0 , inf.0 )
waterExplosion ExplosionData datablock used when the Projectile object blows up in the water. see type
waterLightColor The projectile's point light color for use when in water. "1.0 0.5 0.5"


SceneObject



Console Method Summaries

getForwardVector getObjectBox getPosition
getScale getTransform getWorldBox
getWorldBoxCenter setScale setTransform


Console Methods

getForwardVector()

Purpose
Use the getForwardVector method to get the three-element floating-point vector representing the direction the object is facing.

Returns
Returns a three-element floating-point vector representing the direction the object is facing.

Notes
Forward for all SceneObjects is positive-Y. So, this vector represents the direction the SceneObject's positive-Y axis is pointing.



getObjectBox()

Purpose
Use the getObjectBox method to get the six-element floating-point vector containing two three-space points representing the unscaled and unrotated bounding box for this object.

Returns
Returns a six-element floating-point vector containing two three-space points representing the bounds of this box:

"minX minY minZ maxX maxY maxZ"

Notes
This box is unscaled and represents the bounding box of the exported, pre-scaled object.

See Also
getWorldBox



getPosition()

Purpose
Use the getPosition method to get the current position of this object.

Returns
A three-element vector containing the XYZ world position of this SceneObject.

See Also
getTransform, setTransform



getScale()

Purpose
Use the getScale method to get the scale of this SceneObject.

Returns
Returns a three-element vector containing the XYZ scale of this SceneObject.

See Also
setScale



getTransform()

Purpose
Use the getTransform method to get the transform matrix for this SceneObject.

Returns
Returns a seven-element matrix/vector containing the following information:

“ PosX PosY PoxZ RotX RotY RotZ theta “, where theta is a rotation about the axis formed by “ RotX RotY RotZ “.

Notes
Use the getWord(), getWords(), and setWord() string functions for parsing the transform vector.

See Also
setTransform



getWorldBox()

Purpose
Use the getWorldBox method to get the six-element floating-point vector containing two three-space points representing the scaled and unrotated bounding box for this object.

Returns
Returns a six-element floating-point vector containing two three-space points representing the bounds of this box:

"minX minY minZ maxX maxY maxZ"

Notes
This box is scaled such that it will contain all points on the current object, regardless of scaling and rotation. Thus, as an irregularly shaped object rotates, its world box will change.

See Also
getObjectBox



getWorldBoxCenter()

Purpose
Use the getWorldBoxCenter method to get the centroid of this objects world box.

Returns
Returns a three-element position vector representing the centroid of this objects's world box.

See Also
getWorldBox



setScale( scale )

Purpose
Use the setScale method to set the XYZ scaling factor for this object.

Syntax
scale
– An XYZ vector containing the new scaling factor for this object.

Returns
No return value.

See Also
getScale



setTransform( transform )

Purpose
Use the setTransform method to apply a new transform to this object.

Syntax
transform
– A seven-element matrix/vector containing the following information:

“ PosX PosY PoxZ RotX RotY RotZ theta “, where theta is a rotation about the axis formed by “ RotX RotY RotZ “.

Returns
No return value.

Notes
This will both translate and rotate the object.

See Also
getTransform



ScriptGroup



Fields

Field Name Description Sample or Range
class A new namespace to place after the object's name and before ScriptObject in the namespace chain. “Rectangle”
superClass A new namespace to place after class and before ScriptObject in the namespace chain. “Polyhedron”


ScriptObject



Fields

Field Name Description Sample or Range
class A new namespace to place after the object's name and before ScriptObject in the namespace chain. “Rectangle”
superClass A new namespace to place after class and before ScriptObject in the namespace chain. “Polyhedron”


ScriptBase



Globals

Variable Name Description Sample or Range
SB::DFDec Damage flash reduced by this amount per tick. ( 0.0, 1.0 ]
SB::WODec Whiteout reduced by this amount per tick. ( 0.0, 1.0 ]
pref::environmentMaps Enables environmental mapping for all shapes. [ false , true ]


Console Functions

getShadowDetailLevel()


setShadowDetailLevel( level )

Purpose
Use the setShadowDetailLevel function to modify the detail level of dynamically cast shadows.

Syntax
level
– A floating-point value bewteen 0.0 and 1.0, where 0.0 is low-quality and 1.0 is high quality.

Returns
No return value.


Console Method Summaries

applyDamage applyImpulse applyRepair
canCloak getAIRepairPoint getCameraFov
getControllingClient getControllingObject getDamageFlash
getDamageLevel getDamagePercent getDamageState
getEnergyLevel getEnergyPercent getEyePoint
getEyeTransform getEyeVector getImageAmmo
getImageLoaded getImageSkinTag getImageState
getImageTrigger getMountedImage getMountedObject
getMountedObjectCount getMountedObjectNode getMountNodeObject
getMountSlot getMuzzlePoint getMuzzleVector
getObjectMount getPendingImage getRechargeRate
getRepairRate getShapeName getSkinName
getSlotTransform getVelocity getWhiteOut
isCloaked isDestroyed isDisabled
isEnabled isHidden isImageFiring
isImageMounted isMounted mountImage
mountObject pauseThread playAudio
playThread setCameraFov setCloaked
setDamageFlash setDamageLevel setDamageState
setDamageVector setEnergyLevel setHidden
setImageAmmo setImageLoaded setImageTrigger
setInvincibleMode setRechargeRate setRepairRate
setShapeName setSkinName setThreadDir
setVelocity setWhiteOut startFade
stopAudio stopThread unmount


Console Methods


Cloaking

canCloak isCloaked setCloaked


canCloak()

Purpose
Use the canCloak method to determine if this shape is able to cloak.

Returns
Returns true if this shape is allowed to cloak, false otherwise.

See Also
isCloaked, setCloaked



isCloaked()

Purpose
Use the isCloaked method to determine if this shape is currently cloaked.

Returns
Returns true if the shape is currently cloaked.

See Also
canCloak, setCloaked



setCloaked( isCloaked )

Purpose
Use the setCloaked method to cloak or uncloak the current shape.

Syntax
isCloaked
– A boolean value. If set to true, this shape will be cloaked, otherwise it will be uncloaked.

Returns
No return value.

See Also
canCloak, isCloaked


Hiding and Fading

isHidden setHidden startFade


isHidden()

Purpose
Use the isHidden method to see if this shape is currently hidden.

Returns
Returns true if the object is hidden, false otherwise.

See Also
setHidden

Returns ID of this object's datablock.



setHidden( isHidden )

Purpose
Use the setHidden method to hide or unhide this shape.

Syntax
isHidden
– A boolean value. If set to true, this shape will be hidden, otherwise it will be un-hidden.

Returns
No return value.

Notes
When an object is hidden it is temporarily removed from the scene and therefore will not render or be collided with.

See Also
isHidden



startFade( time , delay , fadeOut )

Purpose
Use the startFade method to fade this shape in and out of view without removing it from the scene.

Syntax
time
– specifies the timeit takes (in milliseconds) for the fade to complete.
delay – specifes the time to wait (in milliseconds) before starting to fade.
fadeOut – If true, shape fades out, else shape fades in.

Returns
No return value.

Notes
Items have the ability to light their surroundings. When an Item with an active light is fading out, the light it emits is correspondingly reduced until it goes out. Likewise, when the item fades in, the light is turned-up till it reaches it's normal brightntess.
A faded out object is still in the scene and can still be collided with, so if you want to disable collisions for this shape after it fades out use setHidden to temporarily remove this shape from the scene.

See Also
setHidden


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