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

#include <PhysicsCollisionObject.h>

Inheritance diagram for gameplay::PhysicsCollisionObject:
gameplay::PhysicsGhostObject gameplay::PhysicsRigidBody gameplay::PhysicsVehicle gameplay::PhysicsVehicleWheel gameplay::PhysicsCharacter

List of all members.

Classes

class  CollisionListener
class  CollisionPair
class  PhysicsMotionState
class  ScriptListener

Public Types

enum  Type {
  RIGID_BODY, CHARACTER, GHOST_OBJECT, VEHICLE,
  VEHICLE_WHEEL, NONE
}

Public Member Functions

virtual ~PhysicsCollisionObject ()
virtual
PhysicsCollisionObject::Type 
getType () const =0
PhysicsCollisionShape::Type getShapeType () const
NodegetNode () const
PhysicsCollisionShapegetCollisionShape () const
bool isKinematic () const
bool isStatic () const
bool isDynamic () const
bool isEnabled () const
void setEnabled (bool enable)
void addCollisionListener (CollisionListener *listener, PhysicsCollisionObject *object=NULL)
void removeCollisionListener (CollisionListener *listener, PhysicsCollisionObject *object=NULL)
void addCollisionListener (const char *function, PhysicsCollisionObject *object=NULL)
void removeCollisionListener (const char *function, PhysicsCollisionObject *object=NULL)
bool collidesWith (PhysicsCollisionObject *object) const

Protected Member Functions

 PhysicsCollisionObject (Node *node, int group=PHYSICS_COLLISION_GROUP_DEFAULT, int mask=PHYSICS_COLLISION_MASK_DEFAULT)
virtual btCollisionObject * getCollisionObject () const =0

Protected Attributes

Node_node
PhysicsCollisionShape_collisionShape
bool _enabled
std::vector< ScriptListener * > * _scriptListeners

Detailed Description

Defines the base class for all physics objects that support collision events.

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

Member Enumeration Documentation

Represents the different types of collision objects.

Enumerator:
RIGID_BODY 

PhysicsRigidBody type.

CHARACTER 

PhysicsCharacter type.

GHOST_OBJECT 

PhysicsGhostObject type.

VEHICLE 

PhysicsVehicle type.

VEHICLE_WHEEL 

PhysicsVehicleWheel type.

NONE 

No collision object.


Constructor & Destructor Documentation

Virtual destructor.

gameplay::PhysicsCollisionObject::PhysicsCollisionObject ( Node node,
int  group = PHYSICS_COLLISION_GROUP_DEFAULT,
int  mask = PHYSICS_COLLISION_MASK_DEFAULT 
) [protected]

Constructor.


Member Function Documentation

Adds a collision listener for this collision object.

Parameters:
listenerThe listener to add.
objectOptional 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.

Parameters:
functionA valid global script function to add as a listener callback.
objectOptional collision object used to filter the collision event.

Checks if this collision object collides with the given object.

Parameters:
objectThe collision object to test for collision with.
Returns:
true if this object collides with the specified one; false otherwise.
virtual btCollisionObject* gameplay::PhysicsCollisionObject::getCollisionObject ( ) const [protected, pure virtual]

Returns the Bullet Physics collision object.

Returns:
The Bullet collision object.

Implemented in gameplay::PhysicsRigidBody, gameplay::PhysicsVehicle, gameplay::PhysicsVehicleWheel, gameplay::PhysicsCharacter, and gameplay::PhysicsGhostObject.

Returns the collision shape.

Returns:
The collision shape.

Returns the node associated with this collision object.

Returns the type of the shape for this collision object.

Returns whether this collision object is dynamic.

A dynamic collision object is simulated entirely by the physics system, such as with dynamic rigid bodies.

Returns:
true if the collision object is dynamic.

Check if the collision object is enabled.

Returns:
true if the collision object is enabled.

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.

Returns:
true if the collision object is kinematic.

Returns whether this collision object is static.

A static collision object is not simulated by the physics system and cannot be transformed once created.

Returns:
true if the collision object is static.

Reimplemented in gameplay::PhysicsRigidBody.

Removes a collision listener.

Parameters:
listenerThe listener to remove.
objectOptional collision object used to filter the collision event.
void gameplay::PhysicsCollisionObject::removeCollisionListener ( const char *  function,
PhysicsCollisionObject object = NULL 
)

Removes a collision listener.

Parameters:
functionThe previously added script function to remove.
objectOptional collision object used to filter the collision event.

Sets the collision object to be enabled or disabled.

Parameters:
enabletrue enables the collision object, false disables it.

Reimplemented in gameplay::PhysicsRigidBody, gameplay::PhysicsVehicle, and gameplay::PhysicsVehicleWheel.


Member Data Documentation

The PhysicsCollisionObject's collision shape.

If the collision object is enabled or not.

Pointer to Node contained by this collision object.

The list of script listeners.

 All Classes Functions Variables Typedefs Enumerations Enumerator