PhysicsForce

consoledoc.h

Helper object for gameplay physical forces.

More...

Public Static Attributes

bool

Disables rendering of all instances of this type.

bool

Disables selection of all instances of this type.

Public Functions

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

Attempts to associate the PhysicsForce with a PhysicsBody.

void
detach(Point3F force)

Disassociates the PhysicsForce from any attached PhysicsBody.

bool

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

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.

Public Static Attributes

bool isRenderable 

Disables rendering of all instances of this type.

bool isSelectable 

Disables selection of all instances of this type.

Public Functions

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

detach(Point3F force)

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.

isAttached()

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