Base class for representing physics objects. More...
#include <Physics/PhysicsJoint.h>
Inherited by PhysicsDistanceJoint.
Public Member Functions | |
PhysicsJoint () | |
Constructor. | |
virtual | ~PhysicsJoint () |
Deconstructor. | |
void | Attach1 (PhysicsObject *obj) |
Attaches an object to the joint. | |
void | Attach2 (PhysicsObject *obj) |
Attaches an object to the joint. | |
PhysicsObject * | GetAttached1 () const |
Gets the first object attached to the joint. | |
PhysicsObject * | GetAttached2 () const |
Gets the second object attached to the joint. | |
void | EnableCollisions (bool yn) |
Enables/Disable the ability for attached objects to collide. Defaults to deisabled. | |
bool | AreCollisionsAllowed () const |
Determines if attached objects are allowed to collide. | |
bool | CreateJoint (PhysicsWorld *w) |
Creates the actual physics joint. NOTE: Call this function once the joint is setup. | |
PhysicsWorld * | GetWorld () const |
Gets the pointer to the physics world the joint belongs to. | |
b2Joint * | GetBox2DJoint () const |
Gets the pointer to the Box2D joint. | |
Protected Member Functions | |
bool | IsJointValid () const |
Determines if the joint has been created. | |
void | DestroyJoint () |
Frees the resources associated with the joints. | |
virtual b2Joint * | CreateBox2DJoint ()=0 |
Creates the actual Box2D physics joint. |
Base class for representing physics objects.
bool PhysicsJoint::AreCollisionsAllowed | ( | ) | const |
Determines if attached objects are allowed to collide.
void PhysicsJoint::Attach1 | ( | PhysicsObject * | obj | ) |
Attaches an object to the joint.
[in] | obj | the object to attach to the joint. |
void PhysicsJoint::Attach2 | ( | PhysicsObject * | obj | ) |
Attaches an object to the joint.
[in] | obj | the object to attach to the joint. |
virtual b2Joint* PhysicsJoint::CreateBox2DJoint | ( | ) | [protected, pure virtual] |
Creates the actual Box2D physics joint.
[in] | world | the physics world to create the joint in. |
NOTE: This function should be implemented by each joint class.
Implemented in PhysicsDistanceJoint.
bool PhysicsJoint::CreateJoint | ( | PhysicsWorld * | w | ) |
Creates the actual physics joint. NOTE: Call this function once the joint is setup.
[in] | w | the physics world to create the joint in. |
void PhysicsJoint::EnableCollisions | ( | bool | yn | ) |
Enables/Disable the ability for attached objects to collide. Defaults to deisabled.
[in] | yn | set to true to enable collisions or false to disable collisions. |
PhysicsObject * PhysicsJoint::GetAttached1 | ( | ) | const |
Gets the first object attached to the joint.
PhysicsObject * PhysicsJoint::GetAttached2 | ( | ) | const |
Gets the second object attached to the joint.
b2Joint * PhysicsJoint::GetBox2DJoint | ( | ) | const |
Gets the pointer to the Box2D joint.
PhysicsWorld * PhysicsJoint::GetWorld | ( | ) | const |
Gets the pointer to the physics world the joint belongs to.
bool PhysicsJoint::IsJointValid | ( | ) | const [protected] |
Determines if the joint has been created.