Torque 3D - Script Manual: RigidShape Class Reference

TorqueScript

Main   Class List   Namespace List   Online

RigidShape Class Reference
[Platform]

The RigidShape class implements rigid-body physics for DTS objects in the world. More...

Inheritance diagram for RigidShape:

List of all members.

Public Member Functions

void freezeSim (bool isFrozen)
 Enables or disables the physics simulation on the RigidShape object.
void reset ()
 Clears physic forces from the shape and sets it at rest.
Callbacks

void onEnterLiquid (string objId, string waterCoverage, string liquidType)
 Called whenever this RigidShape object enters liquid.
void onLeaveLiquid (string objId, string liquidType)
 Called whenever the RigidShape object exits liquid.

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

The RigidShape class implements rigid-body physics for DTS objects in the world.

"Rigid body physics" refers to a system whereby objects are assumed to have a finite size, equally distributed masses, and where deformations of the objects themselves are not accounted for. Uses the RigidShape class to control its physics.

Example:
   datablock RigidShapeData( BouncingBoulder )
   {
      category = "RigidShape";

      shapeFile = "~/data/shapes/boulder/boulder.dts";
      emap = true;

      // Rigid Body
      mass = 500;
      massCenter = "0 0 0";    // Center of mass for rigid body
      massBox = "0 0 0";         // Size of box used for moment of inertia,
                          // if zero it defaults to object bounding box
      drag = 0.2;                // Drag coefficient
      bodyFriction = 0.2;
      bodyRestitution = 0.1;
      minImpactSpeed = 5;        // Impacts over this invoke the script callback
      softImpactSpeed = 5;       // Play SoftImpact Sound
      hardImpactSpeed = 15;      // Play HardImpact Sound
      integration = 4;           // Physics integration: TickSec/Rate
      collisionTol = 0.1;        // Collision distance tolerance
      contactTol = 0.1;          // Contact velocity tolerance

      minRollSpeed = 10;

      maxDrag = 0.5;
      minDrag = 0.01;

      dustHeight = 10;

      dragForce = 0.05;
      vertFactor = 0.05;
   };

 new RigidShape()
   {
      dataBlock = "BouncingBoulder";
      parentGroup = EWCreatorWindow.objectGroup;
   };
See also:
RigidShapeData
ShapeBase

Member Function Documentation

void RigidShape::freezeSim ( bool  isFrozen  ) 

Enables or disables the physics simulation on the RigidShape object.

Parameters:
isFrozen Boolean frozen state to set the object.
Example:
// Define the frozen state.
%isFrozen = "true";

// Inform the object of the defined frozen state
%thisRigidShape.freezeSim(%isFrozen);
See also:
ShapeBaseData
void RigidShape::onEnterLiquid ( string  objId,
string  waterCoverage,
string  liquidType 
)

Called whenever this RigidShape object enters liquid.

Parameters:
objId The ID of the rigidShape object.
waterCoverage Amount of water coverage the RigidShape has.
liquidType Type of liquid that was entered.
Example:
// The RigidShape object falls in a body of liquid, causing the callback to occur.
RigidShape::onEnterLiquid(%this,%objId,%waterCoverage,%liquidType)
   {
      // Code to run whenever this callback occurs.
   }
See also:
ShapeBase
void RigidShape::onLeaveLiquid ( string  objId,
string  liquidType 
)

Called whenever the RigidShape object exits liquid.

Parameters:
objId The ID of the RigidShape object.
liquidType Type if liquid that was exited.
Example:
// The RigidShape object exits in a body of liquid, causing the callback to occur.
RigidShape::onLeaveLiquid(%this,%objId,%liquidType)
   {
      // Code to run whenever this callback occurs.
   }
See also:
ShapeBase
void RigidShape::reset (  ) 

Clears physic forces from the shape and sets it at rest.

Example:
// Inform the RigidShape object to reset.
%thisRigidShape.reset();
See also:
ShapeBaseData


Copyright © GarageGames, LLC. All Rights Reserved.