#include <PhysicsCollisionObject.h>
Defines the base class for all physics objects that support collision events.
Represents the different types of collision objects.
RIGID_BODY |
PhysicsRigidBody type. |
CHARACTER |
PhysicsCharacter type. |
GHOST_OBJECT |
PhysicsGhostObject type. |
VEHICLE |
PhysicsVehicle type. |
VEHICLE_WHEEL |
PhysicsVehicleWheel type. |
NONE |
No collision object. |
virtual gameplay::PhysicsCollisionObject::~PhysicsCollisionObject | ( | ) | [virtual] |
Virtual destructor.
gameplay::PhysicsCollisionObject::PhysicsCollisionObject | ( | Node * | node, |
int | group = PHYSICS_COLLISION_GROUP_DEFAULT , |
||
int | mask = PHYSICS_COLLISION_MASK_DEFAULT |
||
) | [protected] |
Constructor.
void gameplay::PhysicsCollisionObject::addCollisionListener | ( | CollisionListener * | listener, |
PhysicsCollisionObject * | object = NULL |
||
) |
Adds a collision listener for this collision object.
listener | The listener to add. |
object | Optional collision object used to filter the collision event. |
void gameplay::PhysicsCollisionObject::addCollisionListener | ( | const char * | function, |
PhysicsCollisionObject * | object = NULL |
||
) |
Adds a collision listener for this collision object.
Note: the given script function must be global and it must match the function signature of PhysicsCollisionObject::CollisionListener::collisionEvent.
function | A valid global script function to add as a listener callback. |
object | Optional collision object used to filter the collision event. |
bool gameplay::PhysicsCollisionObject::collidesWith | ( | PhysicsCollisionObject * | object | ) | const |
Checks if this collision object collides with the given object.
object | The collision object to test for collision with. |
virtual btCollisionObject* gameplay::PhysicsCollisionObject::getCollisionObject | ( | ) | const [protected, pure virtual] |
Returns the Bullet Physics collision object.
Implemented in gameplay::PhysicsRigidBody, gameplay::PhysicsVehicle, gameplay::PhysicsVehicleWheel, gameplay::PhysicsCharacter, and gameplay::PhysicsGhostObject.
Returns the collision shape.
Node* gameplay::PhysicsCollisionObject::getNode | ( | ) | const |
Returns the node associated with this collision object.
Returns the type of the shape for this collision object.
virtual PhysicsCollisionObject::Type gameplay::PhysicsCollisionObject::getType | ( | ) | const [pure virtual] |
Returns the type of the collision object.
Implemented in gameplay::PhysicsRigidBody, gameplay::PhysicsCharacter, gameplay::PhysicsVehicle, gameplay::PhysicsVehicleWheel, and gameplay::PhysicsGhostObject.
bool gameplay::PhysicsCollisionObject::isDynamic | ( | ) | const |
Returns whether this collision object is dynamic.
A dynamic collision object is simulated entirely by the physics system, such as with dynamic rigid bodies.
bool gameplay::PhysicsCollisionObject::isEnabled | ( | ) | const |
Check if the collision object is enabled.
bool gameplay::PhysicsCollisionObject::isKinematic | ( | ) | const |
Returns whether this collision object is kinematic.
A kinematic collision object is an object that is not simulated by the physics system and instead has its transform driven manually.
bool gameplay::PhysicsCollisionObject::isStatic | ( | ) | const |
Returns whether this collision object is static.
A static collision object is not simulated by the physics system and cannot be transformed once created.
Reimplemented in gameplay::PhysicsRigidBody.
void gameplay::PhysicsCollisionObject::removeCollisionListener | ( | CollisionListener * | listener, |
PhysicsCollisionObject * | object = NULL |
||
) |
Removes a collision listener.
listener | The listener to remove. |
object | Optional collision object used to filter the collision event. |
void gameplay::PhysicsCollisionObject::removeCollisionListener | ( | const char * | function, |
PhysicsCollisionObject * | object = NULL |
||
) |
Removes a collision listener.
function | The previously added script function to remove. |
object | Optional collision object used to filter the collision event. |
void gameplay::PhysicsCollisionObject::setEnabled | ( | bool | enable | ) |
Sets the collision object to be enabled or disabled.
enable | true enables the collision object, false disables it. |
Reimplemented in gameplay::PhysicsRigidBody, gameplay::PhysicsVehicle, and gameplay::PhysicsVehicleWheel.
The PhysicsCollisionObject's collision shape.
bool gameplay::PhysicsCollisionObject::_enabled [protected] |
If the collision object is enabled or not.
Node* gameplay::PhysicsCollisionObject::_node [protected] |
Pointer to Node contained by this collision object.
std::vector<ScriptListener*>* gameplay::PhysicsCollisionObject::_scriptListeners [protected] |
The list of script listeners.