Torque Game EngineTorque Game Engine Documentation
Version 1.3.x

ShapeBaseData

With ShapeBaseData, datablocks begin getting more complex and useful. ShapeBaseData is derived from GameBaseData and offers all the same basic functionality, along with manynew features.

ShapeBaseData defines rendering data: fields can be set to specify a renderable shape, some texturing effects, and destruction behavior. Camera-related data is also defined. Damage behavior can be specified as well. ShapeBaseData also defines a field related to CRC-checking, which is a security feature. Physics information is defined, though by default objects containing a ShapeBaseData datablock do not utilize physical information-- rather, physics data is used in objects with datablocks which are themselves derived from ShapeBaseData. In addition, energy data is defined, but this may be removed in the future. A field related to AI behavior is defined as well, but may also be removed. HUD-related fields are also specified, but these fields are not fully supported and are very likely to be removed.

The Torque Game Engine defines many datablocks which derive from ShapeBaseData, as we will soon see. As such, it is a good idea to familiarize yourself with ShapeBaseData's fields. Below is a table listing all of the data fields provided in ShapeBaseData, along with brief descriptions for each.

Table D.2. ShapeBaseData Member Fields

Field NameTypeDefault ValueDescription
GameBaseData Derived Fields
CategoryString Identifies which category in the Mission Editor objects based on this datablock will show up in.
classNameStringShapeBaseDataUsed to identify this datablock's class. Value can be over-ridden in script.
Rendering Data
shapeFileFilenameNULLName of a shape file. Specified as a string, but must adhere to the semantics associated with the filename data type, as defined in the engine.
cloakTextureFilename The name of a texture file, which can be used to render a cloaking effect. NOTE: This field may eventually be removed from the ShapeBaseData description.
emapBooleanFalseSpecifies whether environment mapping should be enabled for this object.
Destruction Effect Data
ExplosionExplosionDataPtrNULLIf specified, this field must point to another datablock object of type ExplosionData. Must adhere to the semantics associated with ExplosionData*, as defined in the engine.
underwaterExplosionExplosionDataPtrNULLSee the Explosion field. underWaterExplosion must follow the same specification, but is intended to enable a separate explosion effect for use under water.
DebrisDebrisDataPtrNULLIf specified, this field must point to another datablock of type DebrisData. Must adhere to the semantics associated with DebrisData*, as defined in the engine.
debrisShapeNameFilename The filename of the shape associated with the Debris field.
renderWhenDestroyedBooleanTrueSpecifies whether the object should be rendered after it is destroyed.
Camera Data
cameraMaxDistfloat0.0Maximum allowable camera distance from the eye.
cameraMinDistfloat0.2The minimum allowable camera distance from the eye.
cameraDefaultFOVfloat90.0The default Field-of-Vision angle, measured in angles.
cameraMinFOVfloat5.0The minimum allowable Field-of-Vision angle, measured in angles.
cameraMaxFOVfloat120.0The maximum allowable Field-of-Vision angle, measured in angles.
useEyePointBooleanFalseSpecifies whether we should use the shape's eye point as the camera viewing point.
observeThroughObjectBooleanFalseSpecifies whether we observe the object through its camera transform and FOV.
cameraDefaultFOVfloat90.0The default Field-of-Vision angle, measured in angles.
firstPersonOnlyBooleanFalseSpecifies whether only first-person view can be used.
Security Data
computeCRCBooleanFalseSpecifies whether the shapeFile CRC must match that sent from the server.
Physics Data
massFloat1.0The property of mass, as used in physical simulations.
densityFloat1.0The property of density, as used in physical simulations.
dragFloat0.0The property of drag, as used in physical simulations.
Damage-Specific Fields
isInvincibleBooleanFalseSpecifies whether the entity should be treated as unable to take damage.
maxDamageFloat1.0The maximum damage that the entity can withstand.
destroyedLevelFloat1.0The point at which the is considered destroyed, in relation to damage taken versus maximum damage. Valid values range from 0.0 to 1.0. NOTE: This field may be removed in the future.
disabledLevelFloat1.0The point at which the entity is considered disabled, in relation to damage taken versus maximum damage. Valid values range from 0.0 to 1.0.
repairRateFloat0.0033Repair rate per tick.
Energy Data
MaxEnergyFloat0.0The maximal energy value. NOTE: This field may be removed in the future.
inheritEnergyFromMountBooleanFalseSpecifies whether the engine should transfer energy from a mounted energy source to the object. NOTE: This field may be removed in the future.
AI Data
aiAvoidThisBooleanFalseSpecifies whether the AI should avoid this object. NOTE: This field is not fully supported and may be removed in the future.
HUD Data
hudImageNameString NOTE: This field is not fully supported and may be removed in the future.
hudImageNameFriendlyString (array) NOTE: This field is not fully supported and may be removed in the future.
hudImageNameEnemyString (array) NOTE: This field is not fully supported and may be removed in the future.
hudRenderCenterBoolean (array)FalseNOTE: This field is not fully supported and may be removed in the future.
hudRenderModulatedBoolean (array)FalseNOTE: This field is not fully supported and may be removed in the future.
hudRenderAlwaysBoolean (array)FalseNOTE: This field is not fully supported and may be removed in the future.
hudRenderDistanceBoolean (array)FalseNOTE: This field is not fully supported and may be removed in the future.
hudRenderNameBoolean (array)FalseNOTE: This field is not fully supported and may be removed in the future.

Creating a ShapeBaseData datablock works just like creating a GameBaseData datablock; simply enter values for the fields you want to change from default, and add any new entries you'd like to.

As you can see, ShapeBaseData begins to define some useful fields which can be used to quickly specify gameplay behavior. Next, we'll take a look at the datablocks that are derived from ShapeBaseData.