Bullet Collision Detection & Physics Library: btCollisionWorld.h Source File

Bullet Collision Detection & Physics Library

btCollisionWorld.h
Go to the documentation of this file.
1 /*
2 Bullet Continuous Collision Detection and Physics Library
3 Copyright (c) 2003-2013 Erwin Coumans http://bulletphysics.org
4
5 This software is provided 'as-is', without any express or implied warranty.
6 In no event will the authors be held liable for any damages arising from the use of this software.
7 Permission is granted to anyone to use this software for any purpose,
8 including commercial applications, and to alter it and redistribute it freely,
9 subject to the following restrictions:
10
11 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
12 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
13 3. This notice may not be removed or altered from any source distribution.
14 */
15
69 #ifndef BT_COLLISION_WORLD_H
70 #define BT_COLLISION_WORLD_H
71
72 class btCollisionShape;
73 class btConvexShape;
74 class btBroadphaseInterface;
75 class btSerializer;
76
77 #include "LinearMath/btVector3.h"
78 #include "LinearMath/btTransform.h"
79 #include "btCollisionObject.h"
80 #include "btCollisionDispatcher.h"
81 #include "BulletCollision/BroadphaseCollision/btOverlappingPairCache.h"
82 #include "LinearMath/btAlignedObjectArray.h"
83
85 class btCollisionWorld
86 {
87 protected:
88 btAlignedObjectArray<btCollisionObject*> m_collisionObjects;
89
90 btDispatcher* m_dispatcher1;
91
92 btDispatcherInfo m_dispatchInfo;
93
94 btBroadphaseInterface* m_broadphasePairCache;
95
96 btIDebugDraw* m_debugDrawer;
97
100 bool m_forceUpdateAllAabbs;
101
102 void serializeCollisionObjects(btSerializer* serializer);
103
104 void serializeContactManifolds(btSerializer* serializer);
105
106 public:
107 //this constructor doesn't own the dispatcher and paircache/broadphase
108 btCollisionWorld(btDispatcher* dispatcher, btBroadphaseInterface* broadphasePairCache, btCollisionConfiguration* collisionConfiguration);
109
110 virtual ~btCollisionWorld();
111
112 void setBroadphase(btBroadphaseInterface* pairCache)
113 {
114 m_broadphasePairCache = pairCache;
115 }
116
117 const btBroadphaseInterface* getBroadphase() const
118 {
119 return m_broadphasePairCache;
120 }
121
122 btBroadphaseInterface* getBroadphase()
123 {
124 return m_broadphasePairCache;
125 }
126
127 btOverlappingPairCache* getPairCache()
128 {
129 return m_broadphasePairCache->getOverlappingPairCache();
130 }
131
132 btDispatcher* getDispatcher()
133 {
134 return m_dispatcher1;
135 }
136
137 const btDispatcher* getDispatcher() const
138 {
139 return m_dispatcher1;
140 }
141
142 void updateSingleAabb(btCollisionObject* colObj);
143
144 virtual void updateAabbs();
145
148 virtual void computeOverlappingPairs();
149
150 virtual void setDebugDrawer(btIDebugDraw* debugDrawer)
151 {
152 m_debugDrawer = debugDrawer;
153 }
154
155 virtual btIDebugDraw* getDebugDrawer()
156 {
157 return m_debugDrawer;
158 }
159
160 virtual void debugDrawWorld();
161
162 virtual void debugDrawObject(const btTransform& worldTransform, const btCollisionShape* shape, const btVector3& color);
163
166 struct LocalShapeInfo
167 {
168 int m_shapePart;
169 int m_triangleIndex;
170
171 //const btCollisionShape* m_shapeTemp;
172 //const btTransform* m_shapeLocalTransform;
173 };
174
175 struct LocalRayResult
176 {
177 LocalRayResult(const btCollisionObject* collisionObject,
178 LocalShapeInfo* localShapeInfo,
179 const btVector3& hitNormalLocal,
180 btScalar hitFraction)
181 : m_collisionObject(collisionObject),
182 m_localShapeInfo(localShapeInfo),
183 m_hitNormalLocal(hitNormalLocal),
184 m_hitFraction(hitFraction)
185 {
186 }
187
188 const btCollisionObject* m_collisionObject;
189 LocalShapeInfo* m_localShapeInfo;
190 btVector3 m_hitNormalLocal;
191 btScalar m_hitFraction;
192 };
193
195 struct RayResultCallback
196 {
197 btScalar m_closestHitFraction;
198 const btCollisionObject* m_collisionObject;
199 int m_collisionFilterGroup;
200 int m_collisionFilterMask;
201 //@BP Mod - Custom flags, currently used to enable backface culling on tri-meshes, see btRaycastCallback.h. Apply any of the EFlags defined there on m_flags here to invoke.
202 unsigned int m_flags;
203
204 virtual ~RayResultCallback()
205 {
206 }
207 bool hasHit() const
208 {
209 return (m_collisionObject != 0);
210 }
211
212 RayResultCallback()
213 : m_closestHitFraction(btScalar(1.)),
214 m_collisionObject(0),
215 m_collisionFilterGroup(btBroadphaseProxy::DefaultFilter),
216 m_collisionFilterMask(btBroadphaseProxy::AllFilter),
217 //@BP Mod
218 m_flags(0)
219 {
220 }
221
222 virtual bool needsCollision(btBroadphaseProxy* proxy0) const
223 {
224 bool collides = (proxy0->m_collisionFilterGroup & m_collisionFilterMask) != 0;
225 collides = collides && (m_collisionFilterGroup & proxy0->m_collisionFilterMask);
226 return collides;
227 }
228
229 virtual btScalar addSingleResult(LocalRayResult& rayResult, bool normalInWorldSpace) = 0;
230 };
231
232 struct ClosestRayResultCallback : public RayResultCallback
233 {
234 ClosestRayResultCallback(const btVector3& rayFromWorld, const btVector3& rayToWorld)
235 : m_rayFromWorld(rayFromWorld),
236 m_rayToWorld(rayToWorld)
237 {
238 }
239
240 btVector3 m_rayFromWorld; //used to calculate hitPointWorld from hitFraction
241 btVector3 m_rayToWorld;
242
243 btVector3 m_hitNormalWorld;
244 btVector3 m_hitPointWorld;
245
246 virtual btScalar addSingleResult(LocalRayResult& rayResult, bool normalInWorldSpace)
247 {
248 //caller already does the filter on the m_closestHitFraction
249 btAssert(rayResult.m_hitFraction <= m_closestHitFraction);
250
251 m_closestHitFraction = rayResult.m_hitFraction;
252 m_collisionObject = rayResult.m_collisionObject;
253 if (normalInWorldSpace)
254 {
255 m_hitNormalWorld = rayResult.m_hitNormalLocal;
256 }
257 else
258 {
260 m_hitNormalWorld = m_collisionObject->getWorldTransform().getBasis() * rayResult.m_hitNormalLocal;
261 }
262 m_hitPointWorld.setInterpolate3(m_rayFromWorld, m_rayToWorld, rayResult.m_hitFraction);
263 return rayResult.m_hitFraction;
264 }
265 };
266
267 struct AllHitsRayResultCallback : public RayResultCallback
268 {
269 AllHitsRayResultCallback(const btVector3& rayFromWorld, const btVector3& rayToWorld)
270 : m_rayFromWorld(rayFromWorld),
271 m_rayToWorld(rayToWorld)
272 {
273 }
274
275 btAlignedObjectArray<const btCollisionObject*> m_collisionObjects;
276
277 btVector3 m_rayFromWorld; //used to calculate hitPointWorld from hitFraction
278 btVector3 m_rayToWorld;
279
280 btAlignedObjectArray<btVector3> m_hitNormalWorld;
281 btAlignedObjectArray<btVector3> m_hitPointWorld;
282 btAlignedObjectArray<btScalar> m_hitFractions;
283
284 virtual btScalar addSingleResult(LocalRayResult& rayResult, bool normalInWorldSpace)
285 {
286 m_collisionObject = rayResult.m_collisionObject;
287 m_collisionObjects.push_back(rayResult.m_collisionObject);
288 btVector3 hitNormalWorld;
289 if (normalInWorldSpace)
290 {
291 hitNormalWorld = rayResult.m_hitNormalLocal;
292 }
293 else
294 {
296 hitNormalWorld = m_collisionObject->getWorldTransform().getBasis() * rayResult.m_hitNormalLocal;
297 }
298 m_hitNormalWorld.push_back(hitNormalWorld);
299 btVector3 hitPointWorld;
300 hitPointWorld.setInterpolate3(m_rayFromWorld, m_rayToWorld, rayResult.m_hitFraction);
301 m_hitPointWorld.push_back(hitPointWorld);
302 m_hitFractions.push_back(rayResult.m_hitFraction);
303 return m_closestHitFraction;
304 }
305 };
306
307 struct LocalConvexResult
308 {
309 LocalConvexResult(const btCollisionObject* hitCollisionObject,
310 LocalShapeInfo* localShapeInfo,
311 const btVector3& hitNormalLocal,
312 const btVector3& hitPointLocal,
313 btScalar hitFraction)
314 : m_hitCollisionObject(hitCollisionObject),
315 m_localShapeInfo(localShapeInfo),
316 m_hitNormalLocal(hitNormalLocal),
317 m_hitPointLocal(hitPointLocal),
318 m_hitFraction(hitFraction)
319 {
320 }
321
322 const btCollisionObject* m_hitCollisionObject;
323 LocalShapeInfo* m_localShapeInfo;
324 btVector3 m_hitNormalLocal;
325 btVector3 m_hitPointLocal;
326 btScalar m_hitFraction;
327 };
328
330 struct ConvexResultCallback
331 {
332 btScalar m_closestHitFraction;
333 int m_collisionFilterGroup;
334 int m_collisionFilterMask;
335
336 ConvexResultCallback()
337 : m_closestHitFraction(btScalar(1.)),
338 m_collisionFilterGroup(btBroadphaseProxy::DefaultFilter),
339 m_collisionFilterMask(btBroadphaseProxy::AllFilter)
340 {
341 }
342
343 virtual ~ConvexResultCallback()
344 {
345 }
346
347 bool hasHit() const
348 {
349 return (m_closestHitFraction < btScalar(1.));
350 }
351
352 virtual bool needsCollision(btBroadphaseProxy* proxy0) const
353 {
354 bool collides = (proxy0->m_collisionFilterGroup & m_collisionFilterMask) != 0;
355 collides = collides && (m_collisionFilterGroup & proxy0->m_collisionFilterMask);
356 return collides;
357 }
358
359 virtual btScalar addSingleResult(LocalConvexResult& convexResult, bool normalInWorldSpace) = 0;
360 };
361
362 struct ClosestConvexResultCallback : public ConvexResultCallback
363 {
364 ClosestConvexResultCallback(const btVector3& convexFromWorld, const btVector3& convexToWorld)
365 : m_convexFromWorld(convexFromWorld),
366 m_convexToWorld(convexToWorld),
367 m_hitCollisionObject(0)
368 {
369 }
370
371 btVector3 m_convexFromWorld; //used to calculate hitPointWorld from hitFraction
372 btVector3 m_convexToWorld;
373
374 btVector3 m_hitNormalWorld;
375 btVector3 m_hitPointWorld;
376 const btCollisionObject* m_hitCollisionObject;
377
378 virtual btScalar addSingleResult(LocalConvexResult& convexResult, bool normalInWorldSpace)
379 {
380 //caller already does the filter on the m_closestHitFraction
381 btAssert(convexResult.m_hitFraction <= m_closestHitFraction);
382
383 m_closestHitFraction = convexResult.m_hitFraction;
384 m_hitCollisionObject = convexResult.m_hitCollisionObject;
385 if (normalInWorldSpace)
386 {
387 m_hitNormalWorld = convexResult.m_hitNormalLocal;
388 }
389 else
390 {
392 m_hitNormalWorld = m_hitCollisionObject->getWorldTransform().getBasis() * convexResult.m_hitNormalLocal;
393 }
394 m_hitPointWorld = convexResult.m_hitPointLocal;
395 return convexResult.m_hitFraction;
396 }
397 };
398
400 struct ContactResultCallback
401 {
402 int m_collisionFilterGroup;
403 int m_collisionFilterMask;
404 btScalar m_closestDistanceThreshold;
405
406 ContactResultCallback()
407 : m_collisionFilterGroup(btBroadphaseProxy::DefaultFilter),
408 m_collisionFilterMask(btBroadphaseProxy::AllFilter),
409 m_closestDistanceThreshold(0)
410 {
411 }
412
413 virtual ~ContactResultCallback()
414 {
415 }
416
417 virtual bool needsCollision(btBroadphaseProxy* proxy0) const
418 {
419 bool collides = (proxy0->m_collisionFilterGroup & m_collisionFilterMask) != 0;
420 collides = collides && (m_collisionFilterGroup & proxy0->m_collisionFilterMask);
421 return collides;
422 }
423
424 virtual btScalar addSingleResult(btManifoldPoint& cp, const btCollisionObjectWrapper* colObj0Wrap, int partId0, int index0, const btCollisionObjectWrapper* colObj1Wrap, int partId1, int index1) = 0;
425 };
426
427 int getNumCollisionObjects() const
428 {
429 return int(m_collisionObjects.size());
430 }
431
434 virtual void rayTest(const btVector3& rayFromWorld, const btVector3& rayToWorld, RayResultCallback& resultCallback) const;
435
438 void convexSweepTest(const btConvexShape* castShape, const btTransform& from, const btTransform& to, ConvexResultCallback& resultCallback, btScalar allowedCcdPenetration = btScalar(0.)) const;
439
442 void contactTest(btCollisionObject* colObj, ContactResultCallback& resultCallback);
443
446 void contactPairTest(btCollisionObject* colObjA, btCollisionObject* colObjB, ContactResultCallback& resultCallback);
447
451 static void rayTestSingle(const btTransform& rayFromTrans, const btTransform& rayToTrans,
452 btCollisionObject* collisionObject,
453 const btCollisionShape* collisionShape,
454 const btTransform& colObjWorldTransform,
455 RayResultCallback& resultCallback);
456
457 static void rayTestSingleInternal(const btTransform& rayFromTrans, const btTransform& rayToTrans,
458 const btCollisionObjectWrapper* collisionObjectWrap,
459 RayResultCallback& resultCallback);
460
462 static void objectQuerySingle(const btConvexShape* castShape, const btTransform& rayFromTrans, const btTransform& rayToTrans,
463 btCollisionObject* collisionObject,
464 const btCollisionShape* collisionShape,
465 const btTransform& colObjWorldTransform,
466 ConvexResultCallback& resultCallback, btScalar allowedPenetration);
467
468 static void objectQuerySingleInternal(const btConvexShape* castShape, const btTransform& convexFromTrans, const btTransform& convexToTrans,
469 const btCollisionObjectWrapper* colObjWrap,
470 ConvexResultCallback& resultCallback, btScalar allowedPenetration);
471
472 virtual void addCollisionObject(btCollisionObject* collisionObject, int collisionFilterGroup = btBroadphaseProxy::DefaultFilter, int collisionFilterMask = btBroadphaseProxy::AllFilter);
473
474 virtual void refreshBroadphaseProxy(btCollisionObject* collisionObject);
475
476 btCollisionObjectArray& getCollisionObjectArray()
477 {
478 return m_collisionObjects;
479 }
480
481 const btCollisionObjectArray& getCollisionObjectArray() const
482 {
483 return m_collisionObjects;
484 }
485
486 virtual void removeCollisionObject(btCollisionObject* collisionObject);
487
488 virtual void performDiscreteCollisionDetection();
489
490 btDispatcherInfo& getDispatchInfo()
491 {
492 return m_dispatchInfo;
493 }
494
495 const btDispatcherInfo& getDispatchInfo() const
496 {
497 return m_dispatchInfo;
498 }
499
500 bool getForceUpdateAllAabbs() const
501 {
502 return m_forceUpdateAllAabbs;
503 }
504 void setForceUpdateAllAabbs(bool forceUpdateAllAabbs)
505 {
506 m_forceUpdateAllAabbs = forceUpdateAllAabbs;
507 }
508
510 virtual void serialize(btSerializer* serializer);
511 };
512
513 #endif //BT_COLLISION_WORLD_H
btCollisionWorld::updateSingleAabb
void updateSingleAabb(btCollisionObject *colObj)
Definition: btCollisionWorld.cpp:153
btCollisionWorld::m_debugDrawer
btIDebugDraw * m_debugDrawer
Definition: btCollisionWorld.h:96
btCollisionWorld::getBroadphase
btBroadphaseInterface * getBroadphase()
Definition: btCollisionWorld.h:122
btBroadphaseProxy::m_collisionFilterMask
int m_collisionFilterMask
Definition: btBroadphaseProxy.h:104
btCollisionWorld::LocalRayResult::LocalRayResult
LocalRayResult(const btCollisionObject *collisionObject, LocalShapeInfo *localShapeInfo, const btVector3 &hitNormalLocal, btScalar hitFraction)
Definition: btCollisionWorld.h:177
btCollisionWorld::setForceUpdateAllAabbs
void setForceUpdateAllAabbs(bool forceUpdateAllAabbs)
Definition: btCollisionWorld.h:504
btCollisionObject
btCollisionObject can be used to manage collision detection objects.
Definition: btCollisionObject.h:50
btCollisionWorld::computeOverlappingPairs
virtual void computeOverlappingPairs()
the computeOverlappingPairs is usually already called by performDiscreteCollisionDetection (or stepSi...
Definition: btCollisionWorld.cpp:215
btCollisionWorld::refreshBroadphaseProxy
virtual void refreshBroadphaseProxy(btCollisionObject *collisionObject)
Definition: btCollisionWorld.cpp:96
btBroadphaseProxy
The btBroadphaseProxy is the main class that can be used with the Bullet broadphases.
Definition: btBroadphaseProxy.h:86
btCollisionWorld::setDebugDrawer
virtual void setDebugDrawer(btIDebugDraw *debugDrawer)
Definition: btCollisionWorld.h:150
btCollisionWorld::ContactResultCallback::m_collisionFilterGroup
int m_collisionFilterGroup
Definition: btCollisionWorld.h:402
btCollisionWorld::getForceUpdateAllAabbs
bool getForceUpdateAllAabbs() const
Definition: btCollisionWorld.h:500
btCollisionWorld::ClosestConvexResultCallback::ClosestConvexResultCallback
ClosestConvexResultCallback(const btVector3 &convexFromWorld, const btVector3 &convexToWorld)
Definition: btCollisionWorld.h:364
btCollisionWorld::rayTestSingle
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.
Definition: btCollisionWorld.cpp:277
btCollisionWorld::getDebugDrawer
virtual btIDebugDraw * getDebugDrawer()
Definition: btCollisionWorld.h:155
btScalar
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition: btScalar.h:314
btBroadphaseProxy::DefaultFilter
@ DefaultFilter
Definition: btBroadphaseProxy.h:92
btCollisionObjectWrapper
Definition: btCollisionObjectWrapper.h:18
btDispatcher
The btDispatcher interface class can be used in combination with broadphase to dispatch calculations ...
Definition: btDispatcher.h:77
btCollisionWorld::debugDrawWorld
virtual void debugDrawWorld()
Definition: btCollisionWorld.cpp:1470
btCollisionWorld::LocalConvexResult
Definition: btCollisionWorld.h:308
btCollisionWorld::RayResultCallback::hasHit
bool hasHit() const
Definition: btCollisionWorld.h:207
btCollisionWorld::~btCollisionWorld
virtual ~btCollisionWorld()
Definition: btCollisionWorld.cpp:75
btCollisionWorld::m_collisionObjects
btAlignedObjectArray< btCollisionObject * > m_collisionObjects
Definition: btCollisionWorld.h:88
btCollisionWorld::AllHitsRayResultCallback::m_rayFromWorld
btVector3 m_rayFromWorld
Definition: btCollisionWorld.h:277
btCollisionWorld::RayResultCallback::m_collisionFilterGroup
int m_collisionFilterGroup
Definition: btCollisionWorld.h:199
btCollisionWorld::AllHitsRayResultCallback::AllHitsRayResultCallback
AllHitsRayResultCallback(const btVector3 &rayFromWorld, const btVector3 &rayToWorld)
Definition: btCollisionWorld.h:269
btCollisionWorld::convexSweepTest
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 resultC...
Definition: btCollisionWorld.cpp:1076
btCollisionWorld::m_broadphasePairCache
btBroadphaseInterface * m_broadphasePairCache
Definition: btCollisionWorld.h:94
btCollisionWorld::ClosestRayResultCallback::m_rayFromWorld
btVector3 m_rayFromWorld
Definition: btCollisionWorld.h:240
btCollisionWorld::serializeContactManifolds
void serializeContactManifolds(btSerializer *serializer)
Definition: btCollisionWorld.cpp:1598
btCollisionWorld::ConvexResultCallback::hasHit
bool hasHit() const
Definition: btCollisionWorld.h:347
btCollisionWorld::getCollisionObjectArray
const btCollisionObjectArray & getCollisionObjectArray() const
Definition: btCollisionWorld.h:481
btCollisionWorld::getBroadphase
const btBroadphaseInterface * getBroadphase() const
Definition: btCollisionWorld.h:117
btBroadphaseProxy::m_collisionFilterGroup
int m_collisionFilterGroup
Definition: btBroadphaseProxy.h:103
btVector3::setInterpolate3
void setInterpolate3(const btVector3 &v0, const btVector3 &v1, btScalar rt)
Definition: btVector3.h:492
btCollisionWorld::LocalShapeInfo::m_triangleIndex
int m_triangleIndex
Definition: btCollisionWorld.h:169
btCollisionWorld::performDiscreteCollisionDetection
virtual void performDiscreteCollisionDetection()
Definition: btCollisionWorld.cpp:221
btCollisionWorld::ConvexResultCallback::needsCollision
virtual bool needsCollision(btBroadphaseProxy *proxy0) const
Definition: btCollisionWorld.h:352
btCollisionWorld::ConvexResultCallback::m_collisionFilterGroup
int m_collisionFilterGroup
Definition: btCollisionWorld.h:333
btCollisionWorld::contactTest
void contactTest(btCollisionObject *colObj, ContactResultCallback &resultCallback)
contactTest performs a discrete collision test between colObj against all objects in the btCollisionW...
Definition: btCollisionWorld.cpp:1232
btCollisionWorld::LocalConvexResult::m_hitNormalLocal
btVector3 m_hitNormalLocal
Definition: btCollisionWorld.h:324
btCollisionObject::getWorldTransform
btTransform & getWorldTransform()
Definition: btCollisionObject.h:378
btCollisionWorld::RayResultCallback::~RayResultCallback
virtual ~RayResultCallback()
Definition: btCollisionWorld.h:204
btCollisionWorld::objectQuerySingle
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....
Definition: btCollisionWorld.cpp:602
btVector3.h
btCollisionShape
The btCollisionShape class provides an interface for collision shapes that can be shared among btColl...
Definition: btCollisionShape.h:28
btAssert
#define btAssert(x)
Definition: btScalar.h:153
btCollisionWorld::AllHitsRayResultCallback::m_hitPointWorld
btAlignedObjectArray< btVector3 > m_hitPointWorld
Definition: btCollisionWorld.h:281
btCollisionWorld::ClosestConvexResultCallback::m_hitPointWorld
btVector3 m_hitPointWorld
Definition: btCollisionWorld.h:375
btCollisionWorld::RayResultCallback::RayResultCallback
RayResultCallback()
Definition: btCollisionWorld.h:212
btCollisionWorld::RayResultCallback::m_closestHitFraction
btScalar m_closestHitFraction
Definition: btCollisionWorld.h:197
btIDebugDraw
The btIDebugDraw interface class allows hooking up a debug renderer to visually debug simulations.
Definition: btIDebugDraw.h:27
btManifoldPoint
ManifoldContactPoint collects and maintains persistent contactpoints.
Definition: btManifoldPoint.h:52
btCollisionWorld::LocalRayResult::m_collisionObject
const btCollisionObject * m_collisionObject
Definition: btCollisionWorld.h:188
btOverlappingPairCache.h
btCollisionWorld::LocalRayResult
Definition: btCollisionWorld.h:176
btCollisionWorld::LocalConvexResult::LocalConvexResult
LocalConvexResult(const btCollisionObject *hitCollisionObject, LocalShapeInfo *localShapeInfo, const btVector3 &hitNormalLocal, const btVector3 &hitPointLocal, btScalar hitFraction)
Definition: btCollisionWorld.h:309
btBroadphaseProxy::AllFilter
@ AllFilter
Definition: btBroadphaseProxy.h:98
btCollisionWorld::ClosestRayResultCallback
Definition: btCollisionWorld.h:233
btTransform::getBasis
btMatrix3x3 & getBasis()
Return the basis matrix for the rotation.
Definition: btTransform.h:108
btCollisionWorld::AllHitsRayResultCallback::m_hitNormalWorld
btAlignedObjectArray< btVector3 > m_hitNormalWorld
Definition: btCollisionWorld.h:280
btCollisionWorld::getPairCache
btOverlappingPairCache * getPairCache()
Definition: btCollisionWorld.h:127
btCollisionWorld::LocalConvexResult::m_hitCollisionObject
const btCollisionObject * m_hitCollisionObject
Definition: btCollisionWorld.h:322
btCollisionWorld::ContactResultCallback::m_collisionFilterMask
int m_collisionFilterMask
Definition: btCollisionWorld.h:403
btCollisionWorld::m_dispatchInfo
btDispatcherInfo m_dispatchInfo
Definition: btCollisionWorld.h:92
btCollisionWorld::ContactResultCallback::~ContactResultCallback
virtual ~ContactResultCallback()
Definition: btCollisionWorld.h:413
btCollisionWorld::LocalRayResult::m_hitFraction
btScalar m_hitFraction
Definition: btCollisionWorld.h:191
btCollisionWorld::LocalShapeInfo::m_shapePart
int m_shapePart
Definition: btCollisionWorld.h:168
btOverlappingPairCache
The btOverlappingPairCache provides an interface for overlapping pair management (add,...
Definition: btOverlappingPairCache.h:51
btCollisionWorld::ClosestConvexResultCallback::m_hitCollisionObject
const btCollisionObject * m_hitCollisionObject
Definition: btCollisionWorld.h:376
btCollisionWorld::getNumCollisionObjects
int getNumCollisionObjects() const
Definition: btCollisionWorld.h:427
btCollisionWorld::AllHitsRayResultCallback::m_rayToWorld
btVector3 m_rayToWorld
Definition: btCollisionWorld.h:278
btTransform.h
btTransform
The btTransform class supports rigid transforms with only translation and rotation and no scaling/she...
Definition: btTransform.h:30
btCollisionWorld::AllHitsRayResultCallback::addSingleResult
virtual btScalar addSingleResult(LocalRayResult &rayResult, bool normalInWorldSpace)
Definition: btCollisionWorld.h:284
btCollisionWorld::RayResultCallback::m_flags
unsigned int m_flags
Definition: btCollisionWorld.h:202
btCollisionWorld::RayResultCallback::m_collisionObject
const btCollisionObject * m_collisionObject
Definition: btCollisionWorld.h:198
btCollisionWorld::AllHitsRayResultCallback
Definition: btCollisionWorld.h:268
btVector3
btVector3 can be used to represent 3D points and vectors.
Definition: btVector3.h:82
btCollisionWorld::objectQuerySingleInternal
static void objectQuerySingleInternal(const btConvexShape *castShape, const btTransform &convexFromTrans, const btTransform &convexToTrans, const btCollisionObjectWrapper *colObjWrap, ConvexResultCallback &resultCallback, btScalar allowedPenetration)
Definition: btCollisionWorld.cpp:612
btCollisionWorld::ClosestRayResultCallback::ClosestRayResultCallback
ClosestRayResultCallback(const btVector3 &rayFromWorld, const btVector3 &rayToWorld)
Definition: btCollisionWorld.h:234
btCollisionWorld::setBroadphase
void setBroadphase(btBroadphaseInterface *pairCache)
Definition: btCollisionWorld.h:112
btCollisionWorld::LocalShapeInfo
LocalShapeInfo gives extra information for complex shapes Currently, only btTriangleMeshShape is avai...
Definition: btCollisionWorld.h:167
btCollisionWorld::AllHitsRayResultCallback::m_hitFractions
btAlignedObjectArray< btScalar > m_hitFractions
Definition: btCollisionWorld.h:282
btCollisionWorld::contactPairTest
void contactPairTest(btCollisionObject *colObjA, btCollisionObject *colObjB, ContactResultCallback &resultCallback)
contactTest performs a discrete collision test between two collision objects and calls the resultCall...
Definition: btCollisionWorld.cpp:1243
btCollisionWorld::ConvexResultCallback::m_collisionFilterMask
int m_collisionFilterMask
Definition: btCollisionWorld.h:334
btCollisionWorld::ContactResultCallback::needsCollision
virtual bool needsCollision(btBroadphaseProxy *proxy0) const
Definition: btCollisionWorld.h:417
btCollisionWorld::ContactResultCallback::addSingleResult
virtual btScalar addSingleResult(btManifoldPoint &cp, const btCollisionObjectWrapper *colObj0Wrap, int partId0, int index0, const btCollisionObjectWrapper *colObj1Wrap, int partId1, int index1)=0
btDispatcherInfo
Definition: btDispatcher.h:31
btAlignedObjectArray< btCollisionObject * >
btCollisionWorld::debugDrawObject
virtual void debugDrawObject(const btTransform &worldTransform, const btCollisionShape *shape, const btVector3 &color)
Definition: btCollisionWorld.cpp:1303
btConvexShape
The btConvexShape is an abstract shape interface, implemented by all convex shapes such as btBoxShape...
Definition: btConvexShape.h:33
btCollisionWorld::ClosestRayResultCallback::m_hitPointWorld
btVector3 m_hitPointWorld
Definition: btCollisionWorld.h:244
btCollisionWorld::RayResultCallback::needsCollision
virtual bool needsCollision(btBroadphaseProxy *proxy0) const
Definition: btCollisionWorld.h:222
btCollisionWorld::LocalConvexResult::m_hitFraction
btScalar m_hitFraction
Definition: btCollisionWorld.h:326
btCollisionWorld::getDispatcher
const btDispatcher * getDispatcher() const
Definition: btCollisionWorld.h:137
btCollisionWorld::ClosestConvexResultCallback::m_convexToWorld
btVector3 m_convexToWorld
Definition: btCollisionWorld.h:372
btSerializer
Definition: btSerializer.h:66
btCollisionWorld::LocalRayResult::m_localShapeInfo
LocalShapeInfo * m_localShapeInfo
Definition: btCollisionWorld.h:189
btCollisionWorld::removeCollisionObject
virtual void removeCollisionObject(btCollisionObject *collisionObject)
Definition: btCollisionWorld.cpp:239
btCollisionWorld::m_dispatcher1
btDispatcher * m_dispatcher1
Definition: btCollisionWorld.h:90
btCollisionWorld::ConvexResultCallback::~ConvexResultCallback
virtual ~ConvexResultCallback()
Definition: btCollisionWorld.h:343
btBroadphaseInterface
The btBroadphaseInterface class provides an interface to detect aabb-overlapping object pairs.
Definition: btBroadphaseInterface.h:50
btCollisionWorld::LocalConvexResult::m_localShapeInfo
LocalShapeInfo * m_localShapeInfo
Definition: btCollisionWorld.h:323
btCollisionWorld::rayTestSingleInternal
static void rayTestSingleInternal(const btTransform &rayFromTrans, const btTransform &rayToTrans, const btCollisionObjectWrapper *collisionObjectWrap, RayResultCallback &resultCallback)
Definition: btCollisionWorld.cpp:287
btCollisionWorld::LocalRayResult::m_hitNormalLocal
btVector3 m_hitNormalLocal
Definition: btCollisionWorld.h:190
btCollisionWorld::updateAabbs
virtual void updateAabbs()
Definition: btCollisionWorld.cpp:197
btCollisionWorld::ConvexResultCallback::addSingleResult
virtual btScalar addSingleResult(LocalConvexResult &convexResult, bool normalInWorldSpace)=0
btCollisionWorld::RayResultCallback::addSingleResult
virtual btScalar addSingleResult(LocalRayResult &rayResult, bool normalInWorldSpace)=0
btCollisionWorld::getDispatchInfo
const btDispatcherInfo & getDispatchInfo() const
Definition: btCollisionWorld.h:495
btCollisionWorld::ContactResultCallback::ContactResultCallback
ContactResultCallback()
Definition: btCollisionWorld.h:406
btCollisionObject.h
btCollisionWorld::ConvexResultCallback::m_closestHitFraction
btScalar m_closestHitFraction
Definition: btCollisionWorld.h:332
btCollisionWorld::ConvexResultCallback::ConvexResultCallback
ConvexResultCallback()
Definition: btCollisionWorld.h:336
btCollisionWorld
CollisionWorld is interface and container for the collision detection.
Definition: btCollisionWorld.h:86
btCollisionWorld::ClosestConvexResultCallback::addSingleResult
virtual btScalar addSingleResult(LocalConvexResult &convexResult, bool normalInWorldSpace)
Definition: btCollisionWorld.h:378
btCollisionWorld::ClosestRayResultCallback::m_hitNormalWorld
btVector3 m_hitNormalWorld
Definition: btCollisionWorld.h:243
btAlignedObjectArray.h
btCollisionWorld::getDispatcher
btDispatcher * getDispatcher()
Definition: btCollisionWorld.h:132
btCollisionWorld::ContactResultCallback
ContactResultCallback is used to report contact points.
Definition: btCollisionWorld.h:401
btBroadphaseInterface::getOverlappingPairCache
virtual btOverlappingPairCache * getOverlappingPairCache()=0
btCollisionWorld::serializeCollisionObjects
void serializeCollisionObjects(btSerializer *serializer)
Definition: btCollisionWorld.cpp:1568
btCollisionWorld::getCollisionObjectArray
btCollisionObjectArray & getCollisionObjectArray()
Definition: btCollisionWorld.h:476
btCollisionWorld::AllHitsRayResultCallback::m_collisionObjects
btAlignedObjectArray< const btCollisionObject * > m_collisionObjects
Definition: btCollisionWorld.h:275
btCollisionWorld::addCollisionObject
virtual void addCollisionObject(btCollisionObject *collisionObject, int collisionFilterGroup=btBroadphaseProxy::DefaultFilter, int collisionFilterMask=btBroadphaseProxy::AllFilter)
Definition: btCollisionWorld.cpp:124
btCollisionWorld::RayResultCallback
RayResultCallback is used to report new raycast results.
Definition: btCollisionWorld.h:196
btCollisionWorld::m_forceUpdateAllAabbs
bool m_forceUpdateAllAabbs
m_forceUpdateAllAabbs can be set to false as an optimization to only update active object AABBs it is...
Definition: btCollisionWorld.h:100
btCollisionWorld::LocalConvexResult::m_hitPointLocal
btVector3 m_hitPointLocal
Definition: btCollisionWorld.h:325
btAlignedObjectArray::push_back
void push_back(const T &_Val)
Definition: btAlignedObjectArray.h:257
btCollisionWorld::ClosestConvexResultCallback
Definition: btCollisionWorld.h:363
btCollisionWorld::ClosestRayResultCallback::addSingleResult
virtual btScalar addSingleResult(LocalRayResult &rayResult, bool normalInWorldSpace)
Definition: btCollisionWorld.h:246
btCollisionConfiguration
btCollisionConfiguration allows to configure Bullet collision detection stack allocator size,...
Definition: btCollisionConfiguration.h:27
btCollisionWorld::ConvexResultCallback
RayResultCallback is used to report new raycast results.
Definition: btCollisionWorld.h:331
btCollisionWorld::ClosestConvexResultCallback::m_hitNormalWorld
btVector3 m_hitNormalWorld
Definition: btCollisionWorld.h:374
btCollisionWorld::getDispatchInfo
btDispatcherInfo & getDispatchInfo()
Definition: btCollisionWorld.h:490
btCollisionWorld::RayResultCallback::m_collisionFilterMask
int m_collisionFilterMask
Definition: btCollisionWorld.h:200
btCollisionDispatcher.h
btCollisionWorld::rayTest
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 ...
Definition: btCollisionWorld.cpp:1004
btAlignedObjectArray::size
int size() const
return the number of elements in the array
Definition: btAlignedObjectArray.h:142
btCollisionWorld::ClosestRayResultCallback::m_rayToWorld
btVector3 m_rayToWorld
Definition: btCollisionWorld.h:241
btCollisionWorld::btCollisionWorld
btCollisionWorld(btDispatcher *dispatcher, btBroadphaseInterface *broadphasePairCache, btCollisionConfiguration *collisionConfiguration)
for debug drawing
Definition: btCollisionWorld.cpp:67
btCollisionWorld::ContactResultCallback::m_closestDistanceThreshold
btScalar m_closestDistanceThreshold
Definition: btCollisionWorld.h:404
btCollisionWorld::ClosestConvexResultCallback::m_convexFromWorld
btVector3 m_convexFromWorld
Definition: btCollisionWorld.h:371
btCollisionWorld::serialize
virtual void serialize(btSerializer *serializer)
Preliminary serialization test for Bullet 2.76. Loading those files requires a separate parser (Bulle...
Definition: btCollisionWorld.cpp:1618