Bullet Collision Detection & Physics Library: btCollisionWorld Class Reference

Bullet Collision Detection & Physics Library

Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
btCollisionWorld Class Reference

CollisionWorld is interface and container for the collision detection. More...

`#include <btCollisionWorld.h>`

Inheritance diagram for btCollisionWorld:
[legend]
Collaboration diagram for btCollisionWorld:
[legend]

## Classes
struct | AllHitsRayResultCallback
struct | ClosestConvexResultCallback
struct | ClosestRayResultCallback
struct | ContactResultCallback
| ContactResultCallback is used to report contact points. More...
struct | ConvexResultCallback
| RayResultCallback is used to report new raycast results. More...
struct | LocalConvexResult
struct | LocalRayResult
struct | LocalShapeInfo
| LocalShapeInfo gives extra information for complex shapes Currently, only btTriangleMeshShape is available, so it just contains triangleIndex and subpart. More...
struct | RayResultCallback
| RayResultCallback is used to report new raycast results. More...

## Public Member Functions
| btCollisionWorld (btDispatcher *dispatcher, btBroadphaseInterface *broadphasePairCache, btCollisionConfiguration *collisionConfiguration)
| for debug drawing More...
virtual | ~btCollisionWorld ()
void | setBroadphase (btBroadphaseInterface *pairCache)
const btBroadphaseInterface * | getBroadphase () const
btBroadphaseInterface * | getBroadphase ()
btOverlappingPairCache * | getPairCache ()
btDispatcher * | getDispatcher ()
const btDispatcher * | getDispatcher () const
void | updateSingleAabb (btCollisionObject *colObj)
virtual void | updateAabbs ()
virtual void | computeOverlappingPairs ()
| the computeOverlappingPairs is usually already called by performDiscreteCollisionDetection (or stepSimulation) it can be useful to use if you perform ray tests without collision detection/simulation More...
virtual void | setDebugDrawer (btIDebugDraw *debugDrawer)
virtual btIDebugDraw * | getDebugDrawer ()
virtual void | debugDrawWorld ()
virtual void | debugDrawObject (const btTransform &worldTransform, const btCollisionShape *shape, const btVector3 &color)
int | getNumCollisionObjects () const
virtual void | rayTest (const btVector3 &rayFromWorld, const btVector3 &rayToWorld, RayResultCallback &resultCallback) const
| rayTest performs a raycast on all objects in the btCollisionWorld, and calls the resultCallback This allows for several queries: first hit, all hits, any hit, dependent on the value returned by the callback. More...
void | convexSweepTest (const btConvexShape *castShape, const btTransform &from, const btTransform &to, ConvexResultCallback &resultCallback, btScalar allowedCcdPenetration=btScalar(0.)) const
| convexTest performs a swept convex cast on all objects in the btCollisionWorld, and calls the resultCallback This allows for several queries: first hit, all hits, any hit, dependent on the value return by the callback. More...
void | contactTest (btCollisionObject *colObj, ContactResultCallback &resultCallback)
| contactTest performs a discrete collision test between colObj against all objects in the btCollisionWorld, and calls the resultCallback. More...
void | contactPairTest (btCollisionObject *colObjA, btCollisionObject *colObjB, ContactResultCallback &resultCallback)
| contactTest performs a discrete collision test between two collision objects and calls the resultCallback if overlap if detected. More...
virtual void | addCollisionObject (btCollisionObject *collisionObject, short int collisionFilterGroup=btBroadphaseProxy::DefaultFilter, short int collisionFilterMask=btBroadphaseProxy::AllFilter)
btCollisionObjectArray & | getCollisionObjectArray ()
const btCollisionObjectArray & | getCollisionObjectArray () const
virtual void | removeCollisionObject (btCollisionObject *collisionObject)
virtual void | performDiscreteCollisionDetection ()
btDispatcherInfo & | getDispatchInfo ()
const btDispatcherInfo & | getDispatchInfo () const
bool | getForceUpdateAllAabbs () const
void | setForceUpdateAllAabbs (bool forceUpdateAllAabbs)
virtual void | serialize (btSerializer *serializer)
| Preliminary serialization test for Bullet 2.76. Loading those files requires a separate parser (Bullet/Demos/SerializeDemo) More...

## Static Public Member Functions
static void | rayTestSingle (const btTransform &rayFromTrans, const btTransform &rayToTrans, btCollisionObject *collisionObject, const btCollisionShape *collisionShape, const btTransform &colObjWorldTransform, RayResultCallback &resultCallback)
| rayTestSingle performs a raycast call and calls the resultCallback. More...
static void | rayTestSingleInternal (const btTransform &rayFromTrans, const btTransform &rayToTrans, const btCollisionObjectWrapper *collisionObjectWrap, RayResultCallback &resultCallback)
static void | objectQuerySingle (const btConvexShape *castShape, const btTransform &rayFromTrans, const btTransform &rayToTrans, btCollisionObject *collisionObject, const btCollisionShape *collisionShape, const btTransform &colObjWorldTransform, ConvexResultCallback &resultCallback, btScalar allowedPenetration)
| objectQuerySingle performs a collision detection query and calls the resultCallback. It is used internally by rayTest. More...
static void | objectQuerySingleInternal (const btConvexShape *castShape, const btTransform &convexFromTrans, const btTransform &convexToTrans, const btCollisionObjectWrapper *colObjWrap, ConvexResultCallback &resultCallback, btScalar allowedPenetration)

## Protected Member Functions
void | serializeCollisionObjects (btSerializer *serializer)

## Protected Attributes
btAlignedObjectArray< btCollisionObject * > | m_collisionObjects
btDispatcher * | m_dispatcher1
btDispatcherInfo | m_dispatchInfo
btBroadphaseInterface * | m_broadphasePairCache
btIDebugDraw * | m_debugDrawer
bool | m_forceUpdateAllAabbs
| m_forceUpdateAllAabbs can be set to false as an optimization to only update active object AABBs it is true by default, because it is error-prone (setting the position of static objects wouldn't update their AABB) More...

## Detailed Description

CollisionWorld is interface and container for the collision detection.

Definition at line 88 of file btCollisionWorld.h.

## Constructor & Destructor Documentation

## § btCollisionWorld()

btCollisionWorld::btCollisionWorld | ( | btDispatcher * | dispatcher,
|  | btBroadphaseInterface * | broadphasePairCache,
|  | btCollisionConfiguration * | collisionConfiguration
| ) |  |

for debug drawing

Definition at line 69 of file btCollisionWorld.cpp.

## § ~btCollisionWorld()

btCollisionWorld::~btCollisionWorld | ( |  | ) |
| virtual

Definition at line 78 of file btCollisionWorld.cpp.

## Member Function Documentation

## § addCollisionObject()

void btCollisionWorld::addCollisionObject | ( | btCollisionObject * | collisionObject,
|  | short int | collisionFilterGroup = `btBroadphaseProxy::DefaultFilter`,
|  | short int | collisionFilterMask = `btBroadphaseProxy::AllFilter`
| ) |  |
| virtual

Reimplemented in btDiscreteDynamicsWorld.

Definition at line 111 of file btCollisionWorld.cpp.

## § computeOverlappingPairs()

void btCollisionWorld::computeOverlappingPairs | ( |  | ) |
| virtual

the computeOverlappingPairs is usually already called by performDiscreteCollisionDetection (or stepSimulation) it can be useful to use if you perform ray tests without collision detection/simulation

Definition at line 208 of file btCollisionWorld.cpp.

## § contactPairTest()

void btCollisionWorld::contactPairTest | ( | btCollisionObject * | colObjA,
|  | btCollisionObject * | colObjB,
|  | ContactResultCallback & | resultCallback
| ) |  |

contactTest performs a discrete collision test between two collision objects and calls the resultCallback if overlap if detected.

it reports one or more contact points (including the one with deepest penetration)

Definition at line 1246 of file btCollisionWorld.cpp.

## § contactTest()

void btCollisionWorld::contactTest | ( | btCollisionObject * | colObj,
|  | ContactResultCallback & | resultCallback
| ) |  |

contactTest performs a discrete collision test between colObj against all objects in the btCollisionWorld, and calls the resultCallback.

contactTest performs a discrete collision test against all objects in the btCollisionWorld, and calls the resultCallback.

it reports one or more contact points for every overlapping object (including the one with deepest penetration)

Definition at line 1234 of file btCollisionWorld.cpp.

## § convexSweepTest()

void btCollisionWorld::convexSweepTest | ( | const btConvexShape * | castShape,
|  | const btTransform & | from,
|  | const btTransform & | to,
|  | ConvexResultCallback & | resultCallback,
|  | btScalar | allowedCcdPenetration = `btScalar(0.)`
| ) |  | const

convexTest performs a swept convex cast on all objects in the btCollisionWorld, and calls the resultCallback This allows for several queries: first hit, all hits, any hit, dependent on the value return by the callback.

use the broadphase to accelerate the search for objects, based on their aabb and for each object with ray-aabb overlap, perform an exact ray test unfortunately the implementation for rayTest and convexSweepTest duplicated, albeit practically identical

Definition at line 1068 of file btCollisionWorld.cpp.

## § debugDrawObject()

void btCollisionWorld::debugDrawObject | ( | const btTransform & | worldTransform,
|  | const btCollisionShape * | shape,
|  | const btVector3 & | color
| ) |  |
| virtual

for polyhedral shapes

Definition at line 1312 of file btCollisionWorld.cpp.

## § debugDrawWorld()

void btCollisionWorld::debugDrawWorld | ( |  | ) |
| virtual

Reimplemented in btDiscreteDynamicsWorld, btMultiBodyDynamicsWorld, btDynamicsWorld, btSimpleDynamicsWorld, and btSoftRigidDynamicsWorld.

Definition at line 1494 of file btCollisionWorld.cpp.

## § getBroadphase() [1/2]

const btBroadphaseInterface* btCollisionWorld::getBroadphase | ( |  | ) | const
| inline

Definition at line 122 of file btCollisionWorld.h.

## § getBroadphase() [2/2]

btBroadphaseInterface* btCollisionWorld::getBroadphase | ( |  | ) |
| inline

Definition at line 127 of file btCollisionWorld.h.

## § getCollisionObjectArray() [1/2]

btCollisionObjectArray& btCollisionWorld::getCollisionObjectArray | ( |  | ) |
| inline

Definition at line 486 of file btCollisionWorld.h.

## § getCollisionObjectArray() [2/2]

const btCollisionObjectArray& btCollisionWorld::getCollisionObjectArray | ( |  | ) | const
| inline

Definition at line 491 of file btCollisionWorld.h.

## § getDebugDrawer()

virtual btIDebugDraw* btCollisionWorld::getDebugDrawer | ( |  | ) |
| inlinevirtual

Definition at line 162 of file btCollisionWorld.h.

## § getDispatcher() [1/2]

btDispatcher* btCollisionWorld::getDispatcher | ( |  | ) |
| inline

Definition at line 138 of file btCollisionWorld.h.

## § getDispatcher() [2/2]

const btDispatcher* btCollisionWorld::getDispatcher | ( |  | ) | const
| inline

Definition at line 143 of file btCollisionWorld.h.

## § getDispatchInfo() [1/2]

btDispatcherInfo& btCollisionWorld::getDispatchInfo | ( |  | ) |
| inline

Definition at line 501 of file btCollisionWorld.h.

## § getDispatchInfo() [2/2]

const btDispatcherInfo& btCollisionWorld::getDispatchInfo | ( |  | ) | const
| inline

Definition at line 506 of file btCollisionWorld.h.

## § getForceUpdateAllAabbs()

bool btCollisionWorld::getForceUpdateAllAabbs | ( |  | ) | const
| inline

Definition at line 511 of file btCollisionWorld.h.

## § getNumCollisionObjects()

int btCollisionWorld::getNumCollisionObjects | ( |  | ) | const
| inline

Definition at line 438 of file btCollisionWorld.h.

## § getPairCache()

btOverlappingPairCache* btCollisionWorld::getPairCache | ( |  | ) |
| inline

Definition at line 132 of file btCollisionWorld.h.

## § objectQuerySingle()

void btCollisionWorld::objectQuerySingle | ( | const btConvexShape * | castShape,
|  | const btTransform & | rayFromTrans,
|  | const btTransform & | rayToTrans,
|  | btCollisionObject * | collisionObject,
|  | const btCollisionShape * | collisionShape,
|  | const btTransform & | colObjWorldTransform,
|  | ConvexResultCallback & | resultCallback,
|  | btScalar | allowedPenetration
| ) |  |
| static

objectQuerySingle performs a collision detection query and calls the resultCallback. It is used internally by rayTest.

Definition at line 572 of file btCollisionWorld.cpp.

## § objectQuerySingleInternal()

void btCollisionWorld::objectQuerySingleInternal | ( | const btConvexShape * | castShape,
|  | const btTransform & | convexFromTrans,
|  | const btTransform & | convexToTrans,
|  | const btCollisionObjectWrapper * | colObjWrap,
|  | ConvexResultCallback & | resultCallback,
|  | btScalar | allowedPenetration
| ) |  |
| static

Definition at line 582 of file btCollisionWorld.cpp.

## § performDiscreteCollisionDetection()

void btCollisionWorld::performDiscreteCollisionDetection | ( |  | ) |
| virtual

Definition at line 214 of file btCollisionWorld.cpp.

## § rayTest()

void btCollisionWorld::rayTest | ( | const btVector3 & | rayFromWorld,
|  | const btVector3 & | rayToWorld,
|  | RayResultCallback & | resultCallback
| ) |  | const
| virtual

rayTest performs a raycast on all objects in the btCollisionWorld, and calls the resultCallback This allows for several queries: first hit, all hits, any hit, dependent on the value returned by the callback.

use the broadphase to accelerate the search for objects, based on their aabb and for each object with ray-aabb overlap, perform an exact ray test

Reimplemented in btSoftRigidDynamicsWorld.

Definition at line 990 of file btCollisionWorld.cpp.

## § rayTestSingle()

void btCollisionWorld::rayTestSingle | ( | const btTransform & | rayFromTrans,
|  | const btTransform & | rayToTrans,
|  | btCollisionObject * | collisionObject,
|  | const btCollisionShape * | collisionShape,
|  | const btTransform & | colObjWorldTransform,
|  | RayResultCallback & | resultCallback
| ) |  |
| static

rayTestSingle performs a raycast call and calls the resultCallback.

It is used internally by rayTest. In a future implementation, we consider moving the ray test as a virtual method in btCollisionShape. This allows more customization.

Definition at line 262 of file btCollisionWorld.cpp.

## § rayTestSingleInternal()

void btCollisionWorld::rayTestSingleInternal | ( | const btTransform & | rayFromTrans,
|  | const btTransform & | rayToTrans,
|  | const btCollisionObjectWrapper * | collisionObjectWrap,
|  | RayResultCallback & | resultCallback
| ) |  |
| static

optimized version for btBvhTriangleMeshShape

Definition at line 272 of file btCollisionWorld.cpp.

## § removeCollisionObject()

void btCollisionWorld::removeCollisionObject | ( | btCollisionObject * | collisionObject | ) |
| virtual

Reimplemented in btDiscreteDynamicsWorld, btSimpleDynamicsWorld, and btSoftRigidDynamicsWorld.

Definition at line 235 of file btCollisionWorld.cpp.

## § serialize()

void btCollisionWorld::serialize | ( | btSerializer * | serializer | ) |
| virtual

Preliminary serialization test for Bullet 2.76. Loading those files requires a separate parser (Bullet/Demos/SerializeDemo)

Reimplemented in btDiscreteDynamicsWorld, btMultiBodyDynamicsWorld, and btSoftRigidDynamicsWorld.

Definition at line 1617 of file btCollisionWorld.cpp.

## § serializeCollisionObjects()

void btCollisionWorld::serializeCollisionObjects | ( | btSerializer * | serializer | ) |
| protected

keep track of shapes already serialized

Definition at line 1586 of file btCollisionWorld.cpp.

## § setBroadphase()

void btCollisionWorld::setBroadphase | ( | btBroadphaseInterface * | pairCache | ) |
| inline

Definition at line 117 of file btCollisionWorld.h.

## § setDebugDrawer()

virtual void btCollisionWorld::setDebugDrawer | ( | btIDebugDraw * | debugDrawer | ) |
| inlinevirtual

Definition at line 157 of file btCollisionWorld.h.

## § setForceUpdateAllAabbs()

void btCollisionWorld::setForceUpdateAllAabbs | ( | bool | forceUpdateAllAabbs | ) |
| inline

Definition at line 515 of file btCollisionWorld.h.

## § updateAabbs()

void btCollisionWorld::updateAabbs | ( |  | ) |
| virtual

Reimplemented in btSimpleDynamicsWorld.

Definition at line 190 of file btCollisionWorld.cpp.

## § updateSingleAabb()

void btCollisionWorld::updateSingleAabb | ( | btCollisionObject * | colObj | ) |

Definition at line 147 of file btCollisionWorld.cpp.

## Member Data Documentation

## § m_broadphasePairCache

btBroadphaseInterface* btCollisionWorld::m_broadphasePairCache
| protected

Definition at line 100 of file btCollisionWorld.h.

## § m_collisionObjects

btAlignedObjectArray<btCollisionObject*> btCollisionWorld::m_collisionObjects
| protected

Definition at line 94 of file btCollisionWorld.h.

## § m_debugDrawer

btIDebugDraw* btCollisionWorld::m_debugDrawer
| protected

Definition at line 102 of file btCollisionWorld.h.

## § m_dispatcher1

btDispatcher* btCollisionWorld::m_dispatcher1
| protected

Definition at line 96 of file btCollisionWorld.h.

## § m_dispatchInfo

btDispatcherInfo btCollisionWorld::m_dispatchInfo
| protected

Definition at line 98 of file btCollisionWorld.h.

## § m_forceUpdateAllAabbs

bool btCollisionWorld::m_forceUpdateAllAabbs
| protected

m_forceUpdateAllAabbs can be set to false as an optimization to only update active object AABBs it is true by default, because it is error-prone (setting the position of static objects wouldn't update their AABB)

Definition at line 106 of file btCollisionWorld.h.

The documentation for this class was generated from the following files:

- btCollisionWorld.h
- btCollisionWorld.cpp