Bullet Collision Detection & Physics Library
btGImpactCollisionAlgorithm.cpp
Go to the documentation of this file.
1/*
2This source file is part of GIMPACT Library.
3
4For the latest info, see http://gimpact.sourceforge.net/
5
6Copyright (c) 2007 Francisco Leon Najera. C.C. 80087371.
7email: projectileman@yahoo.com
8
9
10This software is provided 'as-is', without any express or implied warranty.
11In no event will the authors be held liable for any damages arising from the use of this software.
12Permission is granted to anyone to use this software for any purpose,
13including commercial applications, and to alter it and redistribute it freely,
14subject to the following restrictions:
15
161. 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.
172. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
183. This notice may not be removed or altered from any source distribution.
19*/
20/*
21Author: Francisco Leon Najera
22Concave-Concave Collision
23
24*/
25
31#include "btContactProcessing.h"
33
36{
37public:
38 btPlaneShape(const btVector3& v, float f)
39 : btStaticPlaneShape(v, f)
40 {
41 }
42
44 {
45 equation[0] = m_planeNormal[0];
46 equation[1] = m_planeNormal[1];
47 equation[2] = m_planeNormal[2];
49 }
50
52 {
53 const btVector3 normal = trans.getBasis() * m_planeNormal;
54 equation[0] = normal[0];
55 equation[1] = normal[1];
56 equation[2] = normal[2];
58 }
59};
60
62#ifdef TRI_COLLISION_PROFILING
63
65
68
70{
72}
73
75{
78}
79#endif //TRI_COLLISION_PROFILING
81
86{
87public:
91
92public:
94 {
95 public:
97 virtual const btCollisionShape* getChildShape(int index)
98 {
99 return m_parent->m_gim_shape->getChildShape(index);
100 }
102 };
103
105 {
106 public:
107 virtual btCollisionShape* getChildShape(int index)
108 {
110 return &m_parent->m_trishape;
111 }
113 };
114
116 {
117 public:
118 virtual btCollisionShape* getChildShape(int index)
119 {
121 return &m_parent->m_tetrashape;
122 }
123 };
124
125public:
130
132 {
134 //select retriever
136 {
138 }
140 {
142 }
143 else
144 {
146 }
147
149 }
150
152 {
153 return m_current_retriever->getChildShape(index);
154 }
155};
156
158
159#ifdef TRI_COLLISION_PROFILING
160
162float btGImpactCollisionAlgorithm::getAverageTreeCollisionTime()
163{
164 return btGImpactBoxSet::getAverageTreeCollisionTime();
165}
166
168float btGImpactCollisionAlgorithm::getAverageTriangleCollisionTime()
169{
170 if (g_count_triangle_collision == 0) return 0;
171
174
177
178 return avgtime;
179}
180
181#endif //TRI_COLLISION_PROFILING
182
184 : btActivatingCollisionAlgorithm(ci, body0Wrap, body1Wrap)
185{
188}
189
191{
192 clearCache();
193}
194
196 const btCollisionObjectWrapper* body1Wrap,
197 const btVector3& point,
198 const btVector3& normal,
199 btScalar distance)
200{
203 checkManifold(body0Wrap, body1Wrap);
204 m_resultOut->addContactPoint(normal, point, distance);
205}
206
208 const btCollisionObjectWrapper* body0Wrap,
209 const btCollisionObjectWrapper* body1Wrap,
212{
213 {
214 btCollisionAlgorithm* algor = newAlgorithm(body0Wrap, body1Wrap);
215 // post : checkManifold is called
216
219
220 algor->processCollision(body0Wrap, body1Wrap, *m_dispatchInfo, m_resultOut);
221
222 algor->~btCollisionAlgorithm();
224 }
225}
226
228 const btCollisionObjectWrapper* body0Wrap,
229 const btCollisionObjectWrapper* body1Wrap,
232{
235
240}
241
243 const btTransform& trans0,
244 const btTransform& trans1,
247{
248 if (shape0->hasBoxSet() && shape1->hasBoxSet())
249 {
250 btGImpactBoxSet::find_collision(shape0->getBoxSet(), trans0, shape1->getBoxSet(), trans1, pairset);
251 }
252 else
253 {
256 int i = shape0->getNumChildShapes();
257
258 while (i--)
259 {
260 shape0->getChildAabb(i, trans0, boxshape0.m_min, boxshape0.m_max);
261
262 int j = shape1->getNumChildShapes();
263 while (j--)
264 {
265 shape1->getChildAabb(i, trans1, boxshape1.m_min, boxshape1.m_max);
266
267 if (boxshape1.has_collision(boxshape0))
268 {
269 pairset.push_pair(i, j);
270 }
271 }
272 }
273 }
274}
275
277 const btTransform& trans0,
278 const btTransform& trans1,
282{
284
285 if (shape0->hasBoxSet())
286 {
288 trans1to0 *= trans1;
289
290 shape1->getAabb(trans1to0, boxshape.m_min, boxshape.m_max);
291
292 shape0->getBoxSet()->boxQuery(boxshape, collided_primitives);
293 }
294 else
295 {
296 shape1->getAabb(trans1, boxshape.m_min, boxshape.m_max);
297
299 int i = shape0->getNumChildShapes();
300
301 while (i--)
302 {
303 shape0->getChildAabb(i, trans0, boxshape0.m_min, boxshape0.m_max);
304
305 if (boxshape.has_collision(boxshape0))
306 {
307 collided_primitives.push_back(i);
308 }
309 }
310 }
311}
312
314 const btCollisionObjectWrapper* body1Wrap,
317 const int* pairs, int pair_count)
318{
321
322 shape0->lockChildShapes();
323 shape1->lockChildShapes();
324
325 const int* pair_pointer = pairs;
326
327 while (pair_count--)
328 {
330 m_triface1 = *(pair_pointer + 1);
331 pair_pointer += 2;
332
333 shape0->getBulletTriangle(m_triface0, tri0);
334 shape1->getBulletTriangle(m_triface1, tri1);
335
336 //collide two convex shapes
337 if (tri0.overlap_test_conservative(tri1))
338 {
339 convex_vs_convex_collision(body0Wrap, body1Wrap, &tri0, &tri1);
340 }
341 }
342
343 shape0->unlockChildShapes();
344 shape1->unlockChildShapes();
345}
346
348 const btCollisionObjectWrapper* body1Wrap,
351 const int* pairs, int pair_count)
352{
355
359
360 shape0->lockChildShapes();
361 shape1->lockChildShapes();
362
363 const int* pair_pointer = pairs;
364
365 while (pair_count--)
366 {
368 m_triface1 = *(pair_pointer + 1);
369 pair_pointer += 2;
370
371 shape0->getPrimitiveTriangle(m_triface0, ptri0);
372 shape1->getPrimitiveTriangle(m_triface1, ptri1);
373
374#ifdef TRI_COLLISION_PROFILING
376#endif
377
378 ptri0.applyTransform(orgtrans0);
379 ptri1.applyTransform(orgtrans1);
380
381 //build planes
382 ptri0.buildTriPlane();
383 ptri1.buildTriPlane();
384 // test conservative
385
386 if (ptri0.overlap_test_conservative(ptri1))
387 {
388 if (ptri0.find_triangle_collision_clip_method(ptri1, contact_data))
389 {
390 int j = contact_data.m_point_count;
391 while (j--)
392 {
393 addContactPoint(body0Wrap, body1Wrap,
394 contact_data.m_points[j],
395 contact_data.m_separating_normal,
396 -contact_data.m_penetration_depth);
397 }
398 }
399 }
400
401#ifdef TRI_COLLISION_PROFILING
403#endif
404 }
405
406 shape0->unlockChildShapes();
407 shape1->unlockChildShapes();
408}
409
411 const btCollisionObjectWrapper* body0Wrap,
412 const btCollisionObjectWrapper* body1Wrap,
415{
416 if (shape0->getGImpactShapeType() == CONST_GIMPACT_TRIMESH_SHAPE)
417 {
418 const btGImpactMeshShape* meshshape0 = static_cast<const btGImpactMeshShape*>(shape0);
420
421 while (m_part0--)
422 {
423 gimpact_vs_gimpact(body0Wrap, body1Wrap, meshshape0->getMeshPart(m_part0), shape1);
424 }
425
426 return;
427 }
428
429 if (shape1->getGImpactShapeType() == CONST_GIMPACT_TRIMESH_SHAPE)
430 {
431 const btGImpactMeshShape* meshshape1 = static_cast<const btGImpactMeshShape*>(shape1);
433
434 while (m_part1--)
435 {
436 gimpact_vs_gimpact(body0Wrap, body1Wrap, shape0, meshshape1->getMeshPart(m_part1));
437 }
438
439 return;
440 }
441
444
446
448
449 if (pairset.size() == 0) return;
450
451 if (shape0->getGImpactShapeType() == CONST_GIMPACT_TRIMESH_SHAPE_PART &&
452 shape1->getGImpactShapeType() == CONST_GIMPACT_TRIMESH_SHAPE_PART)
453 {
456//specialized function
457#ifdef BULLET_TRIANGLE_COLLISION
458 collide_gjk_triangles(body0Wrap, body1Wrap, shapepart0, shapepart1, &pairset[0].m_index1, pairset.size());
459#else
460 collide_sat_triangles(body0Wrap, body1Wrap, shapepart0, shapepart1, &pairset[0].m_index1, pairset.size());
461#endif
462
463 return;
464 }
465
466 //general function
467
468 shape0->lockChildShapes();
469 shape1->lockChildShapes();
470
473
474 bool child_has_transform0 = shape0->childrenHasTransform();
475 bool child_has_transform1 = shape1->childrenHasTransform();
476
477 int i = pairset.size();
478 while (i--)
479 {
480 GIM_PAIR* pair = &pairset[i];
482 m_triface1 = pair->m_index2;
483 const btCollisionShape* colshape0 = retriever0.getChildShape(m_triface0);
484 const btCollisionShape* colshape1 = retriever1.getChildShape(m_triface1);
485
486 btTransform tr0 = body0Wrap->getWorldTransform();
487 btTransform tr1 = body1Wrap->getWorldTransform();
488
490 {
491 tr0 = orgtrans0 * shape0->getChildTransform(m_triface0);
492 }
493
495 {
496 tr1 = orgtrans1 * shape1->getChildTransform(m_triface1);
497 }
498
501
502 //collide two convex shapes
504 }
505
506 shape0->unlockChildShapes();
507 shape1->unlockChildShapes();
508}
509
511 const btCollisionObjectWrapper* body1Wrap,
513 const btCollisionShape* shape1, bool swapped)
514{
515 if (shape0->getGImpactShapeType() == CONST_GIMPACT_TRIMESH_SHAPE)
516 {
517 const btGImpactMeshShape* meshshape0 = static_cast<const btGImpactMeshShape*>(shape0);
518 int& part = swapped ? m_part1 : m_part0;
520
521 while (part--)
522 {
523 gimpact_vs_shape(body0Wrap,
524 body1Wrap,
525 meshshape0->getMeshPart(part),
526 shape1, swapped);
527 }
528
529 return;
530 }
531
532#ifdef GIMPACT_VS_PLANE_COLLISION
533 if (shape0->getGImpactShapeType() == CONST_GIMPACT_TRIMESH_SHAPE_PART &&
534 shape1->getShapeType() == STATIC_PLANE_PROXYTYPE)
535 {
537 const btStaticPlaneShape* planeshape = static_cast<const btStaticPlaneShape*>(shape1);
538 gimpacttrimeshpart_vs_plane_collision(body0Wrap, body1Wrap, shapepart, planeshape, swapped);
539 return;
540 }
541
542#endif
543
544 if (shape1->isCompound())
545 {
546 const btCompoundShape* compoundshape = static_cast<const btCompoundShape*>(shape1);
547 gimpact_vs_compoundshape(body0Wrap, body1Wrap, shape0, compoundshape, swapped);
548 return;
549 }
550 else if (shape1->isConcave())
551 {
552 const btConcaveShape* concaveshape = static_cast<const btConcaveShape*>(shape1);
553 gimpact_vs_concave(body0Wrap, body1Wrap, shape0, concaveshape, swapped);
554 return;
555 }
556
558
560
562
564
565 if (collided_results.size() == 0) return;
566
567 shape0->lockChildShapes();
568
570
571 bool child_has_transform0 = shape0->childrenHasTransform();
572
573 int i = collided_results.size();
574
575 while (i--)
576 {
578 if (swapped)
580 else
582
583 const btCollisionShape* colshape0 = retriever0.getChildShape(child_index);
584
585 btTransform tr0 = body0Wrap->getWorldTransform();
586
588 {
589 tr0 = orgtrans0 * shape0->getChildTransform(child_index);
590 }
591
594
595 if (m_resultOut->getBody0Wrap()->getCollisionObject() == ob0.getCollisionObject())
596 {
599 }
600 else
601 {
604 }
605
606 //collide two shapes
607 if (swapped)
608 {
610 }
611 else
612 {
614 }
615
616 if (m_resultOut->getBody0Wrap()->getCollisionObject() == ob0.getCollisionObject())
617 {
619 }
620 else
621 {
623 }
624 }
625
626 shape0->unlockChildShapes();
627}
628
630 const btCollisionObjectWrapper* body1Wrap,
632 const btCompoundShape* shape1, bool swapped)
633{
635
636 int i = shape1->getNumChildShapes();
637 while (i--)
638 {
639 const btCollisionShape* colshape1 = shape1->getChildShape(i);
640 btTransform childtrans1 = orgtrans1 * shape1->getChildTransform(i);
641
642 btCollisionObjectWrapper ob1(body1Wrap, colshape1, body1Wrap->getCollisionObject(), childtrans1, -1, i);
643
644 const btCollisionObjectWrapper* tmp = 0;
645 if (m_resultOut->getBody0Wrap()->getCollisionObject() == ob1.getCollisionObject())
646 {
649 }
650 else
651 {
654 }
655 //collide child shape
656 gimpact_vs_shape(body0Wrap, &ob1,
657 shape0, colshape1, swapped);
658
659 if (m_resultOut->getBody0Wrap()->getCollisionObject() == ob1.getCollisionObject())
660 {
662 }
663 else
664 {
666 }
667 }
668}
669
671 const btCollisionObjectWrapper* body0Wrap,
672 const btCollisionObjectWrapper* body1Wrap,
674 const btStaticPlaneShape* shape1, bool swapped)
675{
678
679 const btPlaneShape* planeshape = static_cast<const btPlaneShape*>(shape1);
681 planeshape->get_plane_equation_transformed(orgtrans1, plane);
682
683 //test box against plane
684
686 shape0->getAabb(orgtrans0, tribox.m_min, tribox.m_max);
687 tribox.increment_margin(planeshape->getMargin());
688
689 if (tribox.plane_classify(plane) != BT_CONST_COLLIDE_PLANE) return;
690
691 shape0->lockChildShapes();
692
693 btScalar margin = shape0->getMargin() + planeshape->getMargin();
694
696 int vi = shape0->getVertexCount();
697 while (vi--)
698 {
699 shape0->getVertex(vi, vertex);
701
702 btScalar distance = vertex.dot(plane) - plane[3] - margin;
703
704 if (distance < 0.0) //add contact
705 {
706 if (swapped)
707 {
708 addContactPoint(body1Wrap, body0Wrap,
709 vertex,
710 -plane,
711 distance);
712 }
713 else
714 {
715 addContactPoint(body0Wrap, body1Wrap,
716 vertex,
717 plane,
718 distance);
719 }
720 }
721 }
722
723 shape0->unlockChildShapes();
724}
725
727{
728public:
735
737 {
739 tri1.setMargin(margin);
740 if (swapped)
741 {
744 }
745 else
746 {
749 }
750
752 const btCollisionObjectWrapper* tmp = 0;
753
754 if (algorithm->internalGetResultOut()->getBody0Wrap()->getCollisionObject() == ob1Wrap.getCollisionObject())
755 {
758 }
759 else
760 {
763 }
764
767
768 if (algorithm->internalGetResultOut()->getBody0Wrap()->getCollisionObject() == ob1Wrap.getCollisionObject())
769 {
771 }
772 else
773 {
775 }
776 }
777};
778
780 const btCollisionObjectWrapper* body0Wrap,
781 const btCollisionObjectWrapper* body1Wrap,
783 const btConcaveShape* shape1, bool swapped)
784{
785 //create the callback
787 tricallback.algorithm = this;
788 tricallback.body0Wrap = body0Wrap;
789 tricallback.body1Wrap = body1Wrap;
790 tricallback.gimpactshape0 = shape0;
791 tricallback.swapped = swapped;
792 tricallback.margin = shape1->getMargin();
793
794 //getting the trimesh AABB
796
798
801
802 shape1->processAllTriangles(&tricallback, minAABB, maxAABB);
803}
804
806{
807 clearCache();
808
811 const btGImpactShapeInterface* gimpactshape0;
813
815 {
816 gimpactshape0 = static_cast<const btGImpactShapeInterface*>(body0Wrap->getCollisionShape());
817
819 {
820 gimpactshape1 = static_cast<const btGImpactShapeInterface*>(body1Wrap->getCollisionShape());
821
822 gimpact_vs_gimpact(body0Wrap, body1Wrap, gimpactshape0, gimpactshape1);
823 }
824 else
825 {
826 gimpact_vs_shape(body0Wrap, body1Wrap, gimpactshape0, body1Wrap->getCollisionShape(), false);
827 }
828 }
829 else if (body1Wrap->getCollisionShape()->getShapeType() == GIMPACT_SHAPE_PROXYTYPE)
830 {
831 gimpactshape1 = static_cast<const btGImpactShapeInterface*>(body1Wrap->getCollisionShape());
832
833 gimpact_vs_shape(body1Wrap, body0Wrap, gimpactshape1, body0Wrap->getCollisionShape(), true);
834 }
835
836 // Ensure that gContactProcessedCallback is called for concave shapes.
837 if (getLastManifold())
838 {
840 }
841}
842
844{
845 return 1.f;
846}
847
849
852{
854
855 int i;
856
857 for (i = 0; i < MAX_BROADPHASE_COLLISION_TYPES; i++)
858 {
859 dispatcher->registerCollisionCreateFunc(GIMPACT_SHAPE_PROXYTYPE, i, &s_gimpact_cf);
860 }
861
862 for (i = 0; i < MAX_BROADPHASE_COLLISION_TYPES; i++)
863 {
864 dispatcher->registerCollisionCreateFunc(i, GIMPACT_SHAPE_PROXYTYPE, &s_gimpact_cf);
865 }
866}
@ BT_CONST_COLLIDE_PLANE
@ GIMPACT_SHAPE_PROXYTYPE
Used for GIMPACT Trimesh integration.
@ STATIC_PLANE_PROXYTYPE
@ MAX_BROADPHASE_COLLISION_TYPES
@ CONST_GIMPACT_TRIMESH_SHAPE
@ CONST_GIMPACT_TRIMESH_SHAPE_PART
const T & btMax(const T &a, const T &b)
Definition btMinMax.h:27
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition btScalar.h:314
virtual const btCollisionShape * getChildShape(int index)
virtual btCollisionShape * getChildShape(int index)
virtual btCollisionShape * getChildShape(int index)
Retrieving shapes shapes.
TetraShapeRetriever m_tetra_retriever
GIM_ShapeRetriever(const btGImpactShapeInterface *gim_shape)
ChildShapeRetriever * m_current_retriever
const btCollisionShape * getChildShape(int index)
btTetrahedronShapeEx m_tetrashape
TriangleShapeRetriever m_tri_retriever
const btGImpactShapeInterface * m_gim_shape
ChildShapeRetriever m_child_retriever
Axis aligned box.
void increment_margin(btScalar margin)
This class is not enabled yet (work-in-progress) to more aggressively activate objects.
The btAlignedObjectArray template class uses a subset of the stl::vector interface for its methods It...
The btClock is a portable basic clock that measures accurate time in seconds, use for profiling.
Definition btQuickprof.h:23
void reset()
Resets the initial reference time.
btCollisionAlgorithm is an collision interface that is compatible with the Broadphase and btDispatche...
virtual void processCollision(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, const btDispatcherInfo &dispatchInfo, btManifoldResult *resultOut)=0
btCollisionDispatcher supports algorithms that handle ConvexConvex and ConvexConcave collision pairs.
btCollisionObject can be used to manage collision detection objects.
The btCollisionShape class provides an interface for collision shapes that can be shared among btColl...
int getShapeType() const
The btCompoundShape allows to store multiple other btCollisionShapes This allows for moving concave c...
The btConcaveShape class provides an interface for non-moving (static) concave shapes.
virtual void freeCollisionAlgorithm(void *ptr)=0
Collision Algorithm for GImpact Shapes.
void gimpact_vs_concave(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, const btGImpactShapeInterface *shape0, const btConcaveShape *shape1, bool swapped)
void gimpact_vs_shape_find_pairs(const btTransform &trans0, const btTransform &trans1, const btGImpactShapeInterface *shape0, const btCollisionShape *shape1, btAlignedObjectArray< int > &collided_primitives)
void setFace0(int value)
Accessor/Mutator pairs for Part and triangleID.
btCollisionAlgorithm * newAlgorithm(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap)
void collide_gjk_triangles(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, const btGImpactMeshShapePart *shape0, const btGImpactMeshShapePart *shape1, const int *pairs, int pair_count)
Collision routines.
const btDispatcherInfo * m_dispatchInfo
void checkConvexAlgorithm(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap)
void gimpact_vs_gimpact(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, const btGImpactShapeInterface *shape0, const btGImpactShapeInterface *shape1)
Collides two gimpact shapes.
void gimpact_vs_compoundshape(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, const btGImpactShapeInterface *shape0, const btCompoundShape *shape1, bool swapped)
btScalar calculateTimeOfImpact(btCollisionObject *body0, btCollisionObject *body1, const btDispatcherInfo &dispatchInfo, btManifoldResult *resultOut)
void gimpact_vs_gimpact_find_pairs(const btTransform &trans0, const btTransform &trans1, const btGImpactShapeInterface *shape0, const btGImpactShapeInterface *shape1, btPairSet &pairset)
btGImpactCollisionAlgorithm(const btCollisionAlgorithmConstructionInfo &ci, const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap)
void gimpacttrimeshpart_vs_plane_collision(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, const btGImpactMeshShapePart *shape0, const btStaticPlaneShape *shape1, bool swapped)
void gimpact_vs_shape(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, const btGImpactShapeInterface *shape0, const btCollisionShape *shape1, bool swapped)
void convex_vs_convex_collision(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, const btCollisionShape *shape0, const btCollisionShape *shape1)
void checkManifold(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap)
static void registerAlgorithm(btCollisionDispatcher *dispatcher)
Use this function for register the algorithm externally.
void collide_sat_triangles(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, const btGImpactMeshShapePart *shape0, const btGImpactMeshShapePart *shape1, const int *pairs, int pair_count)
virtual void processCollision(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, const btDispatcherInfo &dispatchInfo, btManifoldResult *resultOut)
void shape_vs_shape_collision(const btCollisionObjectWrapper *body0, const btCollisionObjectWrapper *body1, const btCollisionShape *shape0, const btCollisionShape *shape1)
void addContactPoint(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, const btVector3 &point, const btVector3 &normal, btScalar distance)
This class manages a sub part of a mesh supplied by the btStridingMeshInterface interface.
This class manages a mesh supplied by the btStridingMeshInterface interface.
int getMeshPartCount() const
static void find_collision(const btGImpactQuantizedBvh *boxset1, const btTransform &trans1, const btGImpactQuantizedBvh *boxset2, const btTransform &trans2, btPairSet &collision_pairs)
Base class for gimpact shapes.
virtual btCollisionShape * getChildShape(int index)=0
Gets the children.
virtual bool needsRetrieveTriangles() const =0
Determines if this shape has triangles.
virtual void getBulletTetrahedron(int prim_index, btTetrahedronShapeEx &tetrahedron) const =0
virtual void getBulletTriangle(int prim_index, btTriangleShapeEx &triangle) const =0
virtual bool needsRetrieveTetrahedrons() const =0
Determines if this shape has tetrahedrons.
const btCollisionObjectWrapper * body1Wrap
virtual void processTriangle(btVector3 *triangle, int partId, int triangleIndex)
btGImpactCollisionAlgorithm * algorithm
const btGImpactShapeInterface * gimpactshape0
const btCollisionObjectWrapper * body0Wrap
btManifoldResult is a helper class to manage contact results.
virtual void setShapeIdentifiersA(int partId0, int index0)
setShapeIdentifiersA/B provides experimental support for per-triangle material / custom material comb...
void setBody0Wrap(const btCollisionObjectWrapper *obj0Wrap)
const btCollisionObjectWrapper * getBody1Wrap() const
void setBody1Wrap(const btCollisionObjectWrapper *obj1Wrap)
virtual void setShapeIdentifiersB(int partId1, int index1)
const btCollisionObjectWrapper * getBody0Wrap() const
virtual void addContactPoint(const btVector3 &normalOnBInWorld, const btVector3 &pointInWorld, btScalar depth)
A pairset array.
Class for accessing the plane equation.
void get_plane_equation_transformed(const btTransform &trans, btVector4 &equation) const
void get_plane_equation(btVector4 &equation)
btPlaneShape(const btVector3 &v, float f)
The btStaticPlaneShape simulates an infinite non-moving (static) collision plane.
Helper class for tetrahedrons.
The btTransform class supports rigid transforms with only translation and rotation and no scaling/she...
Definition btTransform.h:30
btTransform inverse() const
Return the inverse of this transform.
The btTriangleCallback provides a callback for each overlapping triangle when calling processAllTrian...
Helper class for colliding Bullet Triangle Shapes.
btVector3 can be used to represent 3D points and vectors.
Definition btVector3.h:82
btScalar dot(const btVector3 &v) const
Return the dot product.
Definition btVector3.h:229
Overlapping pair.
Definition gim_pair.h:7
int m_index1
Definition gim_pair.h:8
Structure for collision.
const btCollisionShape * getCollisionShape() const
const btCollisionObject * getCollisionObject() const
const btTransform & getWorldTransform() const