Main   Class List   Namespace List   Wiki

ShapeBase Class Reference
[Game Objects]

A scriptable, renderable shape. More...

Inheritance diagram for ShapeBase:
Inheritance graph
[legend]

List of all members.

Public Member Functions

void applyDamage (float amount)
 Increment the current damage level by the specified amount.
bool applyImpulse (Point3F pos, Point3F vec)
 Apply an impulse to the object.
void applyRepair (float amount)
 Repair damage by the specified amount.
bool canCloak ()
 Check if this object can cloak.
void changeMaterial (string mapTo, Material oldMat, Material newMat)
 Change one of the materials on the shape.
bool destroyThread (int slot)
 Destroy an animation thread, which prevents it from playing.
void dumpMeshVisibility ()
 Print a list of visible and hidden meshes in the shape to the console for debugging purposes.
Point3F getAIRepairPoint ()
 Get the position at which the AI should stand to repair things.
float getCameraFov ()
 Returns the vertical field of view in degrees for this object if used as a camera.
int getControllingClient ()
 Get the client (if any) that controls this object.
int getControllingObject ()
 Get the object (if any) that controls this object.
float getDamageFlash ()
 Get the damage flash level.
float getDamageLevel ()
 Get the object's current damage level.
float getDamagePercent ()
 Get the object's current damage level as a percentage of maxDamage.
string getDamageState ()
 Get the object's damage state.
float getDefaultCameraFov ()
 Returns the default vertical field of view in degrees for this object if used as a camera.
float getEnergyLevel ()
 Get the object's current energy level.
float getEnergyPercent ()
 Get the object's current energy level as a percentage of maxEnergy.
Point3F getEyePoint ()
 Get the position of the 'eye' for this object.
TransformF getEyeTransform ()
 Get the 'eye' transform for this object.
VectorF getEyeVector ()
 Get the forward direction of the 'eye' for this object.
bool getImageAltTrigger (int slot)
 Get the alt trigger state of the Image mounted in the specified slot.
bool getImageAmmo (int slot)
 Get the ammo state of the Image mounted in the specified slot.
bool getImageLoaded (int slot)
 Get the loaded state of the Image mounted in the specified slot.
int getImageSkinTag (int slot)
 Get the skin tag ID for the Image mounted in the specified slot.
string getImageState (int slot)
 Get the name of the current state of the Image in the specified slot.
bool getImageTrigger (int slot)
 Get the trigger state of the Image mounted in the specified slot.
string getLookAtPoint (float distance=2000, int typeMask=0xFFFFFFFF)
 Get the world position this object is looking at.
string getModelFile ()
 Get the model filename used by this shape.
int getMountedImage (int slot)
 Get the Image mounted in the specified slot.
int getMountSlot (ShapeBaseImageData image)
 Get the first slot the given datablock is mounted to on this object.
Point3F getMuzzlePoint (int slot)
 Get the muzzle position of the Image mounted in the specified slot.
VectorF getMuzzleVector (int slot)
 Get the muzzle vector of the Image mounted in the specified slot.
int getPendingImage (int slot)
 Get the Image that will be mounted next in the specified slot.
float getRechargeRate ()
 Get the current recharge rate.
float getRepairRate ()
 Get the per-tick repair amount.
string getShapeName ()
 Get the name of the shape.
string getSkinName ()
 Get the name of the skin applied to this shape.
TransformF getSlotTransform (int slot)
 Get the world transform of the specified mount slot.
int getTargetCount ()
 Get the number of materials in the shape.
string getTargetName (int index)
 Get the name of the indexed shape material.
VectorF getVelocity ()
 Get the object's current velocity.
float getWhiteOut ()
 Get the white-out level.
bool isCloaked ()
 Check if this object is cloaked.
bool isDestroyed ()
 Check if the object is in the Destroyed damage state.
bool isDisabled ()
 Check if the object is in the Disabled or Destroyed damage state.
bool isEnabled ()
 Check if the object is in the Enabled damage state.
bool isHidden ()
 Check if the object is hidden.
bool isImageFiring (int slot)
 Check if the current Image state is firing.
bool isImageMounted (ShapeBaseImageData image)
 Check if the given datablock is mounted to any slot on this object.
bool mountImage (ShapeBaseImageData image, int slot, bool loaded=true, string skinTag="")
 Mount a new Image.
bool pauseThread (int slot)
 Pause an animation thread.
bool playAudio (int slot, SFXTrack track)
 Attach a sound to this shape and start playing it.
bool playThread (int slot, string name="")
 Start a new animation thread, or restart one that has been paused or stopped.
void setAllMeshesHidden (bool hide)
 Set the hidden state on all the shape meshes.
void setCameraFov (float fov)
 Set the vertical field of view in degrees for this object if used as a camera.
void setCloaked (bool cloak)
 Set the cloaked state of this object.
void setDamageFlash (float level)
 Set the damage flash level.
void setDamageLevel (float level)
 Set the object's current damage level.
bool setDamageState (string state)
 Set the object's damage state.
void setDamageVector (Point3F vec)
 Set the damage direction vector.
void setEnergyLevel (float level)
 Set this object's current energy level.
void setHidden (bool show)
 Add or remove this object from the scene.
bool setImageAltTrigger (int slot, bool state)
 Set the alt trigger state of the Image mounted in the specified slot.
bool setImageAmmo (int slot, bool state)
 Set the ammo state of the Image mounted in the specified slot.
bool setImageLoaded (int slot, bool state)
 Set the loaded state of the Image mounted in the specified slot.
bool setImageTrigger (int slot, bool state)
 Set the trigger state of the Image mounted in the specified slot.
void setInvincibleMode (float time, float speed)
 Setup the invincible effect.
void setMeshHidden (string name, bool hide)
 Set the hidden state on the named shape mesh.
void setRechargeRate (float rate)
 Set the recharge rate.
void setRepairRate (float rate)
 Set amount to repair damage by each tick.
void setShapeName (string name)
 Set the name of this shape.
void setSkinName (string name)
 Apply a new skin to this shape.
bool setThreadDir (int slot, bool fwd)
 Set the playback direction of an animation thread.
bool setThreadTimeScale (int slot, float scale)
 Set the playback time scale of an animation thread.
bool setVelocity (Point3F vel)
 Set the object's velocity.
void setWhiteOut (float level)
 Set the white-out level.
void startFade (int time, int delay, bool fadeOut)
 Fade the object in or out without removing it from the scene.
bool stopAudio (int slot)
 Stop a sound started with playAudio.
bool stopThread (int slot)
 Stop an animation thread.
bool unmountImage (int slot)
 Unmount the mounted Image in the specified slot.
Callbacks

float validateCameraFov (float fov)
 Called on the server when the client has requested a FOV change.

Static Public Attributes

static bool isRenderable
 Disables rendering of all instances of this type.
static bool isSelectable
 Disables selection of all instances of this type.

Detailed 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:

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:

  1. The control object receives Moves from the client GameConnection (such as keyboard or gamepad input).
  2. The control object is used to 'scope' the client, that is, to determine what else in the world is significant for the client, and which objects the server should give priority when sending network updates to the client.

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.

See also:
ShapeBaseData::maxEnergy
ShapeBaseData::maxDamage

Member Function Documentation

void ShapeBase::applyDamage ( float  amount  ) 

Increment the current damage level by the specified amount.

Parameters:
amount value to add to current damage level
bool ShapeBase::applyImpulse ( Point3F  pos,
Point3F  vec 
)

Apply an impulse to the object.

Parameters:
pos world position of the impulse
vec impulse momentum (velocity * mass)
Returns:
true
void ShapeBase::applyRepair ( float  amount  ) 

Repair damage by the specified amount.

Note that the damage level is only reduced by repairRate per tick, so it may take several ticks for the total repair to complete.

Parameters:
amount total repair value (subtracted from damage level over time)
bool ShapeBase::canCloak (  ) 

Check if this object can cloak.

Returns:
true
Note:
Not implemented as it always returns true.
void ShapeBase::changeMaterial ( string  mapTo,
Material  oldMat,
Material  newMat 
)

Change one of the materials on the shape.

This method changes materials per mapTo with others. The material that is being replaced is mapped to unmapped_mat as a part of this transition.

Note:
Warning, right now this only sort of works. It doesn't do a live update like it should.
Parameters:
mapTo the name of the material target to remap (from getTargetName)
oldMat the old Material that was mapped
newMat the new Material to map
Example:
// remap the first material in the shape
%mapTo = %obj.getTargetName( 0 );
%obj.changeMaterial( %mapTo, 0, MyMaterial );
bool ShapeBase::destroyThread ( int  slot  ) 

Destroy an animation thread, which prevents it from playing.

Parameters:
slot thread slot to destroy
Returns:
true if successful, false if failed
See also:
playThread
void ShapeBase::dumpMeshVisibility (  ) 

Print a list of visible and hidden meshes in the shape to the console for debugging purposes.

Note:
Only in a SHIPPING build.
Point3F ShapeBase::getAIRepairPoint (  ) 

Get the position at which the AI should stand to repair things.

If the shape defines a node called "AIRepairNode", this method will return the current world position of that node, otherwise "0 0 0".

Returns:
the AI repair position
float ShapeBase::getCameraFov (  ) 

Returns the vertical field of view in degrees for this object if used as a camera.

Returns:
current FOV as defined in ShapeBaseData::cameraDefaultFov
int ShapeBase::getControllingClient (  ) 

Get the client (if any) that controls this object.

The controlling client is the one that will send moves to us to act on.

Returns:
the ID of the controlling GameConnection, or 0 if this object is not controlled by any client.
See also:
GameConnection
int ShapeBase::getControllingObject (  ) 

Get the object (if any) that controls this object.

Returns:
the ID of the controlling ShapeBase object, or 0 if this object is not controlled by another object.
float ShapeBase::getDamageFlash (  ) 

Get the damage flash level.

Returns:
flash level
See also:
setDamageFlash
float ShapeBase::getDamageLevel (  ) 

Get the object's current damage level.

Returns:
damage level
See also:
setDamageLevel()
float ShapeBase::getDamagePercent (  ) 

Get the object's current damage level as a percentage of maxDamage.

Returns:
damageLevel / datablock.maxDamage
See also:
setDamageLevel()
string ShapeBase::getDamageState (  ) 

Get the object's damage state.

Returns:
the damage state; one of "Enabled", "Disabled", "Destroyed"
See also:
setDamageState()
float ShapeBase::getDefaultCameraFov (  ) 

Returns the default vertical field of view in degrees for this object if used as a camera.

Returns:
Default FOV
float ShapeBase::getEnergyLevel (  ) 

Get the object's current energy level.

Returns:
energy level
See also:
setEnergyLevel()
float ShapeBase::getEnergyPercent (  ) 

Get the object's current energy level as a percentage of maxEnergy.

Returns:
energyLevel / datablock.maxEnergy
See also:
setEnergyLevel()
Point3F ShapeBase::getEyePoint (  ) 

Get the position of the 'eye' for this object.

If the object model has a node called 'eye', this method will return that node's current world position, otherwise it will return the object's current world position.

Returns:
the eye position for this object
See also:
getEyeVector
getEyeTransform
TransformF ShapeBase::getEyeTransform (  ) 

Get the 'eye' transform for this object.

If the object model has a node called 'eye', this method will return that node's current transform, otherwise it will return the object's current transform.

Returns:
the eye transform for this object
See also:
getEyeVector
getEyePoint
VectorF ShapeBase::getEyeVector (  ) 

Get the forward direction of the 'eye' for this object.

If the object model has a node called 'eye', this method will return that node's current forward direction vector, otherwise it will return the object's current forward direction vector.

Returns:
the eye vector for this object
See also:
getEyePoint
getEyeTransform
bool ShapeBase::getImageAltTrigger ( int  slot  ) 

Get the alt trigger state of the Image mounted in the specified slot.

Parameters:
slot Image slot to query
Returns:
the Image's current alt trigger state
bool ShapeBase::getImageAmmo ( int  slot  ) 

Get the ammo state of the Image mounted in the specified slot.

Parameters:
slot Image slot to query
Returns:
the Image's current ammo state
bool ShapeBase::getImageLoaded ( int  slot  ) 

Get the loaded state of the Image mounted in the specified slot.

Parameters:
slot Image slot to query
Returns:
the Image's current loaded state
int ShapeBase::getImageSkinTag ( int  slot  ) 

Get the skin tag ID for the Image mounted in the specified slot.

Parameters:
slot Image slot to query
Returns:
the skinTag value passed to mountImage when the image was mounted
string ShapeBase::getImageState ( int  slot  ) 

Get the name of the current state of the Image in the specified slot.

Parameters:
slot Image slot to query
Returns:
name of the current Image state, or "Error" if slot is invalid
bool ShapeBase::getImageTrigger ( int  slot  ) 

Get the trigger state of the Image mounted in the specified slot.

Parameters:
slot Image slot to query
Returns:
the Image's current trigger state
string ShapeBase::getLookAtPoint ( float  distance = 2000,
int  typeMask = 0xFFFFFFFF 
)

Get the world position this object is looking at.

Casts a ray from the eye and returns information about what the ray hits.

Parameters:
distance maximum distance of the raycast
typeMask typeMask of objects to include for raycast collision testing
Returns:
look-at information as "Object HitX HitY HitZ [Material]" or empty string for no hit
Example:
%lookat = %obj.getLookAtPoint();
echo( "Looking at: " @ getWords( %lookat, 1, 3 ) );
string ShapeBase::getModelFile (  ) 

Get the model filename used by this shape.

Returns:
the shape filename
int ShapeBase::getMountedImage ( int  slot  ) 

Get the Image mounted in the specified slot.

Parameters:
slot Image slot to query
Returns:
ID of the ShapeBaseImageData datablock mounted in the slot, or 0 if no Image is mounted there.
int ShapeBase::getMountSlot ( ShapeBaseImageData  image  ) 

Get the first slot the given datablock is mounted to on this object.

Parameters:
image ShapeBaseImageData datablock to query
Returns:
index of the first slot the Image is mounted in, or -1 if the Image is not mounted in any slot on this object.
Point3F ShapeBase::getMuzzlePoint ( int  slot  ) 

Get the muzzle position of the Image mounted in the specified slot.

If the Image shape contains a node called 'muzzlePoint', then the muzzle position is the position of that node in world space. If no such node is specified, the slot's mount node is used instead.

Parameters:
slot Image slot to query
Returns:
the muzzle position, or "0 0 0" if the slot is invalid
VectorF ShapeBase::getMuzzleVector ( int  slot  ) 

Get the muzzle vector of the Image mounted in the specified slot.

If the Image shape contains a node called 'muzzlePoint', then the muzzle vector is the forward direction vector of that node's transform in world space. If no such node is specified, the slot's mount node is used instead.

If the correctMuzzleVector and firstPerson flags are set in the Image, the muzzle vector is computed to point at whatever object is right in front of the object's 'eye' node.

Parameters:
slot Image slot to query
Returns:
the muzzle vector, or "0 1 0" if the slot is invalid
int ShapeBase::getPendingImage ( int  slot  ) 

Get the Image that will be mounted next in the specified slot.

Calling mountImage when an Image is already mounted does one of two things:

  1. Mount the new Image immediately, the old Image is discarded and whatever state it was in is ignored.
  2. If the current Image state does not allow Image changes, the new Image is marked as pending, and will not be mounted until the current state completes. eg. if the user changes weapons, you may wish to ensure that the current weapon firing state plays to completion first.

This command retrieves the ID of the pending Image (2nd case above).

Parameters:
slot Image slot to query
Returns:
ID of the pending ShapeBaseImageData datablock, or 0 if none.
float ShapeBase::getRechargeRate (  ) 

Get the current recharge rate.

Returns:
the recharge rate (per tick)
See also:
setRechargeRate()
float ShapeBase::getRepairRate (  ) 

Get the per-tick repair amount.

Returns:
the current value to be subtracted from damage level each tick
See also:
setRepairRate
string ShapeBase::getShapeName (  ) 

Get the name of the shape.

Note:
This is the name of the shape object that is sent to the client, not the DTS or DAE model filename.
Returns:
the name of the shape
See also:
setShapeName()
string ShapeBase::getSkinName (  ) 

Get the name of the skin applied to this shape.

Returns:
the name of the skin
See also:
setSkinName()
TransformF ShapeBase::getSlotTransform ( int  slot  ) 

Get the world transform of the specified mount slot.

Parameters:
slot Image slot to query
Returns:
the mount transform
int ShapeBase::getTargetCount (  ) 

Get the number of materials in the shape.

Returns:
the number of materials in the shape.
See also:
getTargetName()
string ShapeBase::getTargetName ( int  index  ) 

Get the name of the indexed shape material.

Parameters:
index index of the material to get (valid range is 0 - getTargetCount()-1).
Returns:
the name of the indexed material.
See also:
getTargetCount()
VectorF ShapeBase::getVelocity (  ) 

Get the object's current velocity.

Returns:
the current velocity

Reimplemented in Camera.

float ShapeBase::getWhiteOut (  ) 

Get the white-out level.

Returns:
white-out level
See also:
setWhiteOut
bool ShapeBase::isCloaked (  ) 

Check if this object is cloaked.

Returns:
true if cloaked, false if not
See also:
setCloaked()
bool ShapeBase::isDestroyed (  ) 

Check if the object is in the Destroyed damage state.

Returns:
true if damage state is "Destroyed", false if not
See also:
isDisabled()
isEnabled()
bool ShapeBase::isDisabled (  ) 

Check if the object is in the Disabled or Destroyed damage state.

Returns:
true if damage state is not "Enabled", false if it is
See also:
isDestroyed()
isEnabled()
bool ShapeBase::isEnabled (  ) 

Check if the object is in the Enabled damage state.

Returns:
true if damage state is "Enabled", false if not
See also:
isDestroyed()
isDisabled()
bool ShapeBase::isHidden (  ) 

Check if the object is hidden.

Returns:
true if the object is hidden, false if visible.
bool ShapeBase::isImageFiring ( int  slot  ) 

Check if the current Image state is firing.

Parameters:
slot Image slot to query
Returns:
true if the current Image state in this slot has the 'stateFire' flag set.
bool ShapeBase::isImageMounted ( ShapeBaseImageData  image  ) 

Check if the given datablock is mounted to any slot on this object.

Parameters:
image ShapeBaseImageData datablock to query
Returns:
true if the Image is mounted to any slot, false otherwise.
bool ShapeBase::mountImage ( ShapeBaseImageData  image,
int  slot,
bool  loaded = true,
string  skinTag = "" 
)

Mount a new Image.

Parameters:
image the Image to mount
slot Image slot to mount into (valid range is 0 - 3)
loaded initial loaded state for the Image
skinTag tagged string to reskin the mounted Image
Returns:
true if successful, false if failed
Example:
%player.mountImage( PistolImage, 1 );
%player.mountImage( CrossbowImage, 0, false );
%player.mountImage( RocketLauncherImage, 0, true, 'blue' );
See also:
unmountImage()
getMountedImage()
getPendingImage()
isImageMounted()
bool ShapeBase::pauseThread ( int  slot  ) 

Pause an animation thread.

If restarted using playThread, the animation will resume from the paused position.

Parameters:
slot thread slot to stop
Returns:
true if successful, false if failed
See also:
playThread
bool ShapeBase::playAudio ( int  slot,
SFXTrack  track 
)

Attach a sound to this shape and start playing it.

Parameters:
slot Audio slot index for the sound (valid range is 0 - 3)
track SFXTrack to play
Returns:
true if the sound was attached successfully, false if failed
See also:
stopAudio()
bool ShapeBase::playThread ( int  slot,
string  name = "" 
)

Start a new animation thread, or restart one that has been paused or stopped.

Parameters:
slot thread slot to play. Valid range is 0 - 3)
name name of the animation sequence to play in this slot. If not specified, the paused or stopped thread in this slot will be resumed.
Returns:
true if successful, false if failed
Example:
%obj.playThread( 0, "ambient" );      // Play the ambient sequence in slot 0
%obj.setThreadTimeScale( 0, 0.5 );    // Play at half-speed
%obj.pauseThread( 0 );                // Pause the sequence
%obj.playThread( 0 );                 // Resume playback
%obj.playThread( 0, "spin" );         // Replace the sequence in slot 0
See also:
pauseThread()
stopThread()
setThreadDir()
setThreadTimeScale()
destroyThread()
void ShapeBase::setAllMeshesHidden ( bool  hide  ) 

Set the hidden state on all the shape meshes.

This allows you to hide all meshes in the shape, for example, and then only enable a few.

Parameters:
hide new hidden state for all meshes
void ShapeBase::setCameraFov ( float  fov  ) 

Set the vertical field of view in degrees for this object if used as a camera.

Parameters:
fov new FOV value
void ShapeBase::setCloaked ( bool  cloak  ) 

Set the cloaked state of this object.

When an object is cloaked it is not rendered.

Parameters:
cloak true to cloak the object, false to uncloak
See also:
isCloaked()
void ShapeBase::setDamageFlash ( float  level  ) 

Set the damage flash level.

Damage flash may be used as a postfx effect to flash the screen when the client is damaged.

Note:
Relies on the flash postFx.
Parameters:
level flash level (0-1)
See also:
getDamageFlash()
void ShapeBase::setDamageLevel ( float  level  ) 

Set the object's current damage level.

Parameters:
level new damage level
See also:
getDamageLevel()
getDamagePercent()
bool ShapeBase::setDamageState ( string  state  ) 

Set the object's damage state.

Parameters:
state should be one of "Enabled", "Disabled", "Destroyed"
Returns:
true if successful, false if failed
See also:
getDamageState()
void ShapeBase::setDamageVector ( Point3F  vec  ) 

Set the damage direction vector.

Currently this is only used to initialise the explosion if this object is blown up.

Parameters:
vec damage direction vector
Example:
%obj.setDamageVector( "0 0 1" );
void ShapeBase::setEnergyLevel ( float  level  ) 

Set this object's current energy level.

Parameters:
level new energy level
See also:
getEnergyLevel()
getEnergyPercent()
void ShapeBase::setHidden ( bool  show  ) 

Add or remove this object from the scene.

When removed from the scene, the object will not be processed or rendered.

Parameters:
show False to hide the object, true to re-show it

Reimplemented from SimObject.

bool ShapeBase::setImageAltTrigger ( int  slot,
bool  state 
)

Set the alt trigger state of the Image mounted in the specified slot.

Parameters:
slot Image slot to modify
state new alt trigger state for the Image
Returns:
the Image's new alt trigger state
bool ShapeBase::setImageAmmo ( int  slot,
bool  state 
)

Set the ammo state of the Image mounted in the specified slot.

Parameters:
slot Image slot to modify
state new ammo state for the Image
Returns:
the Image's new ammo state
bool ShapeBase::setImageLoaded ( int  slot,
bool  state 
)

Set the loaded state of the Image mounted in the specified slot.

Parameters:
slot Image slot to modify
state new loaded state for the Image
Returns:
the Image's new loaded state
bool ShapeBase::setImageTrigger ( int  slot,
bool  state 
)

Set the trigger state of the Image mounted in the specified slot.

Parameters:
slot Image slot to modify
state new trigger state for the Image
Returns:
the Image's new trigger state
void ShapeBase::setInvincibleMode ( float  time,
float  speed 
)

Setup the invincible effect.

This effect is used for HUD feedback to the user that they are invincible.

Note:
Currently not implemented
Parameters:
time duration in seconds for the invincible effect
speed speed at which the invincible effect progresses
void ShapeBase::setMeshHidden ( string  name,
bool  hide 
)

Set the hidden state on the named shape mesh.

Parameters:
name name of the mesh to hide/show
hide new hidden state for the mesh
void ShapeBase::setRechargeRate ( float  rate  ) 

Set the recharge rate.

The recharge rate is added to the object's current energy level each tick, up to the maxEnergy level set in the ShapeBaseData datablock.

Parameters:
rate the recharge rate (per tick)
See also:
getRechargeRate()
void ShapeBase::setRepairRate ( float  rate  ) 

Set amount to repair damage by each tick.

Note that this value is separate to the repairRate field in ShapeBaseData. This value will be subtracted from the damage level each tick, whereas the ShapeBaseData field limits how much of the applyRepair value is subtracted each tick. Both repair types can be active at the same time.

Parameters:
rate value to subtract from damage level each tick (must be > 0)
See also:
getRepairRate()
void ShapeBase::setShapeName ( string  name  ) 

Set the name of this shape.

Note:
This is the name of the shape object that is sent to the client, not the DTS or DAE model filename.
Parameters:
name new name for the shape
See also:
getShapeName()
void ShapeBase::setSkinName ( string  name  ) 

Apply a new skin to this shape.

Parameters:
name name of the skin to apply
See also:
getSkinName()
bool ShapeBase::setThreadDir ( int  slot,
bool  fwd 
)

Set the playback direction of an animation thread.

Parameters:
slot thread slot to modify
fwd true to play the animation forwards, false to play backwards
Returns:
true if successful, false if failed
See also:
playThread()
bool ShapeBase::setThreadTimeScale ( int  slot,
float  scale 
)

Set the playback time scale of an animation thread.

Parameters:
slot thread slot to modify
scale new thread time scale (1=normal speed, 0.5=half speed etc)
Returns:
true if successful, false if failed
See also:
playThread
bool ShapeBase::setVelocity ( Point3F  vel  ) 

Set the object's velocity.

Parameters:
vel new velocity for the object
Returns:
true
void ShapeBase::setWhiteOut ( float  level  ) 

Set the white-out level.

White-out may be used as a postfx effect to brighten the screen in response to a game event.

Note:
Relies on the flash postFx.
Parameters:
level flash level (0-1)
See also:
getWhiteOut()
void ShapeBase::startFade ( int  time,
int  delay,
bool  fadeOut 
)

Fade the object in or out without removing it from the scene.

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.

Note:
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.
Parameters:
time duration of the fade effect in ms
delay delay in ms before the fade effect begins
fadeOut true to fade-out to invisible, false to fade-in to full visibility
bool ShapeBase::stopAudio ( int  slot  ) 

Stop a sound started with playAudio.

Parameters:
slot audio slot index (started with playAudio)
Returns:
true if the sound was stopped successfully, false if failed
See also:
playAudio()
bool ShapeBase::stopThread ( int  slot  ) 

Stop an animation thread.

If restarted using playThread, the animation will start from the beginning again.

Parameters:
slot thread slot to stop
Returns:
true if successful, false if failed
See also:
playThread
bool ShapeBase::unmountImage ( int  slot  ) 

Unmount the mounted Image in the specified slot.

Parameters:
slot Image slot to unmount
Returns:
true if successful, false if failed
See also:
mountImage()
float ShapeBase::validateCameraFov ( float  fov  ) 

Called on the server when the client has requested a FOV change.

When the client requests that its field of view should be changed (because they want to use a sniper scope, for example) this new FOV needs to be validated by the server. This method is called if it exists (it is optional) to validate the requested FOV, and modify it if necessary. This could be as simple as checking that the FOV falls within a correct range, to making sure that the FOV matches the capabilities of the current weapon.

Following this method, ShapeBase ensures that the given FOV still falls within the datablock's cameraMinFov and cameraMaxFov. If that is good enough for your purposes, then you do not need to define the validateCameraFov() callback for your ShapeBase.

Parameters:
fov The FOV that has been requested by the client.
Returns:
The FOV as validated by the server.
See also:
ShapeBaseData

Member Data Documentation

bool ShapeBase::isRenderable [static]

Disables rendering of all instances of this type.

Reimplemented from GameBase.

Reimplemented in MissionMarker, WayPoint, StaticShape, Vehicle, HoverVehicle, Player, AIPlayer, Camera, Item, SpawnSphere, PathCamera, RigidShape, FlyingVehicle, and WheeledVehicle.

bool ShapeBase::isSelectable [static]

Disables selection of all instances of this type.

Reimplemented from GameBase.

Reimplemented in MissionMarker, WayPoint, StaticShape, Vehicle, HoverVehicle, Player, AIPlayer, Camera, Item, SpawnSphere, PathCamera, RigidShape, FlyingVehicle, and WheeledVehicle.



Copyright © GarageGames, LLC. All Rights Reserved.