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
16
72 #ifndef BT_COLLISION_WORLD_H
73 #define BT_COLLISION_WORLD_H
74
75 class btCollisionShape;
76 class btConvexShape;
77 class btBroadphaseInterface;
78 class btSerializer;
79
80 #include "LinearMath/btVector3.h"
81 #include "LinearMath/btTransform.h"
82 #include "btCollisionObject.h"
83 #include "btCollisionDispatcher.h"
84 #include "BulletCollision/BroadphaseCollision/btOverlappingPairCache.h"
85 #include "LinearMath/btAlignedObjectArray.h"
86
88 class btCollisionWorld
89 {
90
91
92 protected:
93
94 btAlignedObjectArray<btCollisionObject*> m_collisionObjects;
95
96 btDispatcher* m_dispatcher1;
97
98 btDispatcherInfo m_dispatchInfo;
99
100 btBroadphaseInterface* m_broadphasePairCache;
101
102 btIDebugDraw* m_debugDrawer;
103
106 bool m_forceUpdateAllAabbs;
107
108 void serializeCollisionObjects(btSerializer* serializer);
109
110 public:
111
112 //this constructor doesn't own the dispatcher and paircache/broadphase
113 btCollisionWorld(btDispatcher* dispatcher,btBroadphaseInterface* broadphasePairCache, btCollisionConfiguration* collisionConfiguration);
114
115 virtual ~btCollisionWorld();
116
117 void setBroadphase(btBroadphaseInterface* pairCache)
118 {
119 m_broadphasePairCache = pairCache;
120 }
121
122 const btBroadphaseInterface* getBroadphase() const
123 {
124 return m_broadphasePairCache;
125 }
126
127 btBroadphaseInterface* getBroadphase()
128 {
129 return m_broadphasePairCache;
130 }
131
132 btOverlappingPairCache* getPairCache()
133 {
134 return m_broadphasePairCache->getOverlappingPairCache();
135 }
136
137
138 btDispatcher* getDispatcher()
139 {
140 return m_dispatcher1;
141 }
142
143 const btDispatcher* getDispatcher() const
144 {
145 return m_dispatcher1;
146 }
147
148 void updateSingleAabb(btCollisionObject* colObj);
149
150 virtual void updateAabbs();
151
154 virtual void computeOverlappingPairs();
155
156
157 virtual void setDebugDrawer(btIDebugDraw* debugDrawer)
158 {
159 m_debugDrawer = debugDrawer;
160 }
161
162 virtual btIDebugDraw* getDebugDrawer()
163 {
164 return m_debugDrawer;
165 }
166
167 virtual void debugDrawWorld();
168
169 virtual void debugDrawObject(const btTransform& worldTransform, const btCollisionShape* shape, const btVector3& color);
170
171
174 struct LocalShapeInfo
175 {
176 int m_shapePart;
177 int m_triangleIndex;
178
179 //const btCollisionShape* m_shapeTemp;
180 //const btTransform* m_shapeLocalTransform;
181 };
182
183 struct LocalRayResult
184 {
185 LocalRayResult(const btCollisionObject* collisionObject,
186 LocalShapeInfo* localShapeInfo,
187 const btVector3& hitNormalLocal,
188 btScalar hitFraction)
189 :m_collisionObject(collisionObject),
190 m_localShapeInfo(localShapeInfo),
191 m_hitNormalLocal(hitNormalLocal),
192 m_hitFraction(hitFraction)
193 {
194 }
195
196 const btCollisionObject* m_collisionObject;
197 LocalShapeInfo* m_localShapeInfo;
198 btVector3 m_hitNormalLocal;
199 btScalar m_hitFraction;
200
201 };
202
204 struct RayResultCallback
205 {
206 btScalar m_closestHitFraction;
207 const btCollisionObject* m_collisionObject;
208 int m_collisionFilterGroup;
209 int m_collisionFilterMask;
210 //@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.
211 unsigned int m_flags;
212
213 virtual ~RayResultCallback()
214 {
215 }
216 bool hasHit() const
217 {
218 return (m_collisionObject != 0);
219 }
220
221 RayResultCallback()
222 :m_closestHitFraction(btScalar(1.)),
223 m_collisionObject(0),
224 m_collisionFilterGroup(btBroadphaseProxy::DefaultFilter),
225 m_collisionFilterMask(btBroadphaseProxy::AllFilter),
226 //@BP Mod
227 m_flags(0)
228 {
229 }
230
231 virtual bool needsCollision(btBroadphaseProxy* proxy0) const
232 {
233 bool collides = (proxy0->m_collisionFilterGroup & m_collisionFilterMask) != 0;
234 collides = collides && (m_collisionFilterGroup & proxy0->m_collisionFilterMask);
235 return collides;
236 }
237
238
239 virtual btScalar addSingleResult(LocalRayResult& rayResult,bool normalInWorldSpace) = 0;
240 };
241
242 struct ClosestRayResultCallback : public RayResultCallback
243 {
244 ClosestRayResultCallback(const btVector3& rayFromWorld,const btVector3& rayToWorld)
245 :m_rayFromWorld(rayFromWorld),
246 m_rayToWorld(rayToWorld)
247 {
248 }
249
250 btVector3 m_rayFromWorld;//used to calculate hitPointWorld from hitFraction
251 btVector3 m_rayToWorld;
252
253 btVector3 m_hitNormalWorld;
254 btVector3 m_hitPointWorld;
255
256 virtual btScalar addSingleResult(LocalRayResult& rayResult,bool normalInWorldSpace)
257 {
258 //caller already does the filter on the m_closestHitFraction
259 btAssert(rayResult.m_hitFraction <= m_closestHitFraction);
260
261 m_closestHitFraction = rayResult.m_hitFraction;
262 m_collisionObject = rayResult.m_collisionObject;
263 if (normalInWorldSpace)
264 {
265 m_hitNormalWorld = rayResult.m_hitNormalLocal;
266 } else
267 {
269 m_hitNormalWorld = m_collisionObject->getWorldTransform().getBasis()*rayResult.m_hitNormalLocal;
270 }
271 m_hitPointWorld.setInterpolate3(m_rayFromWorld,m_rayToWorld,rayResult.m_hitFraction);
272 return rayResult.m_hitFraction;
273 }
274 };
275
276 struct AllHitsRayResultCallback : public RayResultCallback
277 {
278 AllHitsRayResultCallback(const btVector3& rayFromWorld,const btVector3& rayToWorld)
279 :m_rayFromWorld(rayFromWorld),
280 m_rayToWorld(rayToWorld)
281 {
282 }
283
284 btAlignedObjectArray<const btCollisionObject*> m_collisionObjects;
285
286 btVector3 m_rayFromWorld;//used to calculate hitPointWorld from hitFraction
287 btVector3 m_rayToWorld;
288
289 btAlignedObjectArray<btVector3> m_hitNormalWorld;
290 btAlignedObjectArray<btVector3> m_hitPointWorld;
291 btAlignedObjectArray<btScalar> m_hitFractions;
292
293 virtual btScalar addSingleResult(LocalRayResult& rayResult,bool normalInWorldSpace)
294 {
295 m_collisionObject = rayResult.m_collisionObject;
296 m_collisionObjects.push_back(rayResult.m_collisionObject);
297 btVector3 hitNormalWorld;
298 if (normalInWorldSpace)
299 {
300 hitNormalWorld = rayResult.m_hitNormalLocal;
301 } else
302 {
304 hitNormalWorld = m_collisionObject->getWorldTransform().getBasis()*rayResult.m_hitNormalLocal;
305 }
306 m_hitNormalWorld.push_back(hitNormalWorld);
307 btVector3 hitPointWorld;
308 hitPointWorld.setInterpolate3(m_rayFromWorld,m_rayToWorld,rayResult.m_hitFraction);
309 m_hitPointWorld.push_back(hitPointWorld);
310 m_hitFractions.push_back(rayResult.m_hitFraction);
311 return m_closestHitFraction;
312 }
313 };
314
315
316 struct LocalConvexResult
317 {
318 LocalConvexResult(const btCollisionObject* hitCollisionObject,
319 LocalShapeInfo* localShapeInfo,
320 const btVector3& hitNormalLocal,
321 const btVector3& hitPointLocal,
322 btScalar hitFraction
323 )
324 :m_hitCollisionObject(hitCollisionObject),
325 m_localShapeInfo(localShapeInfo),
326 m_hitNormalLocal(hitNormalLocal),
327 m_hitPointLocal(hitPointLocal),
328 m_hitFraction(hitFraction)
329 {
330 }
331
332 const btCollisionObject* m_hitCollisionObject;
333 LocalShapeInfo* m_localShapeInfo;
334 btVector3 m_hitNormalLocal;
335 btVector3 m_hitPointLocal;
336 btScalar m_hitFraction;
337 };
338
340 struct ConvexResultCallback
341 {
342 btScalar m_closestHitFraction;
343 int m_collisionFilterGroup;
344 int m_collisionFilterMask;
345
346 ConvexResultCallback()
347 :m_closestHitFraction(btScalar(1.)),
348 m_collisionFilterGroup(btBroadphaseProxy::DefaultFilter),
349 m_collisionFilterMask(btBroadphaseProxy::AllFilter)
350 {
351 }
352
353 virtual ~ConvexResultCallback()
354 {
355 }
356
357 bool hasHit() const
358 {
359 return (m_closestHitFraction < btScalar(1.));
360 }
361
362
363
364 virtual bool needsCollision(btBroadphaseProxy* proxy0) const
365 {
366 bool collides = (proxy0->m_collisionFilterGroup & m_collisionFilterMask) != 0;
367 collides = collides && (m_collisionFilterGroup & proxy0->m_collisionFilterMask);
368 return collides;
369 }
370
371 virtual btScalar addSingleResult(LocalConvexResult& convexResult,bool normalInWorldSpace) = 0;
372 };
373
374 struct ClosestConvexResultCallback : public ConvexResultCallback
375 {
376 ClosestConvexResultCallback(const btVector3& convexFromWorld,const btVector3& convexToWorld)
377 :m_convexFromWorld(convexFromWorld),
378 m_convexToWorld(convexToWorld),
379 m_hitCollisionObject(0)
380 {
381 }
382
383 btVector3 m_convexFromWorld;//used to calculate hitPointWorld from hitFraction
384 btVector3 m_convexToWorld;
385
386 btVector3 m_hitNormalWorld;
387 btVector3 m_hitPointWorld;
388 const btCollisionObject* m_hitCollisionObject;
389
390 virtual btScalar addSingleResult(LocalConvexResult& convexResult,bool normalInWorldSpace)
391 {
392 //caller already does the filter on the m_closestHitFraction
393 btAssert(convexResult.m_hitFraction <= m_closestHitFraction);
394
395 m_closestHitFraction = convexResult.m_hitFraction;
396 m_hitCollisionObject = convexResult.m_hitCollisionObject;
397 if (normalInWorldSpace)
398 {
399 m_hitNormalWorld = convexResult.m_hitNormalLocal;
400 } else
401 {
403 m_hitNormalWorld = m_hitCollisionObject->getWorldTransform().getBasis()*convexResult.m_hitNormalLocal;
404 }
405 m_hitPointWorld = convexResult.m_hitPointLocal;
406 return convexResult.m_hitFraction;
407 }
408 };
409
411 struct ContactResultCallback
412 {
413 int m_collisionFilterGroup;
414 int m_collisionFilterMask;
415 btScalar m_closestDistanceThreshold;
416
417 ContactResultCallback()
418 :m_collisionFilterGroup(btBroadphaseProxy::DefaultFilter),
419 m_collisionFilterMask(btBroadphaseProxy::AllFilter),
420 m_closestDistanceThreshold(0)
421 {
422 }
423
424 virtual ~ContactResultCallback()
425 {
426 }
427
428 virtual bool needsCollision(btBroadphaseProxy* proxy0) const
429 {
430 bool collides = (proxy0->m_collisionFilterGroup & m_collisionFilterMask) != 0;
431 collides = collides && (m_collisionFilterGroup & proxy0->m_collisionFilterMask);
432 return collides;
433 }
434
435 virtual btScalar addSingleResult(btManifoldPoint& cp, const btCollisionObjectWrapper* colObj0Wrap,int partId0,int index0,const btCollisionObjectWrapper* colObj1Wrap,int partId1,int index1) = 0;
436 };
437
438
439
440 int getNumCollisionObjects() const
441 {
442 return int(m_collisionObjects.size());
443 }
444
447 virtual void rayTest(const btVector3& rayFromWorld, const btVector3& rayToWorld, RayResultCallback& resultCallback) const;
448
451 void convexSweepTest (const btConvexShape* castShape, const btTransform& from, const btTransform& to, ConvexResultCallback& resultCallback, btScalar allowedCcdPenetration = btScalar(0.)) const;
452
455 void contactTest(btCollisionObject* colObj, ContactResultCallback& resultCallback);
456
459 void contactPairTest(btCollisionObject* colObjA, btCollisionObject* colObjB, ContactResultCallback& resultCallback);
460
461
465 static void rayTestSingle(const btTransform& rayFromTrans,const btTransform& rayToTrans,
466 btCollisionObject* collisionObject,
467 const btCollisionShape* collisionShape,
468 const btTransform& colObjWorldTransform,
469 RayResultCallback& resultCallback);
470
471 static void rayTestSingleInternal(const btTransform& rayFromTrans,const btTransform& rayToTrans,
472 const btCollisionObjectWrapper* collisionObjectWrap,
473 RayResultCallback& resultCallback);
474
476 static void objectQuerySingle(const btConvexShape* castShape, const btTransform& rayFromTrans,const btTransform& rayToTrans,
477 btCollisionObject* collisionObject,
478 const btCollisionShape* collisionShape,
479 const btTransform& colObjWorldTransform,
480 ConvexResultCallback& resultCallback, btScalar allowedPenetration);
481
482 static void objectQuerySingleInternal(const btConvexShape* castShape,const btTransform& convexFromTrans,const btTransform& convexToTrans,
483 const btCollisionObjectWrapper* colObjWrap,
484 ConvexResultCallback& resultCallback, btScalar allowedPenetration);
485
486 virtual void addCollisionObject(btCollisionObject* collisionObject, int collisionFilterGroup=btBroadphaseProxy::DefaultFilter, int collisionFilterMask=btBroadphaseProxy::AllFilter);
487
488 btCollisionObjectArray& getCollisionObjectArray()
489 {
490 return m_collisionObjects;
491 }
492
493 const btCollisionObjectArray& getCollisionObjectArray() const
494 {
495 return m_collisionObjects;
496 }
497
498
499 virtual void removeCollisionObject(btCollisionObject* collisionObject);
500
501 virtual void performDiscreteCollisionDetection();
502
503 btDispatcherInfo& getDispatchInfo()
504 {
505 return m_dispatchInfo;
506 }
507
508 const btDispatcherInfo& getDispatchInfo() const
509 {
510 return m_dispatchInfo;
511 }
512
513 bool getForceUpdateAllAabbs() const
514 {
515 return m_forceUpdateAllAabbs;
516 }
517 void setForceUpdateAllAabbs( bool forceUpdateAllAabbs)
518 {
519 m_forceUpdateAllAabbs = forceUpdateAllAabbs;
520 }
521
523 virtual void serialize(btSerializer* serializer);
524
525 };
526
527
528 #endif //BT_COLLISION_WORLD_H
btCollisionWorld::getDispatchInfo
const btDispatcherInfo & getDispatchInfo() const
Definition: btCollisionWorld.h:508
btCollisionWorld::serializeCollisionObjects
void serializeCollisionObjects(btSerializer *serializer)
Definition: btCollisionWorld.cpp:1609
btAlignedObjectArray::push_back
void push_back(const T &_Val)
Definition: btAlignedObjectArray.h:274
btCollisionWorld::RayResultCallback::RayResultCallback
RayResultCallback()
Definition: btCollisionWorld.h:221
btCollisionWorld::ContactResultCallback::m_collisionFilterGroup
int m_collisionFilterGroup
Definition: btCollisionWorld.h:413
btCollisionWorld::LocalRayResult::LocalRayResult
LocalRayResult(const btCollisionObject *collisionObject, LocalShapeInfo *localShapeInfo, const btVector3 &hitNormalLocal, btScalar hitFraction)
Definition: btCollisionWorld.h:185
btCollisionWorld::LocalConvexResult::m_localShapeInfo
LocalShapeInfo * m_localShapeInfo
Definition: btCollisionWorld.h:333
btCollisionWorld::updateAabbs
virtual void updateAabbs()
Definition: btCollisionWorld.cpp:191
btAlignedObjectArray
The btAlignedObjectArray template class uses a subset of the stl::vector interface for its methods It...
Definition: btAlignedObjectArray.h:53
btVector3.h
btCollisionWorld::m_dispatchInfo
btDispatcherInfo m_dispatchInfo
Definition: btCollisionWorld.h:98
btCollisionWorld::ClosestRayResultCallback::m_rayFromWorld
btVector3 m_rayFromWorld
Definition: btCollisionWorld.h:250
btCollisionWorld::btCollisionWorld
btCollisionWorld(btDispatcher *dispatcher, btBroadphaseInterface *broadphasePairCache, btCollisionConfiguration *collisionConfiguration)
for debug drawing
Definition: btCollisionWorld.cpp:69
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:106
btCollisionWorld::AllHitsRayResultCallback::m_rayToWorld
btVector3 m_rayToWorld
Definition: btCollisionWorld.h:287
btCollisionWorld::addCollisionObject
virtual void addCollisionObject(btCollisionObject *collisionObject, int collisionFilterGroup=btBroadphaseProxy::DefaultFilter, int collisionFilterMask=btBroadphaseProxy::AllFilter)
Definition: btCollisionWorld.cpp:111
btCollisionWorld::LocalShapeInfo::m_triangleIndex
int m_triangleIndex
Definition: btCollisionWorld.h:177
btCollisionWorld::ClosestConvexResultCallback::m_convexToWorld
btVector3 m_convexToWorld
Definition: btCollisionWorld.h:384
btAssert
#define btAssert(x)
Definition: btScalar.h:131
btCollisionWorld::getPairCache
btOverlappingPairCache * getPairCache()
Definition: btCollisionWorld.h:132
btCollisionWorld::ContactResultCallback
ContactResultCallback is used to report contact points.
Definition: btCollisionWorld.h:411
btCollisionConfiguration
btCollisionConfiguration allows to configure Bullet collision detection stack allocator size...
Definition: btCollisionConfiguration.h:26
btCollisionWorld::RayResultCallback::m_collisionObject
const btCollisionObject * m_collisionObject
Definition: btCollisionWorld.h:207
btCollisionShape
The btCollisionShape class provides an interface for collision shapes that can be shared among btColl...
Definition: btCollisionShape.h:27
btCollisionWorld::getCollisionObjectArray
btCollisionObjectArray & getCollisionObjectArray()
Definition: btCollisionWorld.h:488
btCollisionWorld::ConvexResultCallback::hasHit
bool hasHit() const
Definition: btCollisionWorld.h:357
btCollisionWorld::RayResultCallback
RayResultCallback is used to report new raycast results.
Definition: btCollisionWorld.h:204
btTransform.h
btManifoldPoint
ManifoldContactPoint collects and maintains persistent contactpoints.
Definition: btManifoldPoint.h:49
btCollisionWorld::ClosestConvexResultCallback::m_convexFromWorld
btVector3 m_convexFromWorld
Definition: btCollisionWorld.h:383
btCollisionWorld::m_dispatcher1
btDispatcher * m_dispatcher1
Definition: btCollisionWorld.h:96
btCollisionWorld::RayResultCallback::hasHit
bool hasHit() const
Definition: btCollisionWorld.h:216
btCollisionWorld::ClosestConvexResultCallback::addSingleResult
virtual btScalar addSingleResult(LocalConvexResult &convexResult, bool normalInWorldSpace)
Definition: btCollisionWorld.h:390
btCollisionWorld::rayTestSingleInternal
static void rayTestSingleInternal(const btTransform &rayFromTrans, const btTransform &rayToTrans, const btCollisionObjectWrapper *collisionObjectWrap, RayResultCallback &resultCallback)
Definition: btCollisionWorld.cpp:290
btCollisionWorld::AllHitsRayResultCallback::m_rayFromWorld
btVector3 m_rayFromWorld
Definition: btCollisionWorld.h:286
btCollisionWorld::ClosestConvexResultCallback::m_hitPointWorld
btVector3 m_hitPointWorld
Definition: btCollisionWorld.h:387
btCollisionWorld::computeOverlappingPairs
virtual void computeOverlappingPairs()
the computeOverlappingPairs is usually already called by performDiscreteCollisionDetection (or stepSi...
Definition: btCollisionWorld.cpp:210
btCollisionWorld::RayResultCallback::m_collisionFilterGroup
int m_collisionFilterGroup
Definition: btCollisionWorld.h:208
btCollisionWorld::RayResultCallback::m_closestHitFraction
btScalar m_closestHitFraction
Definition: btCollisionWorld.h:206
btCollisionWorld::ContactResultCallback::~ContactResultCallback
virtual ~ContactResultCallback()
Definition: btCollisionWorld.h:424
btSerializer
Definition: btSerializer.h:68
btCollisionWorld::getNumCollisionObjects
int getNumCollisionObjects() const
Definition: btCollisionWorld.h:440
btConvexShape
The btConvexShape is an abstract shape interface, implemented by all convex shapes such as btBoxShape...
Definition: btConvexShape.h:31
btCollisionWorld::ConvexResultCallback::needsCollision
virtual bool needsCollision(btBroadphaseProxy *proxy0) const
Definition: btCollisionWorld.h:364
btCollisionWorld::LocalRayResult::m_hitFraction
btScalar m_hitFraction
Definition: btCollisionWorld.h:199
btOverlappingPairCache.h
btCollisionWorld::ConvexResultCallback::m_collisionFilterGroup
int m_collisionFilterGroup
Definition: btCollisionWorld.h:343
btOverlappingPairCache
The btOverlappingPairCache provides an interface for overlapping pair management (add, remove, storage), used by the btBroadphaseInterface broadphases.
Definition: btOverlappingPairCache.h:60
btCollisionWorld::LocalConvexResult::m_hitCollisionObject
const btCollisionObject * m_hitCollisionObject
Definition: btCollisionWorld.h:332
btBroadphaseProxy::m_collisionFilterMask
int m_collisionFilterMask
Definition: btBroadphaseProxy.h:105
btBroadphaseInterface::getOverlappingPairCache
virtual btOverlappingPairCache * getOverlappingPairCache()=0
btCollisionWorld::setDebugDrawer
virtual void setDebugDrawer(btIDebugDraw *debugDrawer)
Definition: btCollisionWorld.h:157
btCollisionObject::getWorldTransform
btTransform & getWorldTransform()
Definition: btCollisionObject.h:372
btCollisionWorld::setBroadphase
void setBroadphase(btBroadphaseInterface *pairCache)
Definition: btCollisionWorld.h:117
btCollisionWorld::getDispatcher
const btDispatcher * getDispatcher() const
Definition: btCollisionWorld.h:143
btCollisionWorld::m_debugDrawer
btIDebugDraw * m_debugDrawer
Definition: btCollisionWorld.h:102
btCollisionWorld::AllHitsRayResultCallback
Definition: btCollisionWorld.h:276
btCollisionWorld::getDebugDrawer
virtual btIDebugDraw * getDebugDrawer()
Definition: btCollisionWorld.h:162
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:1264
btCollisionWorld::LocalConvexResult::m_hitNormalLocal
btVector3 m_hitNormalLocal
Definition: btCollisionWorld.h:334
btCollisionWorld::RayResultCallback::~RayResultCallback
virtual ~RayResultCallback()
Definition: btCollisionWorld.h:213
btCollisionWorld::setForceUpdateAllAabbs
void setForceUpdateAllAabbs(bool forceUpdateAllAabbs)
Definition: btCollisionWorld.h:517
btCollisionWorld::RayResultCallback::needsCollision
virtual bool needsCollision(btBroadphaseProxy *proxy0) const
Definition: btCollisionWorld.h:231
btCollisionWorld::LocalConvexResult::m_hitFraction
btScalar m_hitFraction
Definition: btCollisionWorld.h:336
btCollisionWorld::AllHitsRayResultCallback::m_hitFractions
btAlignedObjectArray< btScalar > m_hitFractions
Definition: btCollisionWorld.h:291
btCollisionWorld::ClosestConvexResultCallback::ClosestConvexResultCallback
ClosestConvexResultCallback(const btVector3 &convexFromWorld, const btVector3 &convexToWorld)
Definition: btCollisionWorld.h:376
btCollisionWorld::debugDrawObject
virtual void debugDrawObject(const btTransform &worldTransform, const btCollisionShape *shape, const btVector3 &color)
Definition: btCollisionWorld.cpp:1331
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:1252
btCollisionWorld::RayResultCallback::m_flags
unsigned int m_flags
Definition: btCollisionWorld.h:211
btCollisionObject
btCollisionObject can be used to manage collision detection objects.
Definition: btCollisionObject.h:49
btCollisionWorld::ClosestRayResultCallback
Definition: btCollisionWorld.h:242
btCollisionWorld::getCollisionObjectArray
const btCollisionObjectArray & getCollisionObjectArray() const
Definition: btCollisionWorld.h:493
btTransform::getBasis
btMatrix3x3 & getBasis()
Return the basis matrix for the rotation.
Definition: btTransform.h:112
btCollisionWorld::LocalConvexResult
Definition: btCollisionWorld.h:316
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:280
btIDebugDraw
The btIDebugDraw interface class allows hooking up a debug renderer to visually debug simulations...
Definition: btIDebugDraw.h:29
btCollisionWorld::ClosestConvexResultCallback::m_hitNormalWorld
btVector3 m_hitNormalWorld
Definition: btCollisionWorld.h:386
btCollisionWorld::LocalShapeInfo
LocalShapeInfo gives extra information for complex shapes Currently, only btTriangleMeshShape is avai...
Definition: btCollisionWorld.h:174
btCollisionWorld::ContactResultCallback::needsCollision
virtual bool needsCollision(btBroadphaseProxy *proxy0) const
Definition: btCollisionWorld.h:428
btCollisionWorld::removeCollisionObject
virtual void removeCollisionObject(btCollisionObject *collisionObject)
Definition: btCollisionWorld.cpp:237
btCollisionWorld::LocalRayResult::m_collisionObject
const btCollisionObject * m_collisionObject
Definition: btCollisionWorld.h:196
btBroadphaseProxy::m_collisionFilterGroup
int m_collisionFilterGroup
Definition: btBroadphaseProxy.h:104
btCollisionWorld::ContactResultCallback::m_collisionFilterMask
int m_collisionFilterMask
Definition: btCollisionWorld.h:414
btCollisionWorld::AllHitsRayResultCallback::m_hitNormalWorld
btAlignedObjectArray< btVector3 > m_hitNormalWorld
Definition: btCollisionWorld.h:289
btCollisionWorld::~btCollisionWorld
virtual ~btCollisionWorld()
Definition: btCollisionWorld.cpp:78
btCollisionWorld::LocalShapeInfo::m_shapePart
int m_shapePart
Definition: btCollisionWorld.h:176
btBroadphaseInterface
The btBroadphaseInterface class provides an interface to detect aabb-overlapping object pairs...
Definition: btBroadphaseInterface.h:55
btCollisionWorld::getDispatcher
btDispatcher * getDispatcher()
Definition: btCollisionWorld.h:138
btCollisionWorld::ConvexResultCallback::m_collisionFilterMask
int m_collisionFilterMask
Definition: btCollisionWorld.h:344
btBroadphaseProxy
The btBroadphaseProxy is the main class that can be used with the Bullet broadphases.
Definition: btBroadphaseProxy.h:85
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:1008
btVector3
btVector3 can be used to represent 3D points and vectors.
Definition: btVector3.h:83
btCollisionWorld::ClosestRayResultCallback::addSingleResult
virtual btScalar addSingleResult(LocalRayResult &rayResult, bool normalInWorldSpace)
Definition: btCollisionWorld.h:256
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:1640
btAlignedObjectArray::size
int size() const
return the number of elements in the array
Definition: btAlignedObjectArray.h:155
btCollisionWorld::getForceUpdateAllAabbs
bool getForceUpdateAllAabbs() const
Definition: btCollisionWorld.h:513
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. It is used internally by rayTest.
Definition: btCollisionWorld.cpp:590
btTransform
The btTransform class supports rigid transforms with only translation and rotation and no scaling/she...
Definition: btTransform.h:34
btCollisionWorld::getBroadphase
btBroadphaseInterface * getBroadphase()
Definition: btCollisionWorld.h:127
btCollisionWorld::LocalRayResult::m_hitNormalLocal
btVector3 m_hitNormalLocal
Definition: btCollisionWorld.h:198
btCollisionWorld
CollisionWorld is interface and container for the collision detection.
Definition: btCollisionWorld.h:88
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:1086
btCollisionWorld::getDispatchInfo
btDispatcherInfo & getDispatchInfo()
Definition: btCollisionWorld.h:503
btCollisionDispatcher.h
btCollisionWorld::ConvexResultCallback::~ConvexResultCallback
virtual ~ConvexResultCallback()
Definition: btCollisionWorld.h:353
btCollisionWorld::AllHitsRayResultCallback::m_hitPointWorld
btAlignedObjectArray< btVector3 > m_hitPointWorld
Definition: btCollisionWorld.h:290
btCollisionWorld::ClosestConvexResultCallback::m_hitCollisionObject
const btCollisionObject * m_hitCollisionObject
Definition: btCollisionWorld.h:388
btCollisionWorld::m_collisionObjects
btAlignedObjectArray< btCollisionObject * > m_collisionObjects
Definition: btCollisionWorld.h:94
btCollisionObject.h
btCollisionWorld::ClosestRayResultCallback::m_rayToWorld
btVector3 m_rayToWorld
Definition: btCollisionWorld.h:251
btCollisionWorld::performDiscreteCollisionDetection
virtual void performDiscreteCollisionDetection()
Definition: btCollisionWorld.cpp:216
btBroadphaseProxy::DefaultFilter
Definition: btBroadphaseProxy.h:93
btCollisionWorld::LocalRayResult::m_localShapeInfo
LocalShapeInfo * m_localShapeInfo
Definition: btCollisionWorld.h:197
btCollisionWorld::AllHitsRayResultCallback::m_collisionObjects
btAlignedObjectArray< const btCollisionObject * > m_collisionObjects
Definition: btCollisionWorld.h:284
btCollisionWorld::ClosestRayResultCallback::m_hitPointWorld
btVector3 m_hitPointWorld
Definition: btCollisionWorld.h:254
btCollisionWorld::m_broadphasePairCache
btBroadphaseInterface * m_broadphasePairCache
Definition: btCollisionWorld.h:100
btCollisionWorld::LocalConvexResult::m_hitPointLocal
btVector3 m_hitPointLocal
Definition: btCollisionWorld.h:335
btCollisionWorld::ConvexResultCallback::m_closestHitFraction
btScalar m_closestHitFraction
Definition: btCollisionWorld.h:342
btCollisionWorld::ConvexResultCallback::ConvexResultCallback
ConvexResultCallback()
Definition: btCollisionWorld.h:346
btAlignedObjectArray.h
btCollisionWorld::LocalConvexResult::LocalConvexResult
LocalConvexResult(const btCollisionObject *hitCollisionObject, LocalShapeInfo *localShapeInfo, const btVector3 &hitNormalLocal, const btVector3 &hitPointLocal, btScalar hitFraction)
Definition: btCollisionWorld.h:318
btCollisionWorld::ContactResultCallback::ContactResultCallback
ContactResultCallback()
Definition: btCollisionWorld.h:417
btBroadphaseProxy::AllFilter
Definition: btBroadphaseProxy.h:99
btCollisionWorld::updateSingleAabb
void updateSingleAabb(btCollisionObject *colObj)
Definition: btCollisionWorld.cpp:148
btDispatcherInfo
Definition: btDispatcher.h:30
btCollisionWorld::ContactResultCallback::m_closestDistanceThreshold
btScalar m_closestDistanceThreshold
Definition: btCollisionWorld.h:415
btCollisionWorld::ConvexResultCallback
RayResultCallback is used to report new raycast results.
Definition: btCollisionWorld.h:340
btCollisionWorld::debugDrawWorld
virtual void debugDrawWorld()
Definition: btCollisionWorld.cpp:1513
btDispatcher
The btDispatcher interface class can be used in combination with broadphase to dispatch calculations ...
Definition: btDispatcher.h:75
btVector3::setInterpolate3
void setInterpolate3(const btVector3 &v0, const btVector3 &v1, btScalar rt)
Definition: btVector3.h:503
btCollisionObjectWrapper
Definition: btCollisionObjectWrapper.h:17
btCollisionWorld::RayResultCallback::m_collisionFilterMask
int m_collisionFilterMask
Definition: btCollisionWorld.h:209
btCollisionWorld::getBroadphase
const btBroadphaseInterface * getBroadphase() const
Definition: btCollisionWorld.h:122
btCollisionWorld::AllHitsRayResultCallback::addSingleResult
virtual btScalar addSingleResult(LocalRayResult &rayResult, bool normalInWorldSpace)
Definition: btCollisionWorld.h:293
btCollisionWorld::objectQuerySingleInternal
static void objectQuerySingleInternal(const btConvexShape *castShape, const btTransform &convexFromTrans, const btTransform &convexToTrans, const btCollisionObjectWrapper *colObjWrap, ConvexResultCallback &resultCallback, btScalar allowedPenetration)
Definition: btCollisionWorld.cpp:600
btCollisionWorld::LocalRayResult
Definition: btCollisionWorld.h:183
btCollisionWorld::ClosestRayResultCallback::ClosestRayResultCallback
ClosestRayResultCallback(const btVector3 &rayFromWorld, const btVector3 &rayToWorld)
Definition: btCollisionWorld.h:244
btScalar
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition: btScalar.h:292
btCollisionWorld::AllHitsRayResultCallback::AllHitsRayResultCallback
AllHitsRayResultCallback(const btVector3 &rayFromWorld, const btVector3 &rayToWorld)
Definition: btCollisionWorld.h:278
btCollisionWorld::ClosestRayResultCallback::m_hitNormalWorld
btVector3 m_hitNormalWorld
Definition: btCollisionWorld.h:253
btCollisionWorld::ClosestConvexResultCallback
Definition: btCollisionWorld.h:374