Torque 3D - Script Manual: PhysicsForce Class Reference

TorqueScript

Main   Class List   Namespace List   Online

PhysicsForce Class Reference
[Physics]

Helper object for gameplay physical forces. More...

Inheritance diagram for PhysicsForce:

List of all members.

Public Member Functions

void attach (Point3F start, Point3F direction, float maxDist)
 Attempts to associate the PhysicsForce with a PhysicsBody.
void detach (Point3F force=Point3F::Zero)
 Disassociates the PhysicsForce from any attached PhysicsBody.
bool isAttached ()
 Returns true if the PhysicsForce is currently attached to an object.

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

Helper object for gameplay physical forces.

PhysicsForces can be created and "attached" to other PhysicsBodies to attract them to the position of the PhysicsForce.


Member Function Documentation

void PhysicsForce::attach ( Point3F  start,
Point3F  direction,
float  maxDist 
)

Attempts to associate the PhysicsForce with a PhysicsBody.

Performs a physics ray cast of the provided length and direction. The PhysicsForce will attach itself to the first dynamic PhysicsBody the ray collides with. On every tick, the attached body will be attracted towards the position of the PhysicsForce.

A PhysicsForce can only be attached to one body at a time.

Note:
To determine if an attach was successful, check isAttached() immediately after calling this function.n
void PhysicsForce::detach ( Point3F  force = Point3F::Zero  ) 

Disassociates the PhysicsForce from any attached PhysicsBody.

Parameters:
force Optional force to apply to the attached PhysicsBody before detaching.
Note:
Has no effect if the PhysicsForce is not attached to anything.
bool PhysicsForce::isAttached (  ) 

Returns true if the PhysicsForce is currently attached to an object.

See also:
PhysicsForce::attach()


Copyright © GarageGames, LLC. All Rights Reserved.