overview wiki api reference download
 All Classes Functions Variables Typedefs Enumerations Enumerator
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes
gameplay::PhysicsConstraint Class Reference

#include <PhysicsConstraint.h>

Inheritance diagram for gameplay::PhysicsConstraint:
gameplay::PhysicsGenericConstraint gameplay::PhysicsHingeConstraint gameplay::PhysicsSocketConstraint gameplay::PhysicsFixedConstraint gameplay::PhysicsSpringConstraint

List of all members.

Public Member Functions

float getBreakingImpulse () const
void setBreakingImpulse (float impulse)
bool isEnabled () const
void setEnabled (bool enabled)

Static Public Member Functions

static Vector3 centerOfMassMidpoint (const Node *a, const Node *b)
static Quaternion getRotationOffset (const Node *node, const Vector3 &point)
static Vector3 getTranslationOffset (const Node *node, const Vector3 &point)

Protected Member Functions

 PhysicsConstraint (PhysicsRigidBody *a, PhysicsRigidBody *b)
virtual ~PhysicsConstraint ()

Static Protected Member Functions

static btTransform getTransformOffset (const Node *node, const Vector3 &origin)
static Vector3 getWorldCenterOfMass (const Node *node)
static Vector3 offsetByCenterOfMass (const Node *node, const Vector3 &v)

Protected Attributes

PhysicsRigidBody_a
PhysicsRigidBody_b
btTypedConstraint * _constraint

Detailed Description

Defines the base class for physics constraints.

See also:
http://gameplay3d.github.io/GamePlay/docs/file-formats.html#wiki-Constraints

Constructor & Destructor Documentation

Constructor.

virtual gameplay::PhysicsConstraint::~PhysicsConstraint ( ) [protected, virtual]

Destructor.


Member Function Documentation

static Vector3 gameplay::PhysicsConstraint::centerOfMassMidpoint ( const Node a,
const Node b 
) [static]

Calculates the midpoint between the given nodes' centers of mass.

Parameters:
aThe first node.
bThe second node.

Gets the impulse needed to break the constraint.

Returns:
The impulse needed to break the constraint.
static Quaternion gameplay::PhysicsConstraint::getRotationOffset ( const Node node,
const Vector3 point 
) [static]

Calculates the rotation offset to the given point in the given node's local space.

Parameters:
nodeThe node to calculate a rotation offset for.
pointThe point to calculate the rotation offset to.
static btTransform gameplay::PhysicsConstraint::getTransformOffset ( const Node node,
const Vector3 origin 
) [static, protected]

Calculates the transform to be used as the offset (i.e. "frame in" parameter in Bullet terms) to the given constraint origin.

static Vector3 gameplay::PhysicsConstraint::getTranslationOffset ( const Node node,
const Vector3 point 
) [static]

Calculates the translation offset to the given point in the given node's local space.

Parameters:
nodeThe node to calculate a translation offset for.
pointThe point to calculate the translation offset to.
static Vector3 gameplay::PhysicsConstraint::getWorldCenterOfMass ( const Node node) [static, protected]

Calculates the center of mass in world space of the given node.

bool gameplay::PhysicsConstraint::isEnabled ( ) const [inline]

Gets whether the constraint is enabled or not.

Returns:
Whether the constraint is enabled or not.
static Vector3 gameplay::PhysicsConstraint::offsetByCenterOfMass ( const Node node,
const Vector3 v 
) [static, protected]

Offsets the given vector by the given node's center of mass.

void gameplay::PhysicsConstraint::setBreakingImpulse ( float  impulse) [inline]

Sets the impulse needed to break the constraint (if an impulse greater than or equal to the given value is applied to the constraint, the constraint will be broken).

Parameters:
impulseThe impulse needed to break the constraint.
void gameplay::PhysicsConstraint::setEnabled ( bool  enabled) [inline]

Sets whether the constraint is enabled or not.

Parameters:
enabledWhether the constraint is enabled or not.

Member Data Documentation

Pointer to the one rigid body bound by this constraint.

Pointer to the other rigid body bound by this constraint.

btTypedConstraint* gameplay::PhysicsConstraint::_constraint [protected]

Pointer to the Bullet constraint.

 All Classes Functions Variables Typedefs Enumerations Enumerator