Bullet Collision Detection & Physics Library: btDynamicsWorld Class Reference

Bullet Collision Detection & Physics Library

Public Member Functions | Protected Attributes | List of all members
btDynamicsWorld Class Referenceabstract

The btDynamicsWorld is the interface class for several dynamics implementation, basic, discrete, parallel, and continuous etc. More...

`#include <btDynamicsWorld.h>`

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

## Public Member Functions
| btDynamicsWorld (btDispatcher *dispatcher, btBroadphaseInterface *broadphase, btCollisionConfiguration *collisionConfiguration)
virtual | ~btDynamicsWorld ()
virtual int | stepSimulation (btScalar timeStep, int maxSubSteps=1, btScalar fixedTimeStep=btScalar(1.)/btScalar(60.))=0
| stepSimulation proceeds the simulation over 'timeStep', units in preferably in seconds. More...
virtual void | debugDrawWorld ()=0
virtual void | addConstraint (btTypedConstraint *constraint, bool disableCollisionsBetweenLinkedBodies=false)
virtual void | removeConstraint (btTypedConstraint *constraint)
virtual void | addAction (btActionInterface *action)=0
virtual void | removeAction (btActionInterface *action)=0
virtual void | setGravity (const btVector3 &gravity)=0
virtual btVector3 | getGravity () const =0
virtual void | synchronizeMotionStates ()=0
virtual void | addRigidBody (btRigidBody *body)=0
virtual void | addRigidBody (btRigidBody *body, int group, int mask)=0
virtual void | removeRigidBody (btRigidBody *body)=0
virtual void | setConstraintSolver (btConstraintSolver *solver)=0
virtual btConstraintSolver * | getConstraintSolver ()=0
virtual int | getNumConstraints () const
virtual btTypedConstraint * | getConstraint (int index)
virtual const btTypedConstraint * | getConstraint (int index) const
virtual btDynamicsWorldType | getWorldType () const =0
virtual void | clearForces ()=0
void | setInternalTickCallback (btInternalTickCallback cb, void *worldUserInfo=0, bool isPreTick=false)
| Set the callback for when an internal tick (simulation substep) happens, optional user info. More...
void | setWorldUserInfo (void *worldUserInfo)
void * | getWorldUserInfo () const
btContactSolverInfo & | getSolverInfo ()
virtual void | addVehicle (btActionInterface *vehicle)
| obsolete, use addAction instead. More...
virtual void | removeVehicle (btActionInterface *vehicle)
| obsolete, use removeAction instead More...
virtual void | addCharacter (btActionInterface *character)
| obsolete, use addAction instead. More...
virtual void | removeCharacter (btActionInterface *character)
| obsolete, use removeAction instead More...
Public Member Functions inherited from btCollisionWorld
| 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 | 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, int collisionFilterGroup=btBroadphaseProxy::DefaultFilter, 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...

## Protected Attributes
btInternalTickCallback | m_internalTickCallback
btInternalTickCallback | m_internalPreTickCallback
void * | m_worldUserInfo
btContactSolverInfo | m_solverInfo
Protected Attributes inherited from btCollisionWorld
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...

## Additional Inherited Members
Static Public Member Functions inherited from btCollisionWorld
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 inherited from btCollisionWorld
void | serializeCollisionObjects (btSerializer *serializer)

## Detailed Description

The btDynamicsWorld is the interface class for several dynamics implementation, basic, discrete, parallel, and continuous etc.

Definition at line 42 of file btDynamicsWorld.h.

## Constructor & Destructor Documentation

## § btDynamicsWorld()

btDynamicsWorld::btDynamicsWorld | ( | btDispatcher * | dispatcher,
|  | btBroadphaseInterface * | broadphase,
|  | btCollisionConfiguration * | collisionConfiguration
| ) |  |
| inline

Definition at line 55 of file btDynamicsWorld.h.

## § ~btDynamicsWorld()

virtual btDynamicsWorld::~btDynamicsWorld | ( |  | ) |
| inlinevirtual

Definition at line 60 of file btDynamicsWorld.h.

## Member Function Documentation

## § addAction()

virtual void btDynamicsWorld::addAction | ( | btActionInterface * | action | ) |
| pure virtual

Implemented in btDiscreteDynamicsWorld, and btSimpleDynamicsWorld.

## § addCharacter()

virtual void btDynamicsWorld::addCharacter | ( | btActionInterface * | character | ) |
| inlinevirtual

obsolete, use addAction instead.

Reimplemented in btDiscreteDynamicsWorld.

Definition at line 144 of file btDynamicsWorld.h.

## § addConstraint()

virtual void btDynamicsWorld::addConstraint | ( | btTypedConstraint * | constraint,
|  | bool | disableCollisionsBetweenLinkedBodies = `false`
| ) |  |
| inlinevirtual

Reimplemented in btDiscreteDynamicsWorld.

Definition at line 72 of file btDynamicsWorld.h.

## § addRigidBody() [1/2]

virtual void btDynamicsWorld::addRigidBody | ( | btRigidBody * | body | ) |
| pure virtual

Implemented in btDiscreteDynamicsWorld, and btSimpleDynamicsWorld.

## § addRigidBody() [2/2]

virtual void btDynamicsWorld::addRigidBody | ( | btRigidBody * | body,
|  | int | group,
|  | int | mask
| ) |  |
| pure virtual

Implemented in btDiscreteDynamicsWorld, and btSimpleDynamicsWorld.

## § addVehicle()

virtual void btDynamicsWorld::addVehicle | ( | btActionInterface * | vehicle | ) |
| inlinevirtual

obsolete, use addAction instead.

Reimplemented in btDiscreteDynamicsWorld.

Definition at line 140 of file btDynamicsWorld.h.

## § clearForces()

virtual void btDynamicsWorld::clearForces | ( |  | ) |
| pure virtual

Implemented in btDiscreteDynamicsWorld, btMultiBodyDynamicsWorld, and btSimpleDynamicsWorld.

## § debugDrawWorld()

virtual void btDynamicsWorld::debugDrawWorld | ( |  | ) |
| pure virtual

Reimplemented from btCollisionWorld.

Implemented in btDiscreteDynamicsWorld, btMultiBodyDynamicsWorld, btSimpleDynamicsWorld, btSoftMultiBodyDynamicsWorld, and btSoftRigidDynamicsWorld.

## § getConstraint() [1/2]

virtual btTypedConstraint* btDynamicsWorld::getConstraint | ( | int | index | ) |
| inlinevirtual

Reimplemented in btDiscreteDynamicsWorld.

Definition at line 102 of file btDynamicsWorld.h.

## § getConstraint() [2/2]

virtual const btTypedConstraint* btDynamicsWorld::getConstraint | ( | int | index | ) | const
| inlinevirtual

Reimplemented in btDiscreteDynamicsWorld.

Definition at line 104 of file btDynamicsWorld.h.

## § getConstraintSolver()

virtual btConstraintSolver* btDynamicsWorld::getConstraintSolver | ( |  | ) |
| pure virtual

Implemented in btDiscreteDynamicsWorld, and btSimpleDynamicsWorld.

## § getGravity()

virtual btVector3 btDynamicsWorld::getGravity | ( |  | ) | const
| pure virtual

Implemented in btDiscreteDynamicsWorld, and btSimpleDynamicsWorld.

## § getNumConstraints()

virtual int btDynamicsWorld::getNumConstraints | ( |  | ) | const
| inlinevirtual

Reimplemented in btDiscreteDynamicsWorld.

Definition at line 100 of file btDynamicsWorld.h.

## § getSolverInfo()

btContactSolverInfo& btDynamicsWorld::getSolverInfo | ( |  | ) |
| inline

Definition at line 133 of file btDynamicsWorld.h.

## § getWorldType()

virtual btDynamicsWorldType btDynamicsWorld::getWorldType | ( |  | ) | const
| pure virtual

Implemented in btDiscreteDynamicsWorld, btSimpleDynamicsWorld, btSoftMultiBodyDynamicsWorld, and btSoftRigidDynamicsWorld.

## § getWorldUserInfo()

void* btDynamicsWorld::getWorldUserInfo | ( |  | ) | const
| inline

Definition at line 128 of file btDynamicsWorld.h.

## § removeAction()

virtual void btDynamicsWorld::removeAction | ( | btActionInterface * | action | ) |
| pure virtual

Implemented in btDiscreteDynamicsWorld, and btSimpleDynamicsWorld.

## § removeCharacter()

virtual void btDynamicsWorld::removeCharacter | ( | btActionInterface * | character | ) |
| inlinevirtual

obsolete, use removeAction instead

Reimplemented in btDiscreteDynamicsWorld.

Definition at line 146 of file btDynamicsWorld.h.

## § removeConstraint()

virtual void btDynamicsWorld::removeConstraint | ( | btTypedConstraint * | constraint | ) |
| inlinevirtual

Reimplemented in btDiscreteDynamicsWorld.

Definition at line 77 of file btDynamicsWorld.h.

## § removeRigidBody()

virtual void btDynamicsWorld::removeRigidBody | ( | btRigidBody * | body | ) |
| pure virtual

Implemented in btDiscreteDynamicsWorld, and btSimpleDynamicsWorld.

## § removeVehicle()

virtual void btDynamicsWorld::removeVehicle | ( | btActionInterface * | vehicle | ) |
| inlinevirtual

obsolete, use removeAction instead

Reimplemented in btDiscreteDynamicsWorld.

Definition at line 142 of file btDynamicsWorld.h.

## § setConstraintSolver()

virtual void btDynamicsWorld::setConstraintSolver | ( | btConstraintSolver * | solver | ) |
| pure virtual

Implemented in btDiscreteDynamicsWorld, and btSimpleDynamicsWorld.

## § setGravity()

virtual void btDynamicsWorld::setGravity | ( | const btVector3 & | gravity | ) |
| pure virtual

Implemented in btDiscreteDynamicsWorld, and btSimpleDynamicsWorld.

## § setInternalTickCallback()

void btDynamicsWorld::setInternalTickCallback | ( | btInternalTickCallback | cb,
|  | void * | worldUserInfo = `0`,
|  | bool | isPreTick = `false`
| ) |  |
| inline

Set the callback for when an internal tick (simulation substep) happens, optional user info.

Definition at line 111 of file btDynamicsWorld.h.

## § setWorldUserInfo()

void btDynamicsWorld::setWorldUserInfo | ( | void * | worldUserInfo | ) |
| inline

Definition at line 123 of file btDynamicsWorld.h.

## § stepSimulation()

virtual int btDynamicsWorld::stepSimulation | ( | btScalar | timeStep,
|  | int | maxSubSteps = `1`,
|  | btScalar | fixedTimeStep = `btScalar(1.)/btScalar(60.)`
| ) |  |
| pure virtual

stepSimulation proceeds the simulation over 'timeStep', units in preferably in seconds.

By default, Bullet will subdivide the timestep in constant substeps of each 'fixedTimeStep'. in order to keep the simulation real-time, the maximum number of substeps can be clamped to 'maxSubSteps'. You can disable subdividing the timestep/substepping by passing maxSubSteps=0 as second argument to stepSimulation, but in that case you have to keep the timeStep constant.

Implemented in btDiscreteDynamicsWorld, and btSimpleDynamicsWorld.

## § synchronizeMotionStates()

virtual void btDynamicsWorld::synchronizeMotionStates | ( |  | ) |
| pure virtual

Implemented in btDiscreteDynamicsWorld, and btSimpleDynamicsWorld.

## Member Data Documentation

## § m_internalPreTickCallback

btInternalTickCallback btDynamicsWorld::m_internalPreTickCallback
| protected

Definition at line 47 of file btDynamicsWorld.h.

## § m_internalTickCallback

btInternalTickCallback btDynamicsWorld::m_internalTickCallback
| protected

Definition at line 46 of file btDynamicsWorld.h.

## § m_solverInfo

btContactSolverInfo btDynamicsWorld::m_solverInfo
| protected

Definition at line 50 of file btDynamicsWorld.h.

## § m_worldUserInfo

void* btDynamicsWorld::m_worldUserInfo
| protected

Definition at line 48 of file btDynamicsWorld.h.

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

- btDynamicsWorld.h