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:
Inheritance graph
[legend]
Collaboration diagram for btCollisionWorld:
Collaboration graph
[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 btBroadphaseInterfacegetBroadphase () const
 
btBroadphaseInterfacegetBroadphase ()
 
btOverlappingPairCachegetPairCache ()
 
btDispatchergetDispatcher ()
 
const btDispatchergetDispatcher () 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 btIDebugDrawgetDebugDrawer ()
 
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)
 
btCollisionObjectArraygetCollisionObjectArray ()
 
const btCollisionObjectArraygetCollisionObjectArray () const
 
virtual void removeCollisionObject (btCollisionObject *collisionObject)
 
virtual void performDiscreteCollisionDetection ()
 
btDispatcherInfogetDispatchInfo ()
 
const btDispatcherInfogetDispatchInfo () 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
 
btDispatcherm_dispatcher1
 
btDispatcherInfo m_dispatchInfo
 
btBroadphaseInterfacem_broadphasePairCache
 
btIDebugDrawm_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 ( btDispatcher dispatcher,
btBroadphaseInterface broadphasePairCache,
btCollisionConfiguration collisionConfiguration 
)

for debug drawing

Definition at line 69 of file btCollisionWorld.cpp.

btCollisionWorld::~btCollisionWorld ( )
virtual

Definition at line 78 of file btCollisionWorld.cpp.

Member Function Documentation

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.

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.

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 1185 of file btCollisionWorld.cpp.

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 1173 of file btCollisionWorld.cpp.

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 1007 of file btCollisionWorld.cpp.

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

for polyhedral shapes

Definition at line 1251 of file btCollisionWorld.cpp.

void btCollisionWorld::debugDrawWorld ( )
virtual
const btBroadphaseInterface* btCollisionWorld::getBroadphase ( ) const
inline

Definition at line 122 of file btCollisionWorld.h.

btBroadphaseInterface* btCollisionWorld::getBroadphase ( )
inline

Definition at line 127 of file btCollisionWorld.h.

btCollisionObjectArray& btCollisionWorld::getCollisionObjectArray ( )
inline

Definition at line 486 of file btCollisionWorld.h.

const btCollisionObjectArray& btCollisionWorld::getCollisionObjectArray ( ) const
inline

Definition at line 491 of file btCollisionWorld.h.

virtual btIDebugDraw* btCollisionWorld::getDebugDrawer ( )
inlinevirtual

Definition at line 162 of file btCollisionWorld.h.

btDispatcher* btCollisionWorld::getDispatcher ( )
inline

Definition at line 138 of file btCollisionWorld.h.

const btDispatcher* btCollisionWorld::getDispatcher ( ) const
inline

Definition at line 143 of file btCollisionWorld.h.

btDispatcherInfo& btCollisionWorld::getDispatchInfo ( )
inline

Definition at line 501 of file btCollisionWorld.h.

const btDispatcherInfo& btCollisionWorld::getDispatchInfo ( ) const
inline

Definition at line 506 of file btCollisionWorld.h.

bool btCollisionWorld::getForceUpdateAllAabbs ( ) const
inline

Definition at line 511 of file btCollisionWorld.h.

int btCollisionWorld::getNumCollisionObjects ( ) const
inline

Definition at line 438 of file btCollisionWorld.h.

btOverlappingPairCache* btCollisionWorld::getPairCache ( )
inline

Definition at line 132 of file btCollisionWorld.h.

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 577 of file btCollisionWorld.cpp.

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

Definition at line 587 of file btCollisionWorld.cpp.

void btCollisionWorld::performDiscreteCollisionDetection ( )
virtual

Definition at line 214 of file btCollisionWorld.cpp.

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 929 of file btCollisionWorld.cpp.

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.

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.

void btCollisionWorld::removeCollisionObject ( btCollisionObject collisionObject)
virtual
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, and btSoftRigidDynamicsWorld.

Definition at line 1543 of file btCollisionWorld.cpp.

void btCollisionWorld::serializeCollisionObjects ( btSerializer serializer)
protected

keep track of shapes already serialized

Definition at line 1512 of file btCollisionWorld.cpp.

void btCollisionWorld::setBroadphase ( btBroadphaseInterface pairCache)
inline

Definition at line 117 of file btCollisionWorld.h.

virtual void btCollisionWorld::setDebugDrawer ( btIDebugDraw debugDrawer)
inlinevirtual

Definition at line 157 of file btCollisionWorld.h.

void btCollisionWorld::setForceUpdateAllAabbs ( bool  forceUpdateAllAabbs)
inline

Definition at line 515 of file btCollisionWorld.h.

void btCollisionWorld::updateAabbs ( )
virtual

Reimplemented in btSimpleDynamicsWorld.

Definition at line 190 of file btCollisionWorld.cpp.

void btCollisionWorld::updateSingleAabb ( btCollisionObject colObj)

Definition at line 147 of file btCollisionWorld.cpp.

Member Data Documentation

btBroadphaseInterface* btCollisionWorld::m_broadphasePairCache
protected

Definition at line 100 of file btCollisionWorld.h.

btAlignedObjectArray<btCollisionObject*> btCollisionWorld::m_collisionObjects
protected

Definition at line 94 of file btCollisionWorld.h.

btIDebugDraw* btCollisionWorld::m_debugDrawer
protected

Definition at line 102 of file btCollisionWorld.h.

btDispatcher* btCollisionWorld::m_dispatcher1
protected

Definition at line 96 of file btCollisionWorld.h.

btDispatcherInfo btCollisionWorld::m_dispatchInfo
protected

Definition at line 98 of file btCollisionWorld.h.

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: