Contents

Console Objects Fields and Methods Quick Reference Part 8


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.

PathCamera



This object is a special version of the camera that can be placed on a path. The camera can then be made to travel along this path. This feature can be used for many purposes, including cut-scenes, in-game movies, demos, etc.

Console Method Summaries

popFront pushBack pushFront
reset setPosition setState


Console Methods

popFront()

Purpose
Use the popFront method to remove a knot from the front of the camera's knot queue.

Returns
No return value.

Notes
Removes first node in path, does not affect node base or position.

See Also
pushBack, pushFront



pushBack( transform , speed , type , path )

Purpose
Use the pushBack method to add a new knot to the back of a path camera's path.

Syntax
transform
– Transform vector for new knot.
speed – Speed setting for knot.
type – Knot type. (“Normal”, “Position Only”, “Kink”)
path – Path type. (“Linear”, “Spline”)

Returns
No return value.

See Also
pushFront



pushFront( transform , speed , type , path )

Purpose
Use the pushFront method to add a new knot to the front of a path camera's path.

Syntax
transform
– Transform vector for new knot.
speed – Speed setting for knot.
type – Knot type. (“Normal”, “Position Only”, “Kink”)
path – Path type. (“Linear”, “Spline”)

Returns
No return value.

See Also
pushBack



reset( [ speed ] )

Purpose
Use the reset method to move the camera back to the beginning of the path and optionally give it a new travel speed.

Syntax
speed
– A positive floating-point value corresponding to the rate of travel for the camera.

Returns
No return value.

See Also
setState



setPosition( pos )

Purpose
Use the setPosition method to set the position of the camera on a path as a percentage.

Syntax
pos
– A floating point value equal to the position on the current camera path. Between 0.0 and 1.0.

Returns
No return value.

See Also
setState, setTarget



setState( state )

Purpose
Use the setState method to set the camera's current movement state.

Syntax
state
– A string containing either:
forward – moving from front of path to back of path.
backward – moving from back of path to front of path.
stop - not moving.

Returns
No return value.

See Also
reset, setPosition



setTarget( pos )

Purpose
Use the setTarget method to set the next position target for this path camera. A path camera will travel along the path until it reaches the current target. This target is set as a percentage of the entire path.

Syntax
pos
– A floating point value represent the next target on this path camera's path. Between 0.0 and 1.0.

Returns
No return value.

Notes
Setting a target position behind the current path camera position will not make the camera travel in reverse unless the moving state is backward.

See Also
setPosition, setState


PhysicalZone



Fields

Field Name Description Sample or Range
appliedForce Three-element floating point value representing forces in three axes to apply to objects entering pzone.

“x y z”
Each value in range:
[ -40000 , 40000 ]

gravityMod Gravity in pzone. Multiplies against standard gravity. ( -inf.0 , inf.0 )
polyhedron Floating point values describing outer bounds of pzone. -
velocityMod Multiply velocity of objects entering zone by this value every tick. [ -40000 , 40000 ]


Console Method Summaries

activate deactivate


Console Methods

activate()

Purpose
Use the activate method to enable this physicalZone. Once enabled, all of the physicalZone attributes will be in effect.

Returns
No return value.

See Also
deactivate



deactivate()

Purpose
Use the deactivate method to disable this physicalZone. Once disabled, none of the physicalZone attributes will be in effect.

Returns
No return value.

See Also
activate


Player



Console Method Summaries

checkDismountPoint clearControlObject getControlObject
getDamageLocation getState setActionThread


Console Methods

checkDismountPoint( oldPos , pos )

Purpose
Use the checkDismountPoint method to see if dismounting a player from one position to another will cause a collision, or a cohabitation of space.

Syntax
oldPos
– Original position of player.
pos – Intended position of player.

Returns
Returns true if the new position does not result in any collisions, false otherwise.

Notes
This can be used for a variety of things besides dismounting checks. Basically, any time you want to check if a player can be moved into a new position, you may use this.



clearControlObject()

Purpose
Use the clearControlObject method to undo the results of a call to player.setControlObject, re-establishing this player as the control object.

Returns
No return value.

Notes
It is possible to temporarily make another player receive move commands that would normally be sent to this player, while leaving this player in place. Unless moved, the camera will stay mounted to this player, while the other player receives movement inputs.

See Also
getControllingObject, setControlObject

Description



getControllingObject()

Purpose
Use the getControllingObject method to determine if this player object is receiving input commands from another player.

Returns
Returns 0 if this object is not being controlled by another player object, or it will return a non-zero positive integer specifying the ID of the player object that is controlling this player.

Notes
It is possible to temporarily make another player receive move commands that would normally be sent to this player, while leaving this player in place. Unless moved, the camera will stay mounted to this player, while the other player receives movement inputs.

See Also
clearControlObject, setControlObject

Description

Returns float



getDamageLocation( damagePosition )

Purpose
Use the getDamageLocation method to get the named damage location and modifier for a given damagePosition. The player object can differentiate 'hit' locations based on a pre-defined set of datablock settings. You may modify these settings, to vary the percentage of area given over to any body region.

Syntax
damagePosition
– A position for which to retrieve a body region on this player.

Returns
Returns a string containing two words (space separated strings), where the first is a location and the second is a modifier:

Posible locations

  • legs
  • torso
  • head


Head modifiers

  • front_left
  • front_right
  • back_left
  • back_right


Legs/Torso modifiers

  • middle_back
  • right_back
  • left_middle
  • middle_middle
  • right_middle
  • left_front
  • middle_front
  • right_front


Notes
Positions do not need to be on or even near the player. The engine will calculate which body location and modifier best fit any position relative to the player.



getState()

Purpose
Use the getState method to get the current state of this player.

Returns
Returns a string specifying the current state of the player:

Possible states
Dead – Damage less than or equal to disabledLevel
Mounted – Mounted to another object.
Move - Alive and able to move.
Recover – Recovering from a long fall or hard impact (unable to move).

Notes
The most important fact to note is that your player is considered dead at the disabledLevel, not the destroyedLevel.



setActionThread( string sequenceName , hold , fps )

Purpose
Use the setActionThread method to play a specific animation. This is similar to the playThread method that comes with all ShapeBase objects, but it is designed for full body animations and comes with a few different options. Optionally, a player may be told to play a thread and then to hold at the last frame of that animation until another over-rides it.

Syntax
sequenceName
– A string containing the name of the animation to play.

Returns
No return value.



setControlObject( obj )

Purpose
Use the setControlObject method to have this player object 'control' another player object. Doing so will re-direct movement inputs from this player object to the controlled player object. This can be used when you want one player to act as a mount for another player.

Syntax
obj
– The ID of the surrogate player that should now receive movement inputs previously destined for this player.

Returns
Returns true on success, and false on failure.

Notes
It is possible to temporarily make another player receive move commands that would normally be sent to this player, while leaving this player in place. Unless moved, the camera will stay mounted to this player, while the other player receives movement inputs.

See Also
clearControlObject, getControllingObject


PhysicalZone



Fields

Field Name Description Sample or Range
Rendering
renderFirstPerson If true, render the player mesh while in 1st POV. [ false , true ]
Pickups
pickupRadius Can be used to increase the sizeof the player box for item collisions ONLY. [ 0.0 , inf.0 )
Looking
maxFreelookAngle Maximum free-look angle in radians. [ -3.14159 , 3.14159 ]
maxLookAngle Maximum look angle in radians. [ -3.14159 , 3.14159 ]
minLookAngle Minimum look angle in radians. [ -3.14159 , 3.14159 ]
Time Scaling
maxTimeScale Limits animation scaling. Animations will scale up to this amount when matching ground velocity. [ 0.0 , inf.0 )
Step Height
maxStepHeight Maximum height player will be able to step up. Heights larger than this will stop a walking player. [ 0.0 , inf.0 )
Forces and Factors
horizMaxSpeed Maximum horizontal velocity on ground, in air, or in water. --
horizResistFactor Delta factor used to determine how muchof 'horizResistspeed' is removed from current velocity. --
horizResistSpeed Velocity at which horizontal resistance kicks in. --
jumpDelay Forced delay between jumps (in ticks). --
jumpEnergyDrain Drain this many energy points for every jump. --
jumpForce Force applied to player on jump. Should be less than 40000 * mass. --
jumpSurfaceAngle Cannot jump if surface angle equal to or greater to this many degrees. --
maxJumpSpeed Cannot jump if running faster than this. --
minJumpEnergy Cannot jump if energy lower than this. --
minRunEnergy Cannot run if energy lower than this. --
recoverDelay Number of ticks that player stays in 'recovery mode' after hard impact. [ 0 , inf ]
recoverRunForceScale Run force is multiplied by this amount during 'recovery'. [ 0.0 , 1.0 ]
runEnergyDrain Drain this much energy per tick while running. --
runForce Accelerate player by this much per tick as a result of a move (command). Should be less than 40000 * mass. --
runSurfaceAngle Cannot accelerate if surface angle equal to or greater to this many degrees. --
upMaxSpeed Maximum velocity allowed in the positve Z direction. --
upResistFactor Delta factor used to determine how muchof 'upResistSpeed' is removed from current velocity. --
upResistSpeed Velocity at which vertical resistance kicks in. --
Velocity
maxBackwardSpeed Maximum backward velocity in m/s. --
maxForwardSpeed Maximum forward velocity in m/s. --
maxSideSpeed Maximum sideway velocity in m/s. --
maxUnderwaterBackwardSpeed Maximum underwater backward velocity in m/s. --
maxUnderwaterForwardSpeed Maximum underwater forward velocity in m/s. --
maxUnderwaterSideSpeed Maximum underwater sideway velocity in m/s. --
Impacts0
groundImpactMinSpeed The velocity at which a collision with the ground is registered as an impact. [ 0.0 , inf.0 )
groundImpactShakeAmp Camera shake amplitude when a ground impact is registered. “1.0 1.0 10.0“
groundImpactShakeDuration Camera shake duration when a ground impact is registered. [ 0.0 , inf.0 )
groundImpactShakeFalloff a multiplier determining at what rate the shaking from an impact is reduced over time. [ 0.0 , inf.0 )
groundImpactShakeFreq Camera shake frequency when a ground impact is registered. “4.0 4.0 4.0“
minImpactSpeed The velocity at which a collision with the any object is registered as an impact. [ 0.0 , inf.0 )
Hit Boxes
boundingBox A vector containing the radius values for each dimension of the unscaled player's bounding box. (Will be multiplied by scale.) “1.6 1.6 2.3”
boxHeadBackPercentage In conjunction with boxHeadBackPercentage, used to determine whether the front, middle, or back side of the player's torso or legs was hit. Note: this functionality is difficult to proprely change; it is recommended taht default values be used. 0
boxHeadFrontPercentage In conjunction with boxHeadBackPercentage, used to determine whether the front, middle, or back side of the player's torso or legs was hit. Note: this functionality is difficult to proprely change; it is recommended taht default values be used. 1
boxHeadLeftPercentage In conjunction with boxHeadRightPercentage, used to determine whether the left, middle, or right side of the player's torso or legs was hit. Note: this functionality is difficult to properly change; it is recommended that default values be used 0
boxHeadPercentage The distance from the bottom of the player's bounding box, to the beginning of the area considered to bound the player's head. Measured as a raw percentage. [ 0.0 , 1.0 ]
boxHeadRightPercentage In conjunction with boxHeadRightPercentage, used to determine whether the left, middle, or right side of the player's torso or legs was hit. Note: this functionality is difficult to properly change; it is recommended that default values be used 1
boxTorsoPercentage Like boxHeadPercentage, but specifies where the torso area begins. [ 0.0 , 1.0 ]
Footprints and -puffs
decalData DecalData datablock used for footprints.
decalOffset The offset from the player's center by which the decal should be displayed; should correlate with the distance from player's center, to the player's right foot center.
dustEmitter -- Not Used
footPuffEmitter The ParticleEmitterData datablock will be used to emit particles at footstep locations.
footPuffNumParts Number of dust particles to be generated for foot puffs. [ 0 , inf )
footPuffRadius The radius of dust spread from foot steps. [ 0.0 , inf.0 )
Sounds and Modifiers
exitingWater The AudioProfile used to produce sounds when emerging from water. --
exitSplashSoundVelocity The minimum velocity at which the exit splash sound will be played when emerging from water. --
FootBubblesSound The AudioProfile used to produce sounds for bubbles produced by footsteps. --
FootHardSound The AudioProfile used to produce sounds for hard footsteps. --
FootMetalSound The AudioProfile used to produce sounds for soft footsteps. --
FootShallowSound The AudioProfile used to produce sounds for shallow water footsteps. --
FootSoftSound The AudioProfile used to produce sounds for soft footsteps. --
FootUnderWater The AudioProfile used to produce sounds for funderwater footsteps. --
Footwading The AudioProfile used to produce sounds for wading footsteps. --
hardSplashSoundVelocity The minimum velocity at which the hard splash sound will be played when entering or leaving water. --
impactHardSound The AudioProfile used to produce sounds for hard impacts. --
impactMetal The AudioProfile used to produce sounds for metal impacts. --
impactSnowSound The AudioProfile used to produce sounds for snow impacts. --
impactSoftSound The AudioProfile used to produce sounds for soft impacts. --
impactWaterEasy The AudioProfile used to produce sounds for soft impacts against water. --
impactWaterHard The minimum velocity at which the hard water impact sound will be played when entering or leaving water. --
impactWaterMedium The AudioProfile used to produce sounds for medium impacts against water. --
mediumSplashSoundVelocity The minimum velocity at which the medium water impact sound will be played when entering or leaving water. --
movingBubblesSound The AudioProfile used to produce sounds for underwater bubble while the player is moving. --
waterBreathSound The AudioProfile used to produce sounds for underwater breathing. --
Splashes and Bubbles
bubbleEmitTime The length of time to continue emitting bubbles. --
footstepSplashHeight The maximum height at which to play the shallow footstep effect. --
splash The SplashData datablock used to emit splashes. --
splashAngle The mimimum verticle angle at which a player must be travelling in order to generate a splash effect. --

splashEmitter[0]
splashEmitter[1]

Array of pointers to ParticleEmitterData datablocks which will be used to generate splash effect particles. --
splashFreqMod The simulated frequency modulation of a splash generated by this player. Multiplied along with player speed and time elapsed when determining splash emition rate. --
splashVelEpsilon The threshold speed at which we consider the player's movement to have stopped when updating splash effects. --
splashVelocity The mimimum velocity a player needs in order to generate a splash effect. --

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