Skip to content

Latest commit

 

History

History
746 lines (391 loc) · 26.5 KB

ShapeBase.rst

File metadata and controls

746 lines (391 loc) · 26.5 KB

ShapeBase

A scriptable, renderable shape.

Inherit:

GameBase

Description

A scriptable, renderable shape.

ShapeBase is the renderable shape from which most of the scriptable, game objects are derived, including the Player, Vehicle and Item classes. ShapeBase provides collision detection, audio channels, and animation as well as damage (and damage states), energy, and the ability to mount Images and objects.

ShapeBase objects are not normally instantiated in the scene; derived classes such as Player, WheeledVehicle, and, StaticShape are used instead. But ShapeBase (and the associated datablock, ShapeBaseData) may be used to provide functionality common to all derived objects.

A ShapeBase object consists of a DTS or DAE shape file. This file has the following requirements:

Nodes

Sequences Indicating Condition

Detail Levels

Control Object

Generally in a Torque game, each client is in control of a single game object (such as a Player in an FPS game, or a WheeledVehicle in a racing game). In a game where the client has control over multiple objects (such as units in an RTS), the control object may be the Camera that determines the client's view of the world (although in general, the client's camera object does not need to be the same as the control object).

The object controlled by the client is important for several reasons:

Energy/Damage

ShapeBase includes basic enery and damage systems that may be used by derived classes as required. For example, the Player class uses energy to determine whether the character is capabable of running and jumping, which can be used to mimic the character getting tired and having to rest before continuing. The Player class also uses the damage system PlayerData::onDestroyed callback to trigger a death animation. The Vehicle classes use the current damage level to trigger particle emitters, so a vehicle could progressively generate more smoke as it becomes more damaged.

ShapeBase also includes parameters to 'blow up' the object when it is Destroyed (damage level above ShapeBaseData::destroyedLevel). Blowing up an object can generate an explosion and debris, as well as exclude the object from rendering.

Parameters to control the object's energy and damage functionality can be found in the ShapeBaseData datablock.

Methods

Fields