Contents

Console Objects Fields and Methods Quick Reference Part 15


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.

WaterBlock



Fields

h
Field Name Description Sample or Range
density The default water density is one. Meanwhile, the default character density is 10. This means the character will sink upon entering the water. Therefore, if you want the character to be more buoyant, you can adjust either or both parameters. [ 0.0 , inf.0 )
DepthGradient Controls the slope between MinAlpha and MaxAlpha. In older versions of the engine, Melvin implemented this as a sigmoid function, but since version 1.2, it has been implemented using the (more involved) gamma-correction function. [ 0.0 , inf.0 )
DistortGridScale This allows you to adjust distortion such that the effect is the same between a large water block and a small water block. There are not set rules really. You’ll just have to experiment. [ 0.0 , inf.0 )
DistortMag If this vale is not zero, distortion is enabled. Generally, the magnitude of this value should be less than one or the distortion behaves…strangely. Both positive and negative values are legal. [ 0.0 , inf.0 )
DistortTime As you might guess, this period of the distort function. It is inversely proportional to the distortion’s rate of change. In other words, larger values mean slower distortions and smaller values mean faster distortions. A value of zero (0) is illegal and will cause the texture rendering to fail gracefully. [ 0.0 , inf.0 )
envMapIntensity description [ 0.0 , inf.0 )
envMapOverTexture If environmental mapping (see .Reflections and Specular Masks’ below) is enabled, this texture is rendered when looking down onto the water from above. This represents an environmental reflection on the water’s surface. ~/path/filename.png
envMapUnderTexture As with envMapOverTexture, this represents an environmental reflection, but this is the texture you will see if looking up from beneath the water. ~/path/filename.png
FlowAngle This parameter (in degrees) determines the direction of the translation. [ 0.0 , 360.0 )
FlowRate If this value is non-zero, water flow will be enabled. The higher the value, the more quickly textures will translate. [ 0.0 , inf.0 )
liquidType These are leftover values from Tribes 2. You may use them for your own purposes. Water, OceanWater, RiverWater, StagnantWater, Lava, HotLava, CrustyLava, Quicksand
MaxAlpha As might be intuited, this parameter determine the maximum alpha to use while rendering shoreTexture. This directly affects the multi-texturing equation involving the surfaceTexture and shoreTexture. [ 0.0 , 1.0 ]
MinAlpha As might be intuited, this parameter determine the minimum alpha to use while rendering shoreTexture. This directly affects the multi-texturing equation involving the surfaceTexture and shoreTexture. [ 0.0 , 1.0 ]
position The object's placement position, not neccesarily the current position. "1.0 2.0 3.0"
removeWetEdges Setting this value true, tells the engine to (attempt to) clip the edges of water that produde from beneath terrain features. Results will vary when using this feature. [ false , true ]
rotation The object's placement rotation, not neccesarily the current rotation. "1.0 2.0 3.0"
scale The object's placement scale, not neccesarily the current scale. "1.0 2.0 3.0"
ShoreDepth Shore rendering is determined by a ray-cast at distinct points across the surface of the water block. The result of this ray-cast returns the distance between the top of the water and the terrain directly below that point on the surface. If this value is greater than or equal to ShoreDepth, the engine is instructed to render the shoreTexture. If you choose to set this value to zero, the shoreTexture will not render at all. [ 0.0 , inf.0 )
ShoreTexture We’ll talk more about shorelines in a moment, but Torque has the ability to render shorelines differently. When it renders the shoreline, it blends this texture with surfaceTexture, giving a nice visual effect. ~/path/filename.png
specularColor This can be used to change both the color of the resultant highlight and its intensity. This parameter takes a 4-tuple floating-point vector “r g b a”. "1.0 0.5 0.5"
specularMaskTex This texture is used to make the surface of the water look as if it is reflecting light. Again, this should be some kind of caustic grayscale. The engine does take into account the position and elevation of the sun when rendering the specular effect. ~/path/filename.png
specularPower This determines how large an area is shiny. Lower values cause more of the specular map to be rendered, versus larger values that will tend to show just a spot of highlighting. [ 0 , inf )

submergeTexture[0]

submergeTexture[1]

These two textures are only used when liquidType is one of the Lava types (Lava, HotLava, or CrustyLava). These two textures are rendered perpendicular to the viewing plane. Additionally they are animated. A suggestion I was given, which I’ll pass along, is to use two high quality (say 512x512 instead of the normal 256x256) grayscale caustics for these. ~/path/filename.png
surfaceOpacity This affects how opaque the combination of surfaceTexture and shoreTexture is. That is it. A value of zero is not transparent, just very translucent. A value of one is quite opaque. You’ll have to adjust this meet your needs. [ 0.0 , 1.0 ]
SurfaceParallax

When FlowRate is non-zero, the flow-rate of the oriented surfaceTexture is controlled by this value as follows:

> 1 - Non-oriented surfaceTexture flows more slowly than oriented surfaceTexture.
1 - Non-oriented surfaceTexture and oriented surfaceTexture flow at same rate.
< 1 - Oriented surfaceTexture flows more slowly than non-oriented surfaceTexture. Oriented surfaceTexture counter-flows.
0 - Oriented surfaceTexture remains stationary.

[ 0.0 , inf.0 )
surfaceTexture This texture is used to define the base water layer(s). This texture is rendered in two layers, with one layer re-oriented at a 45-degree angle (about Z of course). This makes the water more interesting. ~/path/filename.png
TessShore Controls shore 'detail level'. [ 0 , inf )
TessSurface Controls surface 'detail level' [ 0 , inf )
tile Enable/disable tiling. [ false , true ]
UseDepthMask If this value is false, only the envMapOverTexture will be rendered on the top of the water. All other ‘surface’ textures will be disabled. [ false , true ]
viscosity In addition to choosing whether a character will float or sink in water, we can indirectly adjust how quickly this occurs by changing the viscosity of the water. A thicker fluid like, say honey, has a high viscosity, whereas plain water will have a low viscosity. By increasing this value, you create an effect where the player will require more time to float or sink. ( -inf.0 , inf.0 )
waveMagnitude If this value is set at 0, the water will appear flat, with no waves. A value above 0 will produce a wave like effect across the entire waterblock. ( -inf.0 , inf.0 )


WheeledVehicles


Class used to represent wheeled vehicles.

Console Methods

getwheelCount setWheelPowered setWheelSpring
setWheelSteering setWheelTire


getWheelCount()

Purpose
Use the getWheelCount method to determine how many wheels (hubs) this wheeledVehicle has in it's mesh.

Returns
Returns a value between 0 and 8, specifying the number of hubs the mesh has of the name: hub0, hub1, ... hub7.

Notes
When creating a wheeledVehicle mesh, always create hubs using the name hubX, where X is a value between 0 and 7. Furthermore, always create these hubs in order and in pairs (opposite each other).

For example, If you are creating a four-wheeled vehicle, the hubs should be:

hub0 – front left tire
hub1 – front right tire
hub2 – rear left tire
hub3 – rear right tire

See Also
setWheelPowered, setWheelSpring, setWheelSteering, setWheelTire



setWheelPowered( wheelNum , isPowered )

Purpose
Use the setWheelPowered method to set the powered state for the specified wheel (hub).

Syntax
wheelNum
– A value between 0 and 7, specifying a specific wheel/hub.
isPowered – A boolean value. If set to true, this wheel will contribute to the powered motion of the vehicle, otherwise it will only affect non-powered motion such as rolling and steering.

Returns
Returns true if wheelNum was successfully set to powered or un-powered. Will return false if wheelNum does not specify a valid hub.

Notes
By default, all wheels/hubs are powered.

See Also
getWheelCount



setWheelSpring( wheelNum , springDB )

Purpose
Use the setWheelSpring method to assign a WheeledVehicleSpring datablock to the specified hub.

Syntax
wheelNum
– A value between 0 and 7, specifying a specific wheel/hub.
springDB – The name of ID of a previously specified WheeledVehicleSpring datablock.

Returns
Returns true if wheelNum was successfully assigned a new spring datablock, otherwise returns false.

Notes
You may change the springs on a wheeled tire at any time, allowing you to enhance vehicles or make them subject to damage.

Each tire can have its own customized spring datablock.

See Also
getWheelCount



setWheelSteering( wheelNum, steerAngle )

Purpose
Use the setWheelSteering method to set that maximum steering angle (away from center) as steerAngle (radians) for wheel wheelNum.

This limits the turning angle for the vehicle.

Syntax
wheelNum
– A value between 0 and 7, specifying a specific wheel/hub.
steerAngle – An angular value between 0.0 and 1.57 radians specifying maximum turning angle this wheel can take.

Returns
Returns true if wheelNum was successfully set the requested steerAngle, otherwise returns false.

See Also
getwheelCount



setWheelTire( wheelNum , tireDB )

Purpose
Use the setWheelTire method to assign a previously specified WheeledVehicleTire datablock to the requested hub.

Syntax
wheelNum
– A value between 0 and 7, specifying a specific wheel/hub.
tireDB – The name of ID of a previously specified WheeledVehicleTire datablock.

Returns
Returns true if wheelNum was successfully assigned a new WheeledVehicleTire datablock.

Notes
Tires may be changed at any time during the game.

See Also
getWheelCount


WheeledVehicleData


Datablock associated with wheeledvehicle object class.

Fields

Field Name Description Sample or Range
engineBrake Floating-point value specifying how much the engine brakes when the engine is not engaged (i.e. when the forward key is pressed). -
engineSound AudioProfile specifying sound to play when engine is engaged. -
engineTorque Floating-point value specifying the power of the engine. -
jetSound AudioProfile specifying sound to play when jets are engaged. -
maxWheelSpeed Floating-point value specifying maximum rotational velocity for tires. -
squealSound AudioProfile specifying sound to play when tires break friction. -
tireEmitter ParticleEmitterData datablock for tire emitters. -
wheelImpactSound AudioProfile specifying sound to play when tires impact 'ground'. -
brakeTorque Floating-point value specifying the power of the brakes. -


WheeledVehicleSpring


Datablock used to describe vehicle suspension(s).

Fields

Field Name Description Sample or Range
antiSwayForce Force which acts to dampen lateral sway introduced when wheels opposite eachother are extended at different lengths. [ 0.0 , inf.0 )
damping Dampening force which counter-acts the spring's force. [ 0.0 , inf.0 )
force The force of the spring. Spring forces act straight up and are applied at the spring's root position, which is defined in the vehicle's shape. [ 0.0 , inf.0 )
length The length of suspension travel from the root position. [ 0.0 , inf.0 )


WheeledVehicleTire


Summary of object.

Fields

Field Name Description Sample or Range
kineticFriction Used in the physical simulation to represent the tire's surface friction when it is slipping (has no traction). [ 0.0 , inf.0 )
lateralDamping Measures the dampening force applied against lateral forces generated by the tire. See the lateralForce field documentation for more information on vehicle physics as they relate to wheel forces. [ 0.0 , inf.0 )
lateralForce Used in the physical simulation to represent the tire's lateral force. Lateral force can in simple terms be considered left/right steering force. WheeledVehicles are acted upon by forces generated by their tires and the lateralForce measures the magnitude of the force exerted on the vehicle when the tires are deformed along the x-axis. With real wheeled vehicles, tires are constantly being deformed and it is the interplay of deformation forces which determines how a vehicle moves. In Torque's simulation of vehicle physics, tire deformation obviously can't be handled with absolute realism, but the interplay of a vehicle's velocity, its engine's torque and braking forces, and its wheels' friction, lateral deformation, lateralDamping, lateralRelaxation, longitudinal deformation, longitudinalDamping, and longitudinalRelaxation forces, along with its wheels' angular velocity are combined to create a robust real-time physical simulation. For this field, the larger the value supplied for the lateralForce, the larger the effect steering moves can have. In Torque tire forces are applied at a vehicle's wheel hubs. [ 0.0 , inf.0 )
lateralRelaxation Measures the relaxing force applied against lateral forces generated by the tire. The lateralRelaxation force measures how strongly the tire effectively un-deforms. See the lateralForce field documentation for more information on vehicle physics as they relate to wheel forces. [ 0.0 , inf.0 )
logitudinalRelaxation
(yes, an engine typo)
Measures the relaxing force applied against longitudinal forces generated by the tire. The longitudinalRelaxation force measures how strongly the tire effectively un-deforms. See the longitudinalForce field documentation for more information on longitudinal tire forces, and the laterForce field documentation for more information on general vehicle physics as they relate to wheel forces. [ 0.0 , inf.0 )
longitudinalDamping Measures the dampening force applied against longitudinal forces generated by the tire. See the longitudinalForce field documentation for more information on longitudinal tire forces, and the laterForce field documentation for more information on general vehicle physics as they relate to wheel forces. [ 0.0 , inf.0 )
longitudinalForce Used in the physical simulation to represent the tire's longitudinal force. Longitudinal force can in simple terms be considered forward/backward movement force. WheeledVehicles are acted upon by forces generated by their tires and the longitudinalForce measures the magnitude of the force exerted on the vehicle when the tires are deformed along the y-axis. See the lateralForce field documentation for more information on wheeled vehicle physics. For this field, the larger the value supplied for the longitudinalForce, the larger the effect acceleration/deceleration moves can have. [ 0.0 , inf.0 )
mass The mass of the entire wheel. Used in the physics simulation, see the documentation for the WheeledVehicleData datablock for more information. The wheel's mass does not need to be specified in script. [ 0.0 , inf.0 )
radius The tire's radius. The radius is determined from the boundix box of the shape provided in the shapefile field, and does not need to be specified in script. The tire should be built with it's hub axis along the object's Y-axis. [ 0.0 , inf.0 )
restitution Note: this field currently has no tangible effect in the engine's simulation. -
shapeFile The path and file name of a shape file to be used for the wheel. Must adhere to the semantics associated with the Filename datatype, as defined in the engine. ~/path/filename.dts
staticFriction Used in the physical simulation to represent the tire's surface friction when it is not slipping (has traction). [ 0.0 , inf.0 )


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