Bullet Collision Detection & Physics Library: btWorldImporter.cpp Source File

Bullet Collision Detection & Physics Library

btWorldImporter.cpp
Go to the documentation of this file.
1 /*
2 Bullet Continuous Collision Detection and Physics Library
3 Copyright (c) 2003-2012 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 #include "btWorldImporter.h"
17 #include "btBulletDynamicsCommon.h"
18 #ifdef USE_GIMPACT
19 #include "BulletCollision/Gimpact/btGImpactShape.h"
20 #endif
21 btWorldImporter::btWorldImporter(btDynamicsWorld* world)
22 :m_dynamicsWorld(world),
23 m_verboseMode(0)
24 {
25
26 }
27
28 btWorldImporter::~btWorldImporter()
29 {
30 }
31
32 void btWorldImporter::deleteAllData()
33 {
34 int i;
35 for (i=0;i<m_allocatedConstraints.size();i++)
36 {
37 if(m_dynamicsWorld)
38 m_dynamicsWorld->removeConstraint(m_allocatedConstraints[i]);
39 delete m_allocatedConstraints[i];
40 }
41 m_allocatedConstraints.clear();
42
43
44 for (i=0;i<m_allocatedRigidBodies.size();i++)
45 {
46 if(m_dynamicsWorld)
47 m_dynamicsWorld->removeRigidBody(btRigidBody::upcast(m_allocatedRigidBodies[i]));
48 delete m_allocatedRigidBodies[i];
49 }
50
51 m_allocatedRigidBodies.clear();
52
53
54 for (i=0;i<m_allocatedCollisionShapes.size();i++)
55 {
56 delete m_allocatedCollisionShapes[i];
57 }
58 m_allocatedCollisionShapes.clear();
59
60
61 for (i=0;i<m_allocatedBvhs.size();i++)
62 {
63 delete m_allocatedBvhs[i];
64 }
65 m_allocatedBvhs.clear();
66
67 for (i=0;i<m_allocatedTriangleInfoMaps.size();i++)
68 {
69 delete m_allocatedTriangleInfoMaps[i];
70 }
71 m_allocatedTriangleInfoMaps.clear();
72 for (i=0;i<m_allocatedTriangleIndexArrays.size();i++)
73 {
74 delete m_allocatedTriangleIndexArrays[i];
75 }
76 m_allocatedTriangleIndexArrays.clear();
77 for (i=0;i<m_allocatedNames.size();i++)
78 {
79 delete[] m_allocatedNames[i];
80 }
81 m_allocatedNames.clear();
82
83 for (i=0;i<m_allocatedbtStridingMeshInterfaceDatas.size();i++)
84 {
85 btStridingMeshInterfaceData* curData = m_allocatedbtStridingMeshInterfaceDatas[i];
86
87 for(int a = 0;a < curData->m_numMeshParts;a++)
88 {
89 btMeshPartData* curPart = &curData->m_meshPartsPtr[a];
90 if(curPart->m_vertices3f)
91 delete [] curPart->m_vertices3f;
92
93 if(curPart->m_vertices3d)
94 delete [] curPart->m_vertices3d;
95
96 if(curPart->m_indices32)
97 delete [] curPart->m_indices32;
98
99 if(curPart->m_3indices16)
100 delete [] curPart->m_3indices16;
101
102 if(curPart->m_indices16)
103 delete [] curPart->m_indices16;
104
105 if (curPart->m_3indices8)
106 delete [] curPart->m_3indices8;
107
108 }
109 delete [] curData->m_meshPartsPtr;
110 delete curData;
111 }
112 m_allocatedbtStridingMeshInterfaceDatas.clear();
113
114 for (i=0;i<m_indexArrays.size();i++)
115 {
116 btAlignedFree(m_indexArrays[i]);
117 }
118 m_indexArrays.clear();
119
120 for (i=0;i<m_shortIndexArrays.size();i++)
121 {
122 btAlignedFree(m_shortIndexArrays[i]);
123 }
124 m_shortIndexArrays.clear();
125
126 for (i=0;i<m_charIndexArrays.size();i++)
127 {
128 btAlignedFree(m_charIndexArrays[i]);
129 }
130 m_charIndexArrays.clear();
131
132 for (i=0;i<m_floatVertexArrays.size();i++)
133 {
134 btAlignedFree(m_floatVertexArrays[i]);
135 }
136 m_floatVertexArrays.clear();
137
138 for (i=0;i<m_doubleVertexArrays.size();i++)
139 {
140 btAlignedFree(m_doubleVertexArrays[i]);
141 }
142 m_doubleVertexArrays.clear();
143
144
145 }
146
147
148
149 btCollisionShape* btWorldImporter::convertCollisionShape( btCollisionShapeData* shapeData )
150 {
151 btCollisionShape* shape = 0;
152
153 switch (shapeData->m_shapeType)
154 {
155 case STATIC_PLANE_PROXYTYPE:
156 {
157 btStaticPlaneShapeData* planeData = (btStaticPlaneShapeData*)shapeData;
158 btVector3 planeNormal,localScaling;
159 planeNormal.deSerializeFloat(planeData->m_planeNormal);
160 localScaling.deSerializeFloat(planeData->m_localScaling);
161 shape = createPlaneShape(planeNormal,planeData->m_planeConstant);
162 shape->setLocalScaling(localScaling);
163
164 break;
165 }
166 case SCALED_TRIANGLE_MESH_SHAPE_PROXYTYPE:
167 {
168 btScaledTriangleMeshShapeData* scaledMesh = (btScaledTriangleMeshShapeData*) shapeData;
169 btCollisionShapeData* colShapeData = (btCollisionShapeData*) &scaledMesh->m_trimeshShapeData;
170 colShapeData->m_shapeType = TRIANGLE_MESH_SHAPE_PROXYTYPE;
171 btCollisionShape* childShape = convertCollisionShape(colShapeData);
172 btBvhTriangleMeshShape* meshShape = (btBvhTriangleMeshShape*)childShape;
173 btVector3 localScaling;
174 localScaling.deSerializeFloat(scaledMesh->m_localScaling);
175
176 shape = createScaledTrangleMeshShape(meshShape, localScaling);
177 break;
178 }
179 case GIMPACT_SHAPE_PROXYTYPE:
180 {
181 #ifdef USE_GIMPACT
182 btGImpactMeshShapeData* gimpactData = (btGImpactMeshShapeData*) shapeData;
183 if (gimpactData->m_gimpactSubType == CONST_GIMPACT_TRIMESH_SHAPE)
184 {
185 btStridingMeshInterfaceData* interfaceData = createStridingMeshInterfaceData(&gimpactData->m_meshInterface);
186 btTriangleIndexVertexArray* meshInterface = createMeshInterface(*interfaceData);
187
188
189 btGImpactMeshShape* gimpactShape = createGimpactShape(meshInterface);
190 btVector3 localScaling;
191 localScaling.deSerializeFloat(gimpactData->m_localScaling);
192 gimpactShape->setLocalScaling(localScaling);
193 gimpactShape->setMargin(btScalar(gimpactData->m_collisionMargin));
194 gimpactShape->updateBound();
195 shape = gimpactShape;
196 } else
197 {
198 printf("unsupported gimpact sub type\n");
199 }
200 #endif//USE_GIMPACT
201 break;
202 }
203 //The btCapsuleShape* API has issue passing the margin/scaling/halfextents unmodified through the API
204 //so deal with this
205 case CAPSULE_SHAPE_PROXYTYPE:
206 {
207 btCapsuleShapeData* capData = (btCapsuleShapeData*)shapeData;
208
209
210 switch (capData->m_upAxis)
211 {
212 case 0:
213 {
214 shape = createCapsuleShapeX(1,1);
215 break;
216 }
217 case 1:
218 {
219 shape = createCapsuleShapeY(1,1);
220 break;
221 }
222 case 2:
223 {
224 shape = createCapsuleShapeZ(1,1);
225 break;
226 }
227 default:
228 {
229 printf("error: wrong up axis for btCapsuleShape\n");
230 }
231
232
233 };
234 if (shape)
235 {
236 btCapsuleShape* cap = (btCapsuleShape*) shape;
237 cap->deSerializeFloat(capData);
238 }
239 break;
240 }
241 case CYLINDER_SHAPE_PROXYTYPE:
242 case CONE_SHAPE_PROXYTYPE:
243 case BOX_SHAPE_PROXYTYPE:
244 case SPHERE_SHAPE_PROXYTYPE:
245 case MULTI_SPHERE_SHAPE_PROXYTYPE:
246 case CONVEX_HULL_SHAPE_PROXYTYPE:
247 {
248 btConvexInternalShapeData* bsd = (btConvexInternalShapeData*)shapeData;
249 btVector3 implicitShapeDimensions;
250 implicitShapeDimensions.deSerializeFloat(bsd->m_implicitShapeDimensions);
251 btVector3 localScaling;
252 localScaling.deSerializeFloat(bsd->m_localScaling);
253 btVector3 margin(bsd->m_collisionMargin,bsd->m_collisionMargin,bsd->m_collisionMargin);
254 switch (shapeData->m_shapeType)
255 {
256 case BOX_SHAPE_PROXYTYPE:
257 {
258 btBoxShape* box= (btBoxShape*)createBoxShape(implicitShapeDimensions/localScaling+margin);
259 //box->initializePolyhedralFeatures();
260 shape = box;
261
262 break;
263 }
264 case SPHERE_SHAPE_PROXYTYPE:
265 {
266 shape = createSphereShape(implicitShapeDimensions.getX());
267 break;
268 }
269
270 case CYLINDER_SHAPE_PROXYTYPE:
271 {
272 btCylinderShapeData* cylData = (btCylinderShapeData*) shapeData;
273 btVector3 halfExtents = implicitShapeDimensions+margin;
274 switch (cylData->m_upAxis)
275 {
276 case 0:
277 {
278 shape = createCylinderShapeX(halfExtents.getY(),halfExtents.getX());
279 break;
280 }
281 case 1:
282 {
283 shape = createCylinderShapeY(halfExtents.getX(),halfExtents.getY());
284 break;
285 }
286 case 2:
287 {
288 shape = createCylinderShapeZ(halfExtents.getX(),halfExtents.getZ());
289 break;
290 }
291 default:
292 {
293 printf("unknown Cylinder up axis\n");
294 }
295
296 };
297
298
299
300 break;
301 }
302 case CONE_SHAPE_PROXYTYPE:
303 {
304 btConeShapeData* conData = (btConeShapeData*) shapeData;
305 btVector3 halfExtents = implicitShapeDimensions;//+margin;
306 switch (conData->m_upIndex)
307 {
308 case 0:
309 {
310 shape = createConeShapeX(halfExtents.getY(),halfExtents.getX());
311 break;
312 }
313 case 1:
314 {
315 shape = createConeShapeY(halfExtents.getX(),halfExtents.getY());
316 break;
317 }
318 case 2:
319 {
320 shape = createConeShapeZ(halfExtents.getX(),halfExtents.getZ());
321 break;
322 }
323 default:
324 {
325 printf("unknown Cone up axis\n");
326 }
327
328 };
329
330
331
332 break;
333 }
334 case MULTI_SPHERE_SHAPE_PROXYTYPE:
335 {
336 btMultiSphereShapeData* mss = (btMultiSphereShapeData*)bsd;
337 int numSpheres = mss->m_localPositionArraySize;
338
339 btAlignedObjectArray<btVector3> tmpPos;
340 btAlignedObjectArray<btScalar> radii;
341 radii.resize(numSpheres);
342 tmpPos.resize(numSpheres);
343 int i;
344 for ( i=0;i<numSpheres;i++)
345 {
346 tmpPos[i].deSerializeFloat(mss->m_localPositionArrayPtr[i].m_pos);
347 radii[i] = mss->m_localPositionArrayPtr[i].m_radius;
348 }
349 shape = createMultiSphereShape(&tmpPos[0],&radii[0],numSpheres);
350 break;
351 }
352 case CONVEX_HULL_SHAPE_PROXYTYPE:
353 {
354 // int sz = sizeof(btConvexHullShapeData);
355 // int sz2 = sizeof(btConvexInternalShapeData);
356 // int sz3 = sizeof(btCollisionShapeData);
357 btConvexHullShapeData* convexData = (btConvexHullShapeData*)bsd;
358 int numPoints = convexData->m_numUnscaledPoints;
359
360 btAlignedObjectArray<btVector3> tmpPoints;
361 tmpPoints.resize(numPoints);
362 int i;
363 for ( i=0;i<numPoints;i++)
364 {
365 #ifdef BT_USE_DOUBLE_PRECISION
366 if (convexData->m_unscaledPointsDoublePtr)
367 tmpPoints[i].deSerialize(convexData->m_unscaledPointsDoublePtr[i]);
368 if (convexData->m_unscaledPointsFloatPtr)
369 tmpPoints[i].deSerializeFloat(convexData->m_unscaledPointsFloatPtr[i]);
370 #else
371 if (convexData->m_unscaledPointsFloatPtr)
372 tmpPoints[i].deSerialize(convexData->m_unscaledPointsFloatPtr[i]);
373 if (convexData->m_unscaledPointsDoublePtr)
374 tmpPoints[i].deSerializeDouble(convexData->m_unscaledPointsDoublePtr[i]);
375 #endif //BT_USE_DOUBLE_PRECISION
376 }
377 btConvexHullShape* hullShape = createConvexHullShape();
378 for (i=0;i<numPoints;i++)
379 {
380 hullShape->addPoint(tmpPoints[i]);
381 }
382 hullShape->setMargin(bsd->m_collisionMargin);
383 //hullShape->initializePolyhedralFeatures();
384 shape = hullShape;
385 break;
386 }
387 default:
388 {
389 printf("error: cannot create shape type (%d)\n",shapeData->m_shapeType);
390 }
391 }
392
393 if (shape)
394 {
395 shape->setMargin(bsd->m_collisionMargin);
396
397 btVector3 localScaling;
398 localScaling.deSerializeFloat(bsd->m_localScaling);
399 shape->setLocalScaling(localScaling);
400
401 }
402 break;
403 }
404 case TRIANGLE_MESH_SHAPE_PROXYTYPE:
405 {
406 btTriangleMeshShapeData* trimesh = (btTriangleMeshShapeData*)shapeData;
407 btStridingMeshInterfaceData* interfaceData = createStridingMeshInterfaceData(&trimesh->m_meshInterface);
408 btTriangleIndexVertexArray* meshInterface = createMeshInterface(*interfaceData);
409 if (!meshInterface->getNumSubParts())
410 {
411 return 0;
412 }
413
414 btVector3 scaling; scaling.deSerializeFloat(trimesh->m_meshInterface.m_scaling);
415 meshInterface->setScaling(scaling);
416
417
418 btOptimizedBvh* bvh = 0;
419 #if 1
420 if (trimesh->m_quantizedFloatBvh)
421 {
422 btOptimizedBvh** bvhPtr = m_bvhMap.find(trimesh->m_quantizedFloatBvh);
423 if (bvhPtr && *bvhPtr)
424 {
425 bvh = *bvhPtr;
426 } else
427 {
428 bvh = createOptimizedBvh();
429 bvh->deSerializeFloat(*trimesh->m_quantizedFloatBvh);
430 }
431 }
432 if (trimesh->m_quantizedDoubleBvh)
433 {
434 btOptimizedBvh** bvhPtr = m_bvhMap.find(trimesh->m_quantizedDoubleBvh);
435 if (bvhPtr && *bvhPtr)
436 {
437 bvh = *bvhPtr;
438 } else
439 {
440 bvh = createOptimizedBvh();
441 bvh->deSerializeDouble(*trimesh->m_quantizedDoubleBvh);
442 }
443 }
444 #endif
445
446
447 btBvhTriangleMeshShape* trimeshShape = createBvhTriangleMeshShape(meshInterface,bvh);
448 trimeshShape->setMargin(trimesh->m_collisionMargin);
449 shape = trimeshShape;
450
451 if (trimesh->m_triangleInfoMap)
452 {
453 btTriangleInfoMap* map = createTriangleInfoMap();
454 map->deSerialize(*trimesh->m_triangleInfoMap);
455 trimeshShape->setTriangleInfoMap(map);
456
457 #ifdef USE_INTERNAL_EDGE_UTILITY
458 gContactAddedCallback = btAdjustInternalEdgeContactsCallback;
459 #endif //USE_INTERNAL_EDGE_UTILITY
460
461 }
462
463 //printf("trimesh->m_collisionMargin=%f\n",trimesh->m_collisionMargin);
464 break;
465 }
466 case COMPOUND_SHAPE_PROXYTYPE:
467 {
468 btCompoundShapeData* compoundData = (btCompoundShapeData*)shapeData;
469 btCompoundShape* compoundShape = createCompoundShape();
470
471
472 btAlignedObjectArray<btCollisionShape*> childShapes;
473 for (int i=0;i<compoundData->m_numChildShapes;i++)
474 {
475
476 btCollisionShapeData* cd = compoundData->m_childShapePtr[i].m_childShape;
477
478 btCollisionShape* childShape = convertCollisionShape(cd);
479 if (childShape)
480 {
481 btTransform localTransform;
482 localTransform.deSerializeFloat(compoundData->m_childShapePtr[i].m_transform);
483 compoundShape->addChildShape(localTransform,childShape);
484 } else
485 {
486 #ifdef _DEBUG
487 printf("error: couldn't create childShape for compoundShape\n");
488 #endif
489 }
490
491 }
492 shape = compoundShape;
493
494 break;
495 }
496 case SOFTBODY_SHAPE_PROXYTYPE:
497 {
498 return 0;
499 }
500 default:
501 {
502 #ifdef _DEBUG
503 printf("unsupported shape type (%d)\n",shapeData->m_shapeType);
504 #endif
505 }
506 }
507
508 return shape;
509
510 }
511
512
513
514 char* btWorldImporter::duplicateName(const char* name)
515 {
516 if (name)
517 {
518 int l = (int)strlen(name);
519 char* newName = new char[l+1];
520 memcpy(newName,name,l);
521 newName[l] = 0;
522 m_allocatedNames.push_back(newName);
523 return newName;
524 }
525 return 0;
526 }
527
528 void btWorldImporter::convertConstraintBackwardsCompatible281(btTypedConstraintData* constraintData, btRigidBody* rbA, btRigidBody* rbB, int fileVersion)
529 {
530
531 btTypedConstraint* constraint = 0;
532
533 switch (constraintData->m_objectType)
534 {
535 case POINT2POINT_CONSTRAINT_TYPE:
536 {
537 btPoint2PointConstraintDoubleData* p2pData = (btPoint2PointConstraintDoubleData*)constraintData;
538 if (rbA && rbB)
539 {
540 btVector3 pivotInA,pivotInB;
541 pivotInA.deSerializeDouble(p2pData->m_pivotInA);
542 pivotInB.deSerializeDouble(p2pData->m_pivotInB);
543 constraint = createPoint2PointConstraint(*rbA,*rbB,pivotInA,pivotInB);
544 } else
545 {
546 btVector3 pivotInA;
547 pivotInA.deSerializeDouble(p2pData->m_pivotInA);
548 constraint = createPoint2PointConstraint(*rbA,pivotInA);
549 }
550 break;
551 }
552 case HINGE_CONSTRAINT_TYPE:
553 {
554 btHingeConstraint* hinge = 0;
555
556 btHingeConstraintDoubleData* hingeData = (btHingeConstraintDoubleData*)constraintData;
557 if (rbA&& rbB)
558 {
559 btTransform rbAFrame,rbBFrame;
560 rbAFrame.deSerializeDouble(hingeData->m_rbAFrame);
561 rbBFrame.deSerializeDouble(hingeData->m_rbBFrame);
562 hinge = createHingeConstraint(*rbA,*rbB,rbAFrame,rbBFrame,hingeData->m_useReferenceFrameA!=0);
563 } else
564 {
565 btTransform rbAFrame;
566 rbAFrame.deSerializeDouble(hingeData->m_rbAFrame);
567 hinge = createHingeConstraint(*rbA,rbAFrame,hingeData->m_useReferenceFrameA!=0);
568 }
569 if (hingeData->m_enableAngularMotor)
570 {
571 hinge->enableAngularMotor(true,(btScalar)hingeData->m_motorTargetVelocity,(btScalar)hingeData->m_maxMotorImpulse);
572 }
573 hinge->setAngularOnly(hingeData->m_angularOnly!=0);
574 hinge->setLimit(btScalar(hingeData->m_lowerLimit),btScalar(hingeData->m_upperLimit),btScalar(hingeData->m_limitSoftness),btScalar(hingeData->m_biasFactor),btScalar(hingeData->m_relaxationFactor));
575
576 constraint = hinge;
577 break;
578
579 }
580 case CONETWIST_CONSTRAINT_TYPE:
581 {
582 btConeTwistConstraintData* coneData = (btConeTwistConstraintData*)constraintData;
583 btConeTwistConstraint* coneTwist = 0;
584
585 if (rbA&& rbB)
586 {
587 btTransform rbAFrame,rbBFrame;
588 rbAFrame.deSerializeFloat(coneData->m_rbAFrame);
589 rbBFrame.deSerializeFloat(coneData->m_rbBFrame);
590 coneTwist = createConeTwistConstraint(*rbA,*rbB,rbAFrame,rbBFrame);
591 } else
592 {
593 btTransform rbAFrame;
594 rbAFrame.deSerializeFloat(coneData->m_rbAFrame);
595 coneTwist = createConeTwistConstraint(*rbA,rbAFrame);
596 }
597 coneTwist->setLimit((btScalar)coneData->m_swingSpan1,(btScalar)coneData->m_swingSpan2,(btScalar)coneData->m_twistSpan,(btScalar)coneData->m_limitSoftness,
598 (btScalar)coneData->m_biasFactor,(btScalar)coneData->m_relaxationFactor);
599 coneTwist->setDamping((btScalar)coneData->m_damping);
600
601 constraint = coneTwist;
602 break;
603 }
604
605 case D6_SPRING_CONSTRAINT_TYPE:
606 {
607
608 btGeneric6DofSpringConstraintData* dofData = (btGeneric6DofSpringConstraintData*)constraintData;
609 // int sz = sizeof(btGeneric6DofSpringConstraintData);
610 btGeneric6DofSpringConstraint* dof = 0;
611
612 if (rbA && rbB)
613 {
614 btTransform rbAFrame,rbBFrame;
615 rbAFrame.deSerializeFloat(dofData->m_6dofData.m_rbAFrame);
616 rbBFrame.deSerializeFloat(dofData->m_6dofData.m_rbBFrame);
617 dof = createGeneric6DofSpringConstraint(*rbA,*rbB,rbAFrame,rbBFrame,dofData->m_6dofData.m_useLinearReferenceFrameA!=0);
618 } else
619 {
620 printf("Error in btWorldImporter::createGeneric6DofSpringConstraint: requires rbA && rbB\n");
621 }
622
623 if (dof)
624 {
625 btVector3 angLowerLimit,angUpperLimit, linLowerLimit,linUpperlimit;
626 angLowerLimit.deSerializeFloat(dofData->m_6dofData.m_angularLowerLimit);
627 angUpperLimit.deSerializeFloat(dofData->m_6dofData.m_angularUpperLimit);
628 linLowerLimit.deSerializeFloat(dofData->m_6dofData.m_linearLowerLimit);
629 linUpperlimit.deSerializeFloat(dofData->m_6dofData.m_linearUpperLimit);
630
631 angLowerLimit.setW(0.f);
632 dof->setAngularLowerLimit(angLowerLimit);
633 dof->setAngularUpperLimit(angUpperLimit);
634 dof->setLinearLowerLimit(linLowerLimit);
635 dof->setLinearUpperLimit(linUpperlimit);
636
637 int i;
638 if (fileVersion>280)
639 {
640 for (i=0;i<6;i++)
641 {
642 dof->setStiffness(i,(btScalar)dofData->m_springStiffness[i]);
643 dof->setEquilibriumPoint(i,(btScalar)dofData->m_equilibriumPoint[i]);
644 dof->enableSpring(i,dofData->m_springEnabled[i]!=0);
645 dof->setDamping(i,(btScalar)dofData->m_springDamping[i]);
646 }
647 }
648 }
649
650 constraint = dof;
651 break;
652
653 }
654 case D6_CONSTRAINT_TYPE:
655 {
656 btGeneric6DofConstraintData* dofData = (btGeneric6DofConstraintData*)constraintData;
657 btGeneric6DofConstraint* dof = 0;
658
659 if (rbA&& rbB)
660 {
661 btTransform rbAFrame,rbBFrame;
662 rbAFrame.deSerializeFloat(dofData->m_rbAFrame);
663 rbBFrame.deSerializeFloat(dofData->m_rbBFrame);
664 dof = createGeneric6DofConstraint(*rbA,*rbB,rbAFrame,rbBFrame,dofData->m_useLinearReferenceFrameA!=0);
665 } else
666 {
667 if (rbB)
668 {
669 btTransform rbBFrame;
670 rbBFrame.deSerializeFloat(dofData->m_rbBFrame);
671 dof = createGeneric6DofConstraint(*rbB,rbBFrame,dofData->m_useLinearReferenceFrameA!=0);
672 } else
673 {
674 printf("Error in btWorldImporter::createGeneric6DofConstraint: missing rbB\n");
675 }
676 }
677
678 if (dof)
679 {
680 btVector3 angLowerLimit,angUpperLimit, linLowerLimit,linUpperlimit;
681 angLowerLimit.deSerializeFloat(dofData->m_angularLowerLimit);
682 angUpperLimit.deSerializeFloat(dofData->m_angularUpperLimit);
683 linLowerLimit.deSerializeFloat(dofData->m_linearLowerLimit);
684 linUpperlimit.deSerializeFloat(dofData->m_linearUpperLimit);
685
686 dof->setAngularLowerLimit(angLowerLimit);
687 dof->setAngularUpperLimit(angUpperLimit);
688 dof->setLinearLowerLimit(linLowerLimit);
689 dof->setLinearUpperLimit(linUpperlimit);
690 }
691
692 constraint = dof;
693 break;
694 }
695 case SLIDER_CONSTRAINT_TYPE:
696 {
697 btSliderConstraintData* sliderData = (btSliderConstraintData*)constraintData;
698 btSliderConstraint* slider = 0;
699 if (rbA&& rbB)
700 {
701 btTransform rbAFrame,rbBFrame;
702 rbAFrame.deSerializeFloat(sliderData->m_rbAFrame);
703 rbBFrame.deSerializeFloat(sliderData->m_rbBFrame);
704 slider = createSliderConstraint(*rbA,*rbB,rbAFrame,rbBFrame,sliderData->m_useLinearReferenceFrameA!=0);
705 } else
706 {
707 btTransform rbBFrame;
708 rbBFrame.deSerializeFloat(sliderData->m_rbBFrame);
709 slider = createSliderConstraint(*rbB,rbBFrame,sliderData->m_useLinearReferenceFrameA!=0);
710 }
711 slider->setLowerLinLimit((btScalar)sliderData->m_linearLowerLimit);
712 slider->setUpperLinLimit((btScalar)sliderData->m_linearUpperLimit);
713 slider->setLowerAngLimit((btScalar)sliderData->m_angularLowerLimit);
714 slider->setUpperAngLimit((btScalar)sliderData->m_angularUpperLimit);
715 slider->setUseFrameOffset(sliderData->m_useOffsetForConstraintFrame!=0);
716 constraint = slider;
717 break;
718 }
719
720 default:
721 {
722 printf("unknown constraint type\n");
723 }
724 };
725
726 if (constraint)
727 {
728 constraint->setDbgDrawSize((btScalar)constraintData->m_dbgDrawSize);
730 if (fileVersion>=280)
731 {
732 constraint->setBreakingImpulseThreshold((btScalar)constraintData->m_breakingImpulseThreshold);
733 constraint->setEnabled(constraintData->m_isEnabled!=0);
734 constraint->setOverrideNumSolverIterations(constraintData->m_overrideNumSolverIterations);
735 }
736
737 if (constraintData->m_name)
738 {
739 char* newname = duplicateName(constraintData->m_name);
740 m_nameConstraintMap.insert(newname,constraint);
741 m_objectNameMap.insert(constraint,newname);
742 }
743 if(m_dynamicsWorld)
744 m_dynamicsWorld->addConstraint(constraint,constraintData->m_disableCollisionsBetweenLinkedBodies!=0);
745 }
746
747 }
748
749 void btWorldImporter::convertConstraintFloat(btTypedConstraintFloatData* constraintData, btRigidBody* rbA, btRigidBody* rbB, int fileVersion)
750 {
751 btTypedConstraint* constraint = 0;
752
753 switch (constraintData->m_objectType)
754 {
755 case POINT2POINT_CONSTRAINT_TYPE:
756 {
757 btPoint2PointConstraintFloatData* p2pData = (btPoint2PointConstraintFloatData*)constraintData;
758 if (rbA&& rbB)
759 {
760 btVector3 pivotInA,pivotInB;
761 pivotInA.deSerializeFloat(p2pData->m_pivotInA);
762 pivotInB.deSerializeFloat(p2pData->m_pivotInB);
763 constraint = createPoint2PointConstraint(*rbA,*rbB,pivotInA,pivotInB);
764
765 } else
766 {
767 btVector3 pivotInA;
768 pivotInA.deSerializeFloat(p2pData->m_pivotInA);
769 constraint = createPoint2PointConstraint(*rbA,pivotInA);
770 }
771 break;
772 }
773 case HINGE_CONSTRAINT_TYPE:
774 {
775 btHingeConstraint* hinge = 0;
776 btHingeConstraintFloatData* hingeData = (btHingeConstraintFloatData*)constraintData;
777 if (rbA&& rbB)
778 {
779 btTransform rbAFrame,rbBFrame;
780 rbAFrame.deSerializeFloat(hingeData->m_rbAFrame);
781 rbBFrame.deSerializeFloat(hingeData->m_rbBFrame);
782 hinge = createHingeConstraint(*rbA,*rbB,rbAFrame,rbBFrame,hingeData->m_useReferenceFrameA!=0);
783 } else
784 {
785 btTransform rbAFrame;
786 rbAFrame.deSerializeFloat(hingeData->m_rbAFrame);
787 hinge = createHingeConstraint(*rbA,rbAFrame,hingeData->m_useReferenceFrameA!=0);
788 }
789 if (hingeData->m_enableAngularMotor)
790 {
791 hinge->enableAngularMotor(true,hingeData->m_motorTargetVelocity,hingeData->m_maxMotorImpulse);
792 }
793 hinge->setAngularOnly(hingeData->m_angularOnly!=0);
794 hinge->setLimit(btScalar(hingeData->m_lowerLimit),btScalar(hingeData->m_upperLimit),btScalar(hingeData->m_limitSoftness),btScalar(hingeData->m_biasFactor),btScalar(hingeData->m_relaxationFactor));
795
796 constraint = hinge;
797 break;
798
799 }
800 case CONETWIST_CONSTRAINT_TYPE:
801 {
802 btConeTwistConstraintData* coneData = (btConeTwistConstraintData*)constraintData;
803 btConeTwistConstraint* coneTwist = 0;
804
805 if (rbA&& rbB)
806 {
807 btTransform rbAFrame,rbBFrame;
808 rbAFrame.deSerializeFloat(coneData->m_rbAFrame);
809 rbBFrame.deSerializeFloat(coneData->m_rbBFrame);
810 coneTwist = createConeTwistConstraint(*rbA,*rbB,rbAFrame,rbBFrame);
811 } else
812 {
813 btTransform rbAFrame;
814 rbAFrame.deSerializeFloat(coneData->m_rbAFrame);
815 coneTwist = createConeTwistConstraint(*rbA,rbAFrame);
816 }
817 coneTwist->setLimit(coneData->m_swingSpan1,coneData->m_swingSpan2,coneData->m_twistSpan,coneData->m_limitSoftness,coneData->m_biasFactor,coneData->m_relaxationFactor);
818 coneTwist->setDamping(coneData->m_damping);
819
820 constraint = coneTwist;
821 break;
822 }
823
824 case D6_SPRING_CONSTRAINT_TYPE:
825 {
826
827 btGeneric6DofSpringConstraintData* dofData = (btGeneric6DofSpringConstraintData*)constraintData;
828 // int sz = sizeof(btGeneric6DofSpringConstraintData);
829 btGeneric6DofSpringConstraint* dof = 0;
830
831 if (rbA && rbB)
832 {
833 btTransform rbAFrame,rbBFrame;
834 rbAFrame.deSerializeFloat(dofData->m_6dofData.m_rbAFrame);
835 rbBFrame.deSerializeFloat(dofData->m_6dofData.m_rbBFrame);
836 dof = createGeneric6DofSpringConstraint(*rbA,*rbB,rbAFrame,rbBFrame,dofData->m_6dofData.m_useLinearReferenceFrameA!=0);
837 } else
838 {
839 printf("Error in btWorldImporter::createGeneric6DofSpringConstraint: requires rbA && rbB\n");
840 }
841
842 if (dof)
843 {
844 btVector3 angLowerLimit,angUpperLimit, linLowerLimit,linUpperlimit;
845 angLowerLimit.deSerializeFloat(dofData->m_6dofData.m_angularLowerLimit);
846 angUpperLimit.deSerializeFloat(dofData->m_6dofData.m_angularUpperLimit);
847 linLowerLimit.deSerializeFloat(dofData->m_6dofData.m_linearLowerLimit);
848 linUpperlimit.deSerializeFloat(dofData->m_6dofData.m_linearUpperLimit);
849
850 angLowerLimit.setW(0.f);
851 dof->setAngularLowerLimit(angLowerLimit);
852 dof->setAngularUpperLimit(angUpperLimit);
853 dof->setLinearLowerLimit(linLowerLimit);
854 dof->setLinearUpperLimit(linUpperlimit);
855
856 int i;
857 if (fileVersion>280)
858 {
859 for (i=0;i<6;i++)
860 {
861 dof->setStiffness(i,dofData->m_springStiffness[i]);
862 dof->setEquilibriumPoint(i,dofData->m_equilibriumPoint[i]);
863 dof->enableSpring(i,dofData->m_springEnabled[i]!=0);
864 dof->setDamping(i,dofData->m_springDamping[i]);
865 }
866 }
867 }
868
869 constraint = dof;
870 break;
871 }
872 case D6_CONSTRAINT_TYPE:
873 {
874 btGeneric6DofConstraintData* dofData = (btGeneric6DofConstraintData*)constraintData;
875 btGeneric6DofConstraint* dof = 0;
876
877 if (rbA&& rbB)
878 {
879 btTransform rbAFrame,rbBFrame;
880 rbAFrame.deSerializeFloat(dofData->m_rbAFrame);
881 rbBFrame.deSerializeFloat(dofData->m_rbBFrame);
882 dof = createGeneric6DofConstraint(*rbA,*rbB,rbAFrame,rbBFrame,dofData->m_useLinearReferenceFrameA!=0);
883 } else
884 {
885 if (rbB)
886 {
887 btTransform rbBFrame;
888 rbBFrame.deSerializeFloat(dofData->m_rbBFrame);
889 dof = createGeneric6DofConstraint(*rbB,rbBFrame,dofData->m_useLinearReferenceFrameA!=0);
890 } else
891 {
892 printf("Error in btWorldImporter::createGeneric6DofConstraint: missing rbB\n");
893 }
894 }
895
896 if (dof)
897 {
898 btVector3 angLowerLimit,angUpperLimit, linLowerLimit,linUpperlimit;
899 angLowerLimit.deSerializeFloat(dofData->m_angularLowerLimit);
900 angUpperLimit.deSerializeFloat(dofData->m_angularUpperLimit);
901 linLowerLimit.deSerializeFloat(dofData->m_linearLowerLimit);
902 linUpperlimit.deSerializeFloat(dofData->m_linearUpperLimit);
903
904 dof->setAngularLowerLimit(angLowerLimit);
905 dof->setAngularUpperLimit(angUpperLimit);
906 dof->setLinearLowerLimit(linLowerLimit);
907 dof->setLinearUpperLimit(linUpperlimit);
908 }
909
910 constraint = dof;
911 break;
912 }
913 case SLIDER_CONSTRAINT_TYPE:
914 {
915 btSliderConstraintData* sliderData = (btSliderConstraintData*)constraintData;
916 btSliderConstraint* slider = 0;
917 if (rbA&& rbB)
918 {
919 btTransform rbAFrame,rbBFrame;
920 rbAFrame.deSerializeFloat(sliderData->m_rbAFrame);
921 rbBFrame.deSerializeFloat(sliderData->m_rbBFrame);
922 slider = createSliderConstraint(*rbA,*rbB,rbAFrame,rbBFrame,sliderData->m_useLinearReferenceFrameA!=0);
923 } else
924 {
925 btTransform rbBFrame;
926 rbBFrame.deSerializeFloat(sliderData->m_rbBFrame);
927 slider = createSliderConstraint(*rbB,rbBFrame,sliderData->m_useLinearReferenceFrameA!=0);
928 }
929 slider->setLowerLinLimit(sliderData->m_linearLowerLimit);
930 slider->setUpperLinLimit(sliderData->m_linearUpperLimit);
931 slider->setLowerAngLimit(sliderData->m_angularLowerLimit);
932 slider->setUpperAngLimit(sliderData->m_angularUpperLimit);
933 slider->setUseFrameOffset(sliderData->m_useOffsetForConstraintFrame!=0);
934 constraint = slider;
935 break;
936 }
937 case GEAR_CONSTRAINT_TYPE:
938 {
939 btGearConstraintFloatData* gearData = (btGearConstraintFloatData*) constraintData;
940 btGearConstraint* gear = 0;
941 if (rbA&&rbB)
942 {
943 btVector3 axisInA,axisInB;
944 axisInA.deSerializeFloat(gearData->m_axisInA);
945 axisInB.deSerializeFloat(gearData->m_axisInB);
946 gear = createGearConstraint(*rbA, *rbB, axisInA,axisInB, gearData->m_ratio);
947 } else
948 {
949 btAssert(0);
950 //perhaps a gear against a 'fixed' body, while the 'fixed' body is not serialized?
951 //btGearConstraint(btRigidBody& rbA, btRigidBody& rbB, const btVector3& axisInA,const btVector3& axisInB, btScalar ratio=1.f);
952 }
953 constraint = gear;
954 break;
955 }
956 case D6_SPRING_2_CONSTRAINT_TYPE:
957 {
958
959 btGeneric6DofSpring2ConstraintData* dofData = (btGeneric6DofSpring2ConstraintData*)constraintData;
960
961 btGeneric6DofSpring2Constraint* dof = 0;
962
963 if (rbA && rbB)
964 {
965 btTransform rbAFrame,rbBFrame;
966 rbAFrame.deSerializeFloat(dofData->m_rbAFrame);
967 rbBFrame.deSerializeFloat(dofData->m_rbBFrame);
968 dof = createGeneric6DofSpring2Constraint(*rbA,*rbB,rbAFrame,rbBFrame, dofData->m_rotateOrder);
969 } else
970 {
971 printf("Error in btWorldImporter::createGeneric6DofSpring2Constraint: requires rbA && rbB\n");
972 }
973
974 if (dof)
975 {
976 btVector3 angLowerLimit,angUpperLimit, linLowerLimit,linUpperlimit;
977 angLowerLimit.deSerializeFloat(dofData->m_angularLowerLimit);
978 angUpperLimit.deSerializeFloat(dofData->m_angularUpperLimit);
979 linLowerLimit.deSerializeFloat(dofData->m_linearLowerLimit);
980 linUpperlimit.deSerializeFloat(dofData->m_linearUpperLimit);
981
982 angLowerLimit.setW(0.f);
983 dof->setAngularLowerLimit(angLowerLimit);
984 dof->setAngularUpperLimit(angUpperLimit);
985 dof->setLinearLowerLimit(linLowerLimit);
986 dof->setLinearUpperLimit(linUpperlimit);
987
988 int i;
989 if (fileVersion>280)
990 {
991 //6-dof: 3 linear followed by 3 angular
992 for (i=0;i<3;i++)
993 {
994 dof->setStiffness(i,dofData->m_linearSpringStiffness.m_floats[i],dofData->m_linearSpringStiffnessLimited[i]!=0);
995 dof->setEquilibriumPoint(i,dofData->m_linearEquilibriumPoint.m_floats[i]);
996 dof->enableSpring(i,dofData->m_linearEnableSpring[i]!=0);
997 dof->setDamping(i,dofData->m_linearSpringDamping.m_floats[i],(dofData->m_linearSpringDampingLimited[i]!=0));
998 }
999 for (i=0;i<3;i++)
1000 {
1001 dof->setStiffness(i+3,dofData->m_angularSpringStiffness.m_floats[i],(dofData->m_angularSpringStiffnessLimited[i]!=0));
1002 dof->setEquilibriumPoint(i+3,dofData->m_angularEquilibriumPoint.m_floats[i]);
1003 dof->enableSpring(i+3,dofData->m_angularEnableSpring[i]!=0);
1004 dof->setDamping(i+3,dofData->m_angularSpringDamping.m_floats[i],dofData->m_angularSpringDampingLimited[i]);
1005 }
1006
1007 }
1008 }
1009
1010 constraint = dof;
1011 break;
1012
1013 }
1014 case FIXED_CONSTRAINT_TYPE:
1015 {
1016
1017 btGeneric6DofSpring2Constraint* dof = 0;
1018 if (rbA && rbB)
1019 {
1020 btTransform rbAFrame,rbBFrame;
1021 //compute a shared world frame, and compute frameInA, frameInB relative to this
1022 btTransform sharedFrame;
1023 sharedFrame.setIdentity();
1024 btVector3 centerPos = btScalar(0.5)*(rbA->getWorldTransform().getOrigin()+
1025 rbB->getWorldTransform().getOrigin());
1026 sharedFrame.setOrigin(centerPos);
1027 rbAFrame = rbA->getWorldTransform().inverse()*sharedFrame;
1028 rbBFrame = rbB->getWorldTransform().inverse()*sharedFrame;
1029
1030
1031 dof = createGeneric6DofSpring2Constraint(*rbA,*rbB,rbAFrame,rbBFrame, RO_XYZ);
1032 dof->setLinearUpperLimit(btVector3(0,0,0));
1033 dof->setLinearLowerLimit(btVector3(0,0,0));
1034 dof->setAngularUpperLimit(btVector3(0,0,0));
1035 dof->setAngularLowerLimit(btVector3(0,0,0));
1036
1037 } else
1038 {
1039 printf("Error in btWorldImporter::createGeneric6DofSpring2Constraint: requires rbA && rbB\n");
1040 }
1041
1042 constraint = dof;
1043 break;
1044 }
1045 default:
1046 {
1047 printf("unknown constraint type\n");
1048 }
1049 };
1050
1051 if (constraint)
1052 {
1053 constraint->setDbgDrawSize(constraintData->m_dbgDrawSize);
1055 if (fileVersion>=280)
1056 {
1057 constraint->setBreakingImpulseThreshold(constraintData->m_breakingImpulseThreshold);
1058 constraint->setEnabled(constraintData->m_isEnabled!=0);
1059 constraint->setOverrideNumSolverIterations(constraintData->m_overrideNumSolverIterations);
1060 }
1061
1062 if (constraintData->m_name)
1063 {
1064 char* newname = duplicateName(constraintData->m_name);
1065 m_nameConstraintMap.insert(newname,constraint);
1066 m_objectNameMap.insert(constraint,newname);
1067 }
1068 if(m_dynamicsWorld)
1069 m_dynamicsWorld->addConstraint(constraint,constraintData->m_disableCollisionsBetweenLinkedBodies!=0);
1070 }
1071
1072
1073 }
1074
1075
1076
1077 void btWorldImporter::convertConstraintDouble(btTypedConstraintDoubleData* constraintData, btRigidBody* rbA, btRigidBody* rbB, int fileVersion)
1078 {
1079 btTypedConstraint* constraint = 0;
1080
1081 switch (constraintData->m_objectType)
1082 {
1083 case POINT2POINT_CONSTRAINT_TYPE:
1084 {
1085 btPoint2PointConstraintDoubleData2* p2pData = (btPoint2PointConstraintDoubleData2*)constraintData;
1086 if (rbA && rbB)
1087 {
1088 btVector3 pivotInA,pivotInB;
1089 pivotInA.deSerializeDouble(p2pData->m_pivotInA);
1090 pivotInB.deSerializeDouble(p2pData->m_pivotInB);
1091 constraint = createPoint2PointConstraint(*rbA,*rbB,pivotInA,pivotInB);
1092 } else
1093 {
1094 btVector3 pivotInA;
1095 pivotInA.deSerializeDouble(p2pData->m_pivotInA);
1096 constraint = createPoint2PointConstraint(*rbA,pivotInA);
1097 }
1098 break;
1099 }
1100 case HINGE_CONSTRAINT_TYPE:
1101 {
1102 btHingeConstraint* hinge = 0;
1103
1104 btHingeConstraintDoubleData2* hingeData = (btHingeConstraintDoubleData2*)constraintData;
1105 if (rbA&& rbB)
1106 {
1107 btTransform rbAFrame,rbBFrame;
1108 rbAFrame.deSerializeDouble(hingeData->m_rbAFrame);
1109 rbBFrame.deSerializeDouble(hingeData->m_rbBFrame);
1110 hinge = createHingeConstraint(*rbA,*rbB,rbAFrame,rbBFrame,hingeData->m_useReferenceFrameA!=0);
1111 } else
1112 {
1113 btTransform rbAFrame;
1114 rbAFrame.deSerializeDouble(hingeData->m_rbAFrame);
1115 hinge = createHingeConstraint(*rbA,rbAFrame,hingeData->m_useReferenceFrameA!=0);
1116 }
1117 if (hingeData->m_enableAngularMotor)
1118 {
1119 hinge->enableAngularMotor(true,(btScalar)hingeData->m_motorTargetVelocity,(btScalar)hingeData->m_maxMotorImpulse);
1120 }
1121 hinge->setAngularOnly(hingeData->m_angularOnly!=0);
1122 hinge->setLimit(btScalar(hingeData->m_lowerLimit),btScalar(hingeData->m_upperLimit),btScalar(hingeData->m_limitSoftness),btScalar(hingeData->m_biasFactor),btScalar(hingeData->m_relaxationFactor));
1123
1124 constraint = hinge;
1125 break;
1126
1127 }
1128 case CONETWIST_CONSTRAINT_TYPE:
1129 {
1130 btConeTwistConstraintDoubleData* coneData = (btConeTwistConstraintDoubleData*)constraintData;
1131 btConeTwistConstraint* coneTwist = 0;
1132
1133 if (rbA&& rbB)
1134 {
1135 btTransform rbAFrame,rbBFrame;
1136 rbAFrame.deSerializeDouble(coneData->m_rbAFrame);
1137 rbBFrame.deSerializeDouble(coneData->m_rbBFrame);
1138 coneTwist = createConeTwistConstraint(*rbA,*rbB,rbAFrame,rbBFrame);
1139 } else
1140 {
1141 btTransform rbAFrame;
1142 rbAFrame.deSerializeDouble(coneData->m_rbAFrame);
1143 coneTwist = createConeTwistConstraint(*rbA,rbAFrame);
1144 }
1145 coneTwist->setLimit((btScalar)coneData->m_swingSpan1,(btScalar)coneData->m_swingSpan2,(btScalar)coneData->m_twistSpan,(btScalar)coneData->m_limitSoftness,
1146 (btScalar)coneData->m_biasFactor,(btScalar)coneData->m_relaxationFactor);
1147 coneTwist->setDamping((btScalar)coneData->m_damping);
1148
1149 constraint = coneTwist;
1150 break;
1151 }
1152
1153 case D6_SPRING_CONSTRAINT_TYPE:
1154 {
1155
1156 btGeneric6DofSpringConstraintDoubleData2* dofData = (btGeneric6DofSpringConstraintDoubleData2*)constraintData;
1157 // int sz = sizeof(btGeneric6DofSpringConstraintData);
1158 btGeneric6DofSpringConstraint* dof = 0;
1159
1160 if (rbA && rbB)
1161 {
1162 btTransform rbAFrame,rbBFrame;
1163 rbAFrame.deSerializeDouble(dofData->m_6dofData.m_rbAFrame);
1164 rbBFrame.deSerializeDouble(dofData->m_6dofData.m_rbBFrame);
1165 dof = createGeneric6DofSpringConstraint(*rbA,*rbB,rbAFrame,rbBFrame,dofData->m_6dofData.m_useLinearReferenceFrameA!=0);
1166 } else
1167 {
1168 printf("Error in btWorldImporter::createGeneric6DofSpringConstraint: requires rbA && rbB\n");
1169 }
1170
1171 if (dof)
1172 {
1173 btVector3 angLowerLimit,angUpperLimit, linLowerLimit,linUpperlimit;
1174 angLowerLimit.deSerializeDouble(dofData->m_6dofData.m_angularLowerLimit);
1175 angUpperLimit.deSerializeDouble(dofData->m_6dofData.m_angularUpperLimit);
1176 linLowerLimit.deSerializeDouble(dofData->m_6dofData.m_linearLowerLimit);
1177 linUpperlimit.deSerializeDouble(dofData->m_6dofData.m_linearUpperLimit);
1178
1179 angLowerLimit.setW(0.f);
1180 dof->setAngularLowerLimit(angLowerLimit);
1181 dof->setAngularUpperLimit(angUpperLimit);
1182 dof->setLinearLowerLimit(linLowerLimit);
1183 dof->setLinearUpperLimit(linUpperlimit);
1184
1185 int i;
1186 if (fileVersion>280)
1187 {
1188 for (i=0;i<6;i++)
1189 {
1190 dof->setStiffness(i,(btScalar)dofData->m_springStiffness[i]);
1191 dof->setEquilibriumPoint(i,(btScalar)dofData->m_equilibriumPoint[i]);
1192 dof->enableSpring(i,dofData->m_springEnabled[i]!=0);
1193 dof->setDamping(i,(btScalar)dofData->m_springDamping[i]);
1194 }
1195 }
1196 }
1197
1198 constraint = dof;
1199 break;
1200 }
1201 case D6_CONSTRAINT_TYPE:
1202 {
1203 btGeneric6DofConstraintDoubleData2* dofData = (btGeneric6DofConstraintDoubleData2*)constraintData;
1204 btGeneric6DofConstraint* dof = 0;
1205
1206 if (rbA&& rbB)
1207 {
1208 btTransform rbAFrame,rbBFrame;
1209 rbAFrame.deSerializeDouble(dofData->m_rbAFrame);
1210 rbBFrame.deSerializeDouble(dofData->m_rbBFrame);
1211 dof = createGeneric6DofConstraint(*rbA,*rbB,rbAFrame,rbBFrame,dofData->m_useLinearReferenceFrameA!=0);
1212 } else
1213 {
1214 if (rbB)
1215 {
1216 btTransform rbBFrame;
1217 rbBFrame.deSerializeDouble(dofData->m_rbBFrame);
1218 dof = createGeneric6DofConstraint(*rbB,rbBFrame,dofData->m_useLinearReferenceFrameA!=0);
1219 } else
1220 {
1221 printf("Error in btWorldImporter::createGeneric6DofConstraint: missing rbB\n");
1222 }
1223 }
1224
1225 if (dof)
1226 {
1227 btVector3 angLowerLimit,angUpperLimit, linLowerLimit,linUpperlimit;
1228 angLowerLimit.deSerializeDouble(dofData->m_angularLowerLimit);
1229 angUpperLimit.deSerializeDouble(dofData->m_angularUpperLimit);
1230 linLowerLimit.deSerializeDouble(dofData->m_linearLowerLimit);
1231 linUpperlimit.deSerializeDouble(dofData->m_linearUpperLimit);
1232
1233 dof->setAngularLowerLimit(angLowerLimit);
1234 dof->setAngularUpperLimit(angUpperLimit);
1235 dof->setLinearLowerLimit(linLowerLimit);
1236 dof->setLinearUpperLimit(linUpperlimit);
1237 }
1238
1239 constraint = dof;
1240 break;
1241 }
1242 case SLIDER_CONSTRAINT_TYPE:
1243 {
1244 btSliderConstraintDoubleData* sliderData = (btSliderConstraintDoubleData*)constraintData;
1245 btSliderConstraint* slider = 0;
1246 if (rbA&& rbB)
1247 {
1248 btTransform rbAFrame,rbBFrame;
1249 rbAFrame.deSerializeDouble(sliderData->m_rbAFrame);
1250 rbBFrame.deSerializeDouble(sliderData->m_rbBFrame);
1251 slider = createSliderConstraint(*rbA,*rbB,rbAFrame,rbBFrame,sliderData->m_useLinearReferenceFrameA!=0);
1252 } else
1253 {
1254 btTransform rbBFrame;
1255 rbBFrame.deSerializeDouble(sliderData->m_rbBFrame);
1256 slider = createSliderConstraint(*rbB,rbBFrame,sliderData->m_useLinearReferenceFrameA!=0);
1257 }
1258 slider->setLowerLinLimit((btScalar)sliderData->m_linearLowerLimit);
1259 slider->setUpperLinLimit((btScalar)sliderData->m_linearUpperLimit);
1260 slider->setLowerAngLimit((btScalar)sliderData->m_angularLowerLimit);
1261 slider->setUpperAngLimit((btScalar)sliderData->m_angularUpperLimit);
1262 slider->setUseFrameOffset(sliderData->m_useOffsetForConstraintFrame!=0);
1263 constraint = slider;
1264 break;
1265 }
1266 case GEAR_CONSTRAINT_TYPE:
1267 {
1268 btGearConstraintDoubleData* gearData = (btGearConstraintDoubleData*) constraintData;
1269 btGearConstraint* gear = 0;
1270 if (rbA&&rbB)
1271 {
1272 btVector3 axisInA,axisInB;
1273 axisInA.deSerializeDouble(gearData->m_axisInA);
1274 axisInB.deSerializeDouble(gearData->m_axisInB);
1275 gear = createGearConstraint(*rbA, *rbB, axisInA,axisInB, gearData->m_ratio);
1276 } else
1277 {
1278 btAssert(0);
1279 //perhaps a gear against a 'fixed' body, while the 'fixed' body is not serialized?
1280 //btGearConstraint(btRigidBody& rbA, btRigidBody& rbB, const btVector3& axisInA,const btVector3& axisInB, btScalar ratio=1.f);
1281 }
1282 constraint = gear;
1283 break;
1284 }
1285
1286 case D6_SPRING_2_CONSTRAINT_TYPE:
1287 {
1288
1289 btGeneric6DofSpring2ConstraintDoubleData2* dofData = (btGeneric6DofSpring2ConstraintDoubleData2*)constraintData;
1290
1291 btGeneric6DofSpring2Constraint* dof = 0;
1292
1293 if (rbA && rbB)
1294 {
1295 btTransform rbAFrame,rbBFrame;
1296 rbAFrame.deSerializeDouble(dofData->m_rbAFrame);
1297 rbBFrame.deSerializeDouble(dofData->m_rbBFrame);
1298 dof = createGeneric6DofSpring2Constraint(*rbA,*rbB,rbAFrame,rbBFrame, dofData->m_rotateOrder);
1299 } else
1300 {
1301 printf("Error in btWorldImporter::createGeneric6DofSpring2Constraint: requires rbA && rbB\n");
1302 }
1303
1304 if (dof)
1305 {
1306 btVector3 angLowerLimit,angUpperLimit, linLowerLimit,linUpperlimit;
1307 angLowerLimit.deSerializeDouble(dofData->m_angularLowerLimit);
1308 angUpperLimit.deSerializeDouble(dofData->m_angularUpperLimit);
1309 linLowerLimit.deSerializeDouble(dofData->m_linearLowerLimit);
1310 linUpperlimit.deSerializeDouble(dofData->m_linearUpperLimit);
1311
1312 angLowerLimit.setW(0.f);
1313 dof->setAngularLowerLimit(angLowerLimit);
1314 dof->setAngularUpperLimit(angUpperLimit);
1315 dof->setLinearLowerLimit(linLowerLimit);
1316 dof->setLinearUpperLimit(linUpperlimit);
1317
1318 int i;
1319 if (fileVersion>280)
1320 {
1321 //6-dof: 3 linear followed by 3 angular
1322 for (i=0;i<3;i++)
1323 {
1324 dof->setStiffness(i,dofData->m_linearSpringStiffness.m_floats[i],dofData->m_linearSpringStiffnessLimited[i]);
1325 dof->setEquilibriumPoint(i,dofData->m_linearEquilibriumPoint.m_floats[i]);
1326 dof->enableSpring(i,dofData->m_linearEnableSpring[i]!=0);
1327 dof->setDamping(i,dofData->m_linearSpringDamping.m_floats[i],(dofData->m_linearSpringDampingLimited[i]!=0));
1328 }
1329 for (i=0;i<3;i++)
1330 {
1331 dof->setStiffness(i+3,dofData->m_angularSpringStiffness.m_floats[i],(dofData->m_angularSpringStiffnessLimited[i]!=0));
1332 dof->setEquilibriumPoint(i+3,dofData->m_angularEquilibriumPoint.m_floats[i]);
1333 dof->enableSpring(i+3,dofData->m_angularEnableSpring[i]!=0);
1334 dof->setDamping(i+3,dofData->m_angularSpringDamping.m_floats[i],(dofData->m_angularSpringDampingLimited[i]!=0));
1335 }
1336
1337 }
1338 }
1339
1340 constraint = dof;
1341 break;
1342
1343 }
1344 case FIXED_CONSTRAINT_TYPE:
1345 {
1346
1347 btGeneric6DofSpring2Constraint* dof = 0;
1348 if (rbA && rbB)
1349 {
1350 btTransform rbAFrame,rbBFrame;
1351 //compute a shared world frame, and compute frameInA, frameInB relative to this
1352 btTransform sharedFrame;
1353 sharedFrame.setIdentity();
1354 btVector3 centerPos = btScalar(0.5)*(rbA->getWorldTransform().getOrigin()+
1355 rbB->getWorldTransform().getOrigin());
1356 sharedFrame.setOrigin(centerPos);
1357 rbAFrame = rbA->getWorldTransform().inverse()*sharedFrame;
1358 rbBFrame = rbB->getWorldTransform().inverse()*sharedFrame;
1359
1360
1361 dof = createGeneric6DofSpring2Constraint(*rbA,*rbB,rbAFrame,rbBFrame, RO_XYZ);
1362 dof->setLinearUpperLimit(btVector3(0,0,0));
1363 dof->setLinearLowerLimit(btVector3(0,0,0));
1364 dof->setAngularUpperLimit(btVector3(0,0,0));
1365 dof->setAngularLowerLimit(btVector3(0,0,0));
1366
1367 } else
1368 {
1369 printf("Error in btWorldImporter::createGeneric6DofSpring2Constraint: requires rbA && rbB\n");
1370 }
1371
1372 constraint = dof;
1373 break;
1374 }
1375
1376 default:
1377 {
1378 printf("unknown constraint type\n");
1379 }
1380 };
1381
1382 if (constraint)
1383 {
1384 constraint->setDbgDrawSize((btScalar)constraintData->m_dbgDrawSize);
1386 if (fileVersion>=280)
1387 {
1388 constraint->setBreakingImpulseThreshold((btScalar)constraintData->m_breakingImpulseThreshold);
1389 constraint->setEnabled(constraintData->m_isEnabled!=0);
1390 constraint->setOverrideNumSolverIterations(constraintData->m_overrideNumSolverIterations);
1391 }
1392
1393 if (constraintData->m_name)
1394 {
1395 char* newname = duplicateName(constraintData->m_name);
1396 m_nameConstraintMap.insert(newname,constraint);
1397 m_objectNameMap.insert(constraint,newname);
1398 }
1399 if(m_dynamicsWorld)
1400 m_dynamicsWorld->addConstraint(constraint,constraintData->m_disableCollisionsBetweenLinkedBodies!=0);
1401 }
1402
1403
1404 }
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415 btTriangleIndexVertexArray* btWorldImporter::createMeshInterface(btStridingMeshInterfaceData& meshData)
1416 {
1417 btTriangleIndexVertexArray* meshInterface = createTriangleMeshContainer();
1418
1419 for (int i=0;i<meshData.m_numMeshParts;i++)
1420 {
1421 btIndexedMesh meshPart;
1422 meshPart.m_numTriangles = meshData.m_meshPartsPtr[i].m_numTriangles;
1423 meshPart.m_numVertices = meshData.m_meshPartsPtr[i].m_numVertices;
1424
1425
1426 if (meshData.m_meshPartsPtr[i].m_indices32)
1427 {
1428 meshPart.m_indexType = PHY_INTEGER;
1429 meshPart.m_triangleIndexStride = 3*sizeof(int);
1430 int* indexArray = (int*)btAlignedAlloc(sizeof(int)*3*meshPart.m_numTriangles,16);
1431 m_indexArrays.push_back(indexArray);
1432 for (int j=0;j<3*meshPart.m_numTriangles;j++)
1433 {
1434 indexArray[j] = meshData.m_meshPartsPtr[i].m_indices32[j].m_value;
1435 }
1436 meshPart.m_triangleIndexBase = (const unsigned char*)indexArray;
1437 } else
1438 {
1439 if (meshData.m_meshPartsPtr[i].m_3indices16)
1440 {
1441 meshPart.m_indexType = PHY_SHORT;
1442 meshPart.m_triangleIndexStride = sizeof(short int)*3;//sizeof(btShortIntIndexTripletData);
1443
1444 short int* indexArray = (short int*)btAlignedAlloc(sizeof(short int)*3*meshPart.m_numTriangles,16);
1445 m_shortIndexArrays.push_back(indexArray);
1446
1447 for (int j=0;j<meshPart.m_numTriangles;j++)
1448 {
1449 indexArray[3*j] = meshData.m_meshPartsPtr[i].m_3indices16[j].m_values[0];
1450 indexArray[3*j+1] = meshData.m_meshPartsPtr[i].m_3indices16[j].m_values[1];
1451 indexArray[3*j+2] = meshData.m_meshPartsPtr[i].m_3indices16[j].m_values[2];
1452 }
1453
1454 meshPart.m_triangleIndexBase = (const unsigned char*)indexArray;
1455 }
1456 if (meshData.m_meshPartsPtr[i].m_indices16)
1457 {
1458 meshPart.m_indexType = PHY_SHORT;
1459 meshPart.m_triangleIndexStride = 3*sizeof(short int);
1460 short int* indexArray = (short int*)btAlignedAlloc(sizeof(short int)*3*meshPart.m_numTriangles,16);
1461 m_shortIndexArrays.push_back(indexArray);
1462 for (int j=0;j<3*meshPart.m_numTriangles;j++)
1463 {
1464 indexArray[j] = meshData.m_meshPartsPtr[i].m_indices16[j].m_value;
1465 }
1466
1467 meshPart.m_triangleIndexBase = (const unsigned char*)indexArray;
1468 }
1469
1470 if (meshData.m_meshPartsPtr[i].m_3indices8)
1471 {
1472 meshPart.m_indexType = PHY_UCHAR;
1473 meshPart.m_triangleIndexStride = sizeof(unsigned char)*3;
1474
1475 unsigned char* indexArray = (unsigned char*)btAlignedAlloc(sizeof(unsigned char)*3*meshPart.m_numTriangles,16);
1476 m_charIndexArrays.push_back(indexArray);
1477
1478 for (int j=0;j<meshPart.m_numTriangles;j++)
1479 {
1480 indexArray[3*j] = meshData.m_meshPartsPtr[i].m_3indices8[j].m_values[0];
1481 indexArray[3*j+1] = meshData.m_meshPartsPtr[i].m_3indices8[j].m_values[1];
1482 indexArray[3*j+2] = meshData.m_meshPartsPtr[i].m_3indices8[j].m_values[2];
1483 }
1484
1485 meshPart.m_triangleIndexBase = (const unsigned char*)indexArray;
1486 }
1487 }
1488
1489 if (meshData.m_meshPartsPtr[i].m_vertices3f)
1490 {
1491 meshPart.m_vertexType = PHY_FLOAT;
1492 meshPart.m_vertexStride = sizeof(btVector3FloatData);
1493 btVector3FloatData* vertices = (btVector3FloatData*) btAlignedAlloc(sizeof(btVector3FloatData)*meshPart.m_numVertices,16);
1494 m_floatVertexArrays.push_back(vertices);
1495
1496 for (int j=0;j<meshPart.m_numVertices;j++)
1497 {
1498 vertices[j].m_floats[0] = meshData.m_meshPartsPtr[i].m_vertices3f[j].m_floats[0];
1499 vertices[j].m_floats[1] = meshData.m_meshPartsPtr[i].m_vertices3f[j].m_floats[1];
1500 vertices[j].m_floats[2] = meshData.m_meshPartsPtr[i].m_vertices3f[j].m_floats[2];
1501 vertices[j].m_floats[3] = meshData.m_meshPartsPtr[i].m_vertices3f[j].m_floats[3];
1502 }
1503 meshPart.m_vertexBase = (const unsigned char*)vertices;
1504 } else
1505 {
1506 meshPart.m_vertexType = PHY_DOUBLE;
1507 meshPart.m_vertexStride = sizeof(btVector3DoubleData);
1508
1509
1510 btVector3DoubleData* vertices = (btVector3DoubleData*) btAlignedAlloc(sizeof(btVector3DoubleData)*meshPart.m_numVertices,16);
1511 m_doubleVertexArrays.push_back(vertices);
1512
1513 for (int j=0;j<meshPart.m_numVertices;j++)
1514 {
1515 vertices[j].m_floats[0] = meshData.m_meshPartsPtr[i].m_vertices3d[j].m_floats[0];
1516 vertices[j].m_floats[1] = meshData.m_meshPartsPtr[i].m_vertices3d[j].m_floats[1];
1517 vertices[j].m_floats[2] = meshData.m_meshPartsPtr[i].m_vertices3d[j].m_floats[2];
1518 vertices[j].m_floats[3] = meshData.m_meshPartsPtr[i].m_vertices3d[j].m_floats[3];
1519 }
1520 meshPart.m_vertexBase = (const unsigned char*)vertices;
1521 }
1522
1523 if (meshPart.m_triangleIndexBase && meshPart.m_vertexBase)
1524 {
1525 meshInterface->addIndexedMesh(meshPart,meshPart.m_indexType);
1526 }
1527 }
1528
1529 return meshInterface;
1530 }
1531
1532
1533 btStridingMeshInterfaceData* btWorldImporter::createStridingMeshInterfaceData(btStridingMeshInterfaceData* interfaceData)
1534 {
1535 //create a new btStridingMeshInterfaceData that is an exact copy of shapedata and store it in the WorldImporter
1536 btStridingMeshInterfaceData* newData = new btStridingMeshInterfaceData;
1537
1538 newData->m_scaling = interfaceData->m_scaling;
1539 newData->m_numMeshParts = interfaceData->m_numMeshParts;
1540 newData->m_meshPartsPtr = new btMeshPartData[newData->m_numMeshParts];
1541
1542 for(int i = 0;i < newData->m_numMeshParts;i++)
1543 {
1544 btMeshPartData* curPart = &interfaceData->m_meshPartsPtr[i];
1545 btMeshPartData* curNewPart = &newData->m_meshPartsPtr[i];
1546
1547 curNewPart->m_numTriangles = curPart->m_numTriangles;
1548 curNewPart->m_numVertices = curPart->m_numVertices;
1549
1550 if(curPart->m_vertices3f)
1551 {
1552 curNewPart->m_vertices3f = new btVector3FloatData[curNewPart->m_numVertices];
1553 memcpy(curNewPart->m_vertices3f,curPart->m_vertices3f,sizeof(btVector3FloatData) * curNewPart->m_numVertices);
1554 }
1555 else
1556 curNewPart->m_vertices3f = NULL;
1557
1558 if(curPart->m_vertices3d)
1559 {
1560 curNewPart->m_vertices3d = new btVector3DoubleData[curNewPart->m_numVertices];
1561 memcpy(curNewPart->m_vertices3d,curPart->m_vertices3d,sizeof(btVector3DoubleData) * curNewPart->m_numVertices);
1562 }
1563 else
1564 curNewPart->m_vertices3d = NULL;
1565
1566 int numIndices = curNewPart->m_numTriangles * 3;
1569 bool uninitialized3indices8Workaround =false;
1570
1571 if(curPart->m_indices32)
1572 {
1573 uninitialized3indices8Workaround=true;
1574 curNewPart->m_indices32 = new btIntIndexData[numIndices];
1575 memcpy(curNewPart->m_indices32,curPart->m_indices32,sizeof(btIntIndexData) * numIndices);
1576 }
1577 else
1578 curNewPart->m_indices32 = NULL;
1579
1580 if(curPart->m_3indices16)
1581 {
1582 uninitialized3indices8Workaround=true;
1583 curNewPart->m_3indices16 = new btShortIntIndexTripletData[curNewPart->m_numTriangles];
1584 memcpy(curNewPart->m_3indices16,curPart->m_3indices16,sizeof(btShortIntIndexTripletData) * curNewPart->m_numTriangles);
1585 }
1586 else
1587 curNewPart->m_3indices16 = NULL;
1588
1589 if(curPart->m_indices16)
1590 {
1591 uninitialized3indices8Workaround=true;
1592 curNewPart->m_indices16 = new btShortIntIndexData[numIndices];
1593 memcpy(curNewPart->m_indices16,curPart->m_indices16,sizeof(btShortIntIndexData) * numIndices);
1594 }
1595 else
1596 curNewPart->m_indices16 = NULL;
1597
1598 if(!uninitialized3indices8Workaround && curPart->m_3indices8)
1599 {
1600 curNewPart->m_3indices8 = new btCharIndexTripletData[curNewPart->m_numTriangles];
1601 memcpy(curNewPart->m_3indices8,curPart->m_3indices8,sizeof(btCharIndexTripletData) * curNewPart->m_numTriangles);
1602 }
1603 else
1604 curNewPart->m_3indices8 = NULL;
1605
1606 }
1607
1608 m_allocatedbtStridingMeshInterfaceDatas.push_back(newData);
1609
1610 return(newData);
1611 }
1612
1613 #ifdef USE_INTERNAL_EDGE_UTILITY
1614 extern ContactAddedCallback gContactAddedCallback;
1615
1616 static bool btAdjustInternalEdgeContactsCallback(btManifoldPoint& cp, const btCollisionObject* colObj0,int partId0,int index0,const btCollisionObject* colObj1,int partId1,int index1)
1617 {
1618
1619 btAdjustInternalEdgeContacts(cp,colObj1,colObj0, partId1,index1);
1620 //btAdjustInternalEdgeContacts(cp,colObj1,colObj0, partId1,index1, BT_TRIANGLE_CONVEX_BACKFACE_MODE);
1621 //btAdjustInternalEdgeContacts(cp,colObj1,colObj0, partId1,index1, BT_TRIANGLE_CONVEX_DOUBLE_SIDED+BT_TRIANGLE_CONCAVE_DOUBLE_SIDED);
1622 return true;
1623 }
1624 #endif //USE_INTERNAL_EDGE_UTILITY
1625
1626
1627
1628
1629 btCollisionObject* btWorldImporter::createCollisionObject(const btTransform& startTransform,btCollisionShape* shape, const char* bodyName)
1630 {
1631 return createRigidBody(false,0,startTransform,shape,bodyName);
1632 }
1633
1634 void btWorldImporter::setDynamicsWorldInfo(const btVector3& gravity, const btContactSolverInfo& solverInfo)
1635 {
1636 if (m_dynamicsWorld)
1637 {
1638 m_dynamicsWorld->setGravity(gravity);
1639 m_dynamicsWorld->getSolverInfo() = solverInfo;
1640 }
1641
1642 }
1643
1644 btRigidBody* btWorldImporter::createRigidBody(bool isDynamic, btScalar mass, const btTransform& startTransform,btCollisionShape* shape,const char* bodyName)
1645 {
1646 btVector3 localInertia;
1647 localInertia.setZero();
1648
1649 if (mass)
1650 shape->calculateLocalInertia(mass,localInertia);
1651
1652 btRigidBody* body = new btRigidBody(mass,0,shape,localInertia);
1653 body->setWorldTransform(startTransform);
1654
1655 if (m_dynamicsWorld)
1656 m_dynamicsWorld->addRigidBody(body);
1657
1658 if (bodyName)
1659 {
1660 char* newname = duplicateName(bodyName);
1661 m_objectNameMap.insert(body,newname);
1662 m_nameBodyMap.insert(newname,body);
1663 }
1664 m_allocatedRigidBodies.push_back(body);
1665 return body;
1666
1667 }
1668
1669 btCollisionShape* btWorldImporter::createPlaneShape(const btVector3& planeNormal,btScalar planeConstant)
1670 {
1671 btStaticPlaneShape* shape = new btStaticPlaneShape(planeNormal,planeConstant);
1672 m_allocatedCollisionShapes.push_back(shape);
1673 return shape;
1674 }
1675 btCollisionShape* btWorldImporter::createBoxShape(const btVector3& halfExtents)
1676 {
1677 btBoxShape* shape = new btBoxShape(halfExtents);
1678 m_allocatedCollisionShapes.push_back(shape);
1679 return shape;
1680 }
1681 btCollisionShape* btWorldImporter::createSphereShape(btScalar radius)
1682 {
1683 btSphereShape* shape = new btSphereShape(radius);
1684 m_allocatedCollisionShapes.push_back(shape);
1685 return shape;
1686 }
1687
1688
1689 btCollisionShape* btWorldImporter::createCapsuleShapeX(btScalar radius, btScalar height)
1690 {
1691 btCapsuleShapeX* shape = new btCapsuleShapeX(radius,height);
1692 m_allocatedCollisionShapes.push_back(shape);
1693 return shape;
1694 }
1695
1696 btCollisionShape* btWorldImporter::createCapsuleShapeY(btScalar radius, btScalar height)
1697 {
1698 btCapsuleShape* shape = new btCapsuleShape(radius,height);
1699 m_allocatedCollisionShapes.push_back(shape);
1700 return shape;
1701 }
1702
1703 btCollisionShape* btWorldImporter::createCapsuleShapeZ(btScalar radius, btScalar height)
1704 {
1705 btCapsuleShapeZ* shape = new btCapsuleShapeZ(radius,height);
1706 m_allocatedCollisionShapes.push_back(shape);
1707 return shape;
1708 }
1709
1710 btCollisionShape* btWorldImporter::createCylinderShapeX(btScalar radius,btScalar height)
1711 {
1712 btCylinderShapeX* shape = new btCylinderShapeX(btVector3(height,radius,radius));
1713 m_allocatedCollisionShapes.push_back(shape);
1714 return shape;
1715 }
1716
1717 btCollisionShape* btWorldImporter::createCylinderShapeY(btScalar radius,btScalar height)
1718 {
1719 btCylinderShape* shape = new btCylinderShape(btVector3(radius,height,radius));
1720 m_allocatedCollisionShapes.push_back(shape);
1721 return shape;
1722 }
1723
1724 btCollisionShape* btWorldImporter::createCylinderShapeZ(btScalar radius,btScalar height)
1725 {
1726 btCylinderShapeZ* shape = new btCylinderShapeZ(btVector3(radius,radius,height));
1727 m_allocatedCollisionShapes.push_back(shape);
1728 return shape;
1729 }
1730
1731 btCollisionShape* btWorldImporter::createConeShapeX(btScalar radius,btScalar height)
1732 {
1733 btConeShapeX* shape = new btConeShapeX(radius,height);
1734 m_allocatedCollisionShapes.push_back(shape);
1735 return shape;
1736 }
1737
1738 btCollisionShape* btWorldImporter::createConeShapeY(btScalar radius,btScalar height)
1739 {
1740 btConeShape* shape = new btConeShape(radius,height);
1741 m_allocatedCollisionShapes.push_back(shape);
1742 return shape;
1743 }
1744
1745 btCollisionShape* btWorldImporter::createConeShapeZ(btScalar radius,btScalar height)
1746 {
1747 btConeShapeZ* shape = new btConeShapeZ(radius,height);
1748 m_allocatedCollisionShapes.push_back(shape);
1749 return shape;
1750 }
1751
1752 btTriangleIndexVertexArray* btWorldImporter::createTriangleMeshContainer()
1753 {
1754 btTriangleIndexVertexArray* in = new btTriangleIndexVertexArray();
1755 m_allocatedTriangleIndexArrays.push_back(in);
1756 return in;
1757 }
1758
1759 btOptimizedBvh* btWorldImporter::createOptimizedBvh()
1760 {
1761 btOptimizedBvh* bvh = new btOptimizedBvh();
1762 m_allocatedBvhs.push_back(bvh);
1763 return bvh;
1764 }
1765
1766
1767 btTriangleInfoMap* btWorldImporter::createTriangleInfoMap()
1768 {
1769 btTriangleInfoMap* tim = new btTriangleInfoMap();
1770 m_allocatedTriangleInfoMaps.push_back(tim);
1771 return tim;
1772 }
1773
1774 btBvhTriangleMeshShape* btWorldImporter::createBvhTriangleMeshShape(btStridingMeshInterface* trimesh, btOptimizedBvh* bvh)
1775 {
1776 if (bvh)
1777 {
1778 btBvhTriangleMeshShape* bvhTriMesh = new btBvhTriangleMeshShape(trimesh,bvh->isQuantized(), false);
1779 bvhTriMesh->setOptimizedBvh(bvh);
1780 m_allocatedCollisionShapes.push_back(bvhTriMesh);
1781 return bvhTriMesh;
1782 }
1783
1784 btBvhTriangleMeshShape* ts = new btBvhTriangleMeshShape(trimesh,true);
1785 m_allocatedCollisionShapes.push_back(ts);
1786 return ts;
1787
1788 }
1789 btCollisionShape* btWorldImporter::createConvexTriangleMeshShape(btStridingMeshInterface* trimesh)
1790 {
1791 return 0;
1792 }
1793 btGImpactMeshShape* btWorldImporter::createGimpactShape(btStridingMeshInterface* trimesh)
1794 {
1795 #ifdef USE_GIMPACT
1796 btGImpactMeshShape* shape = new btGImpactMeshShape(trimesh);
1797 m_allocatedCollisionShapes.push_back(shape);
1798 return shape;
1799 #else
1800 return 0;
1801 #endif
1802
1803 }
1804 btConvexHullShape* btWorldImporter::createConvexHullShape()
1805 {
1806 btConvexHullShape* shape = new btConvexHullShape();
1807 m_allocatedCollisionShapes.push_back(shape);
1808 return shape;
1809 }
1810
1811 btCompoundShape* btWorldImporter::createCompoundShape()
1812 {
1813 btCompoundShape* shape = new btCompoundShape();
1814 m_allocatedCollisionShapes.push_back(shape);
1815 return shape;
1816 }
1817
1818
1819 btScaledBvhTriangleMeshShape* btWorldImporter::createScaledTrangleMeshShape(btBvhTriangleMeshShape* meshShape,const btVector3& localScaling)
1820 {
1821 btScaledBvhTriangleMeshShape* shape = new btScaledBvhTriangleMeshShape(meshShape,localScaling);
1822 m_allocatedCollisionShapes.push_back(shape);
1823 return shape;
1824 }
1825
1826 btMultiSphereShape* btWorldImporter::createMultiSphereShape(const btVector3* positions,const btScalar* radi,int numSpheres)
1827 {
1828 btMultiSphereShape* shape = new btMultiSphereShape(positions, radi, numSpheres);
1829 m_allocatedCollisionShapes.push_back(shape);
1830 return shape;
1831 }
1832
1833 btRigidBody& btWorldImporter::getFixedBody()
1834 {
1835 static btRigidBody s_fixed(0, 0,0);
1836 s_fixed.setMassProps(btScalar(0.),btVector3(btScalar(0.),btScalar(0.),btScalar(0.)));
1837 return s_fixed;
1838 }
1839
1840 btPoint2PointConstraint* btWorldImporter::createPoint2PointConstraint(btRigidBody& rbA,btRigidBody& rbB, const btVector3& pivotInA,const btVector3& pivotInB)
1841 {
1842 btPoint2PointConstraint* p2p = new btPoint2PointConstraint(rbA,rbB,pivotInA,pivotInB);
1843 m_allocatedConstraints.push_back(p2p);
1844 return p2p;
1845 }
1846
1847 btPoint2PointConstraint* btWorldImporter::createPoint2PointConstraint(btRigidBody& rbA,const btVector3& pivotInA)
1848 {
1849 btPoint2PointConstraint* p2p = new btPoint2PointConstraint(rbA,pivotInA);
1850 m_allocatedConstraints.push_back(p2p);
1851 return p2p;
1852 }
1853
1854
1855 btHingeConstraint* btWorldImporter::createHingeConstraint(btRigidBody& rbA,btRigidBody& rbB, const btTransform& rbAFrame, const btTransform& rbBFrame, bool useReferenceFrameA)
1856 {
1857 btHingeConstraint* hinge = new btHingeConstraint(rbA,rbB,rbAFrame,rbBFrame,useReferenceFrameA);
1858 m_allocatedConstraints.push_back(hinge);
1859 return hinge;
1860 }
1861
1862 btHingeConstraint* btWorldImporter::createHingeConstraint(btRigidBody& rbA,const btTransform& rbAFrame, bool useReferenceFrameA)
1863 {
1864 btHingeConstraint* hinge = new btHingeConstraint(rbA,rbAFrame,useReferenceFrameA);
1865 m_allocatedConstraints.push_back(hinge);
1866 return hinge;
1867 }
1868
1869 btConeTwistConstraint* btWorldImporter::createConeTwistConstraint(btRigidBody& rbA,btRigidBody& rbB,const btTransform& rbAFrame, const btTransform& rbBFrame)
1870 {
1871 btConeTwistConstraint* cone = new btConeTwistConstraint(rbA,rbB,rbAFrame,rbBFrame);
1872 m_allocatedConstraints.push_back(cone);
1873 return cone;
1874 }
1875
1876 btConeTwistConstraint* btWorldImporter::createConeTwistConstraint(btRigidBody& rbA,const btTransform& rbAFrame)
1877 {
1878 btConeTwistConstraint* cone = new btConeTwistConstraint(rbA,rbAFrame);
1879 m_allocatedConstraints.push_back(cone);
1880 return cone;
1881 }
1882
1883
1884 btGeneric6DofConstraint* btWorldImporter::createGeneric6DofConstraint(btRigidBody& rbA, btRigidBody& rbB, const btTransform& frameInA, const btTransform& frameInB ,bool useLinearReferenceFrameA)
1885 {
1886 btGeneric6DofConstraint* dof = new btGeneric6DofConstraint(rbA,rbB,frameInA,frameInB,useLinearReferenceFrameA);
1887 m_allocatedConstraints.push_back(dof);
1888 return dof;
1889 }
1890
1891 btGeneric6DofConstraint* btWorldImporter::createGeneric6DofConstraint(btRigidBody& rbB, const btTransform& frameInB, bool useLinearReferenceFrameB)
1892 {
1893 btGeneric6DofConstraint* dof = new btGeneric6DofConstraint(rbB,frameInB,useLinearReferenceFrameB);
1894 m_allocatedConstraints.push_back(dof);
1895 return dof;
1896 }
1897
1898 btGeneric6DofSpring2Constraint* btWorldImporter::createGeneric6DofSpring2Constraint(btRigidBody& rbA, btRigidBody& rbB, const btTransform& frameInA, const btTransform& frameInB, int rotateOrder)
1899 {
1900 btGeneric6DofSpring2Constraint* dof = new btGeneric6DofSpring2Constraint(rbA,rbB,frameInA,frameInB, (RotateOrder)rotateOrder);
1901 m_allocatedConstraints.push_back(dof);
1902 return dof;
1903 }
1904
1905
1906
1907 btGeneric6DofSpringConstraint* btWorldImporter::createGeneric6DofSpringConstraint(btRigidBody& rbA, btRigidBody& rbB, const btTransform& frameInA, const btTransform& frameInB ,bool useLinearReferenceFrameA)
1908 {
1909 btGeneric6DofSpringConstraint* dof = new btGeneric6DofSpringConstraint(rbA,rbB,frameInA,frameInB,useLinearReferenceFrameA);
1910 m_allocatedConstraints.push_back(dof);
1911 return dof;
1912 }
1913
1914
1915 btSliderConstraint* btWorldImporter::createSliderConstraint(btRigidBody& rbA, btRigidBody& rbB, const btTransform& frameInA, const btTransform& frameInB ,bool useLinearReferenceFrameA)
1916 {
1917 btSliderConstraint* slider = new btSliderConstraint(rbA,rbB,frameInA,frameInB,useLinearReferenceFrameA);
1918 m_allocatedConstraints.push_back(slider);
1919 return slider;
1920 }
1921
1922 btSliderConstraint* btWorldImporter::createSliderConstraint(btRigidBody& rbB, const btTransform& frameInB, bool useLinearReferenceFrameA)
1923 {
1924 btSliderConstraint* slider = new btSliderConstraint(rbB,frameInB,useLinearReferenceFrameA);
1925 m_allocatedConstraints.push_back(slider);
1926 return slider;
1927 }
1928
1929 btGearConstraint* btWorldImporter::createGearConstraint(btRigidBody& rbA, btRigidBody& rbB, const btVector3& axisInA,const btVector3& axisInB, btScalar ratio)
1930 {
1931 btGearConstraint* gear = new btGearConstraint(rbA,rbB,axisInA,axisInB,ratio);
1932 m_allocatedConstraints.push_back(gear);
1933 return gear;
1934 }
1935
1936 // query for data
1937 int btWorldImporter::getNumCollisionShapes() const
1938 {
1939 return m_allocatedCollisionShapes.size();
1940 }
1941
1942 btCollisionShape* btWorldImporter::getCollisionShapeByIndex(int index)
1943 {
1944 return m_allocatedCollisionShapes[index];
1945 }
1946
1947 btCollisionShape* btWorldImporter::getCollisionShapeByName(const char* name)
1948 {
1949 btCollisionShape** shapePtr = m_nameShapeMap.find(name);
1950 if (shapePtr&& *shapePtr)
1951 {
1952 return *shapePtr;
1953 }
1954 return 0;
1955 }
1956
1957 btRigidBody* btWorldImporter::getRigidBodyByName(const char* name)
1958 {
1959 btRigidBody** bodyPtr = m_nameBodyMap.find(name);
1960 if (bodyPtr && *bodyPtr)
1961 {
1962 return *bodyPtr;
1963 }
1964 return 0;
1965 }
1966
1967 btTypedConstraint* btWorldImporter::getConstraintByName(const char* name)
1968 {
1969 btTypedConstraint** constraintPtr = m_nameConstraintMap.find(name);
1970 if (constraintPtr && *constraintPtr)
1971 {
1972 return *constraintPtr;
1973 }
1974 return 0;
1975 }
1976
1977 const char* btWorldImporter::getNameForPointer(const void* ptr) const
1978 {
1979 const char*const * namePtr = m_objectNameMap.find(ptr);
1980 if (namePtr && *namePtr)
1981 return *namePtr;
1982 return 0;
1983 }
1984
1985
1986 int btWorldImporter::getNumRigidBodies() const
1987 {
1988 return m_allocatedRigidBodies.size();
1989 }
1990
1991 btCollisionObject* btWorldImporter::getRigidBodyByIndex(int index) const
1992 {
1993 return m_allocatedRigidBodies[index];
1994 }
1995 int btWorldImporter::getNumConstraints() const
1996 {
1997 return m_allocatedConstraints.size();
1998 }
1999
2000 btTypedConstraint* btWorldImporter::getConstraintByIndex(int index) const
2001 {
2002 return m_allocatedConstraints[index];
2003 }
2004
2005 int btWorldImporter::getNumBvhs() const
2006 {
2007 return m_allocatedBvhs.size();
2008 }
2009 btOptimizedBvh* btWorldImporter::getBvhByIndex(int index) const
2010 {
2011 return m_allocatedBvhs[index];
2012 }
2013
2014 int btWorldImporter::getNumTriangleInfoMaps() const
2015 {
2016 return m_allocatedTriangleInfoMaps.size();
2017 }
2018
2019 btTriangleInfoMap* btWorldImporter::getTriangleInfoMapByIndex(int index) const
2020 {
2021 return m_allocatedTriangleInfoMaps[index];
2022 }
2023
2024
2025 void btWorldImporter::convertRigidBodyFloat( btRigidBodyFloatData* colObjData)
2026 {
2027 btScalar mass = btScalar(colObjData->m_inverseMass? 1.f/colObjData->m_inverseMass : 0.f);
2028 btVector3 localInertia;
2029 localInertia.setZero();
2030 btCollisionShape** shapePtr = m_shapeMap.find(colObjData->m_collisionObjectData.m_collisionShape);
2031 if (shapePtr && *shapePtr)
2032 {
2033 btTransform startTransform;
2034 colObjData->m_collisionObjectData.m_worldTransform.m_origin.m_floats[3] = 0.f;
2035 startTransform.deSerializeFloat(colObjData->m_collisionObjectData.m_worldTransform);
2036
2037 // startTransform.setBasis(btMatrix3x3::getIdentity());
2038 btCollisionShape* shape = (btCollisionShape*)*shapePtr;
2039 if (shape->isNonMoving())
2040 {
2041 mass = 0.f;
2042 }
2043 if (mass)
2044 {
2045 shape->calculateLocalInertia(mass,localInertia);
2046 }
2047 bool isDynamic = mass!=0.f;
2048 btRigidBody* body = createRigidBody(isDynamic,mass,startTransform,shape,colObjData->m_collisionObjectData.m_name);
2049 body->setFriction(colObjData->m_collisionObjectData.m_friction);
2050 body->setRestitution(colObjData->m_collisionObjectData.m_restitution);
2051 btVector3 linearFactor,angularFactor;
2052 linearFactor.deSerializeFloat(colObjData->m_linearFactor);
2053 angularFactor.deSerializeFloat(colObjData->m_angularFactor);
2054 body->setLinearFactor(linearFactor);
2055 body->setAngularFactor(angularFactor);
2056
2057 #ifdef USE_INTERNAL_EDGE_UTILITY
2058 if (shape->getShapeType() == TRIANGLE_MESH_SHAPE_PROXYTYPE)
2059 {
2060 btBvhTriangleMeshShape* trimesh = (btBvhTriangleMeshShape*)shape;
2061 if (trimesh->getTriangleInfoMap())
2062 {
2063 body->setCollisionFlags(body->getCollisionFlags() | btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK);
2064 }
2065 }
2066 #endif //USE_INTERNAL_EDGE_UTILITY
2067 m_bodyMap.insert(colObjData,body);
2068 } else
2069 {
2070 printf("error: no shape found\n");
2071 }
2072 }
2073
2074 void btWorldImporter::convertRigidBodyDouble( btRigidBodyDoubleData* colObjData)
2075 {
2076 btScalar mass = btScalar(colObjData->m_inverseMass? 1.f/colObjData->m_inverseMass : 0.f);
2077 btVector3 localInertia;
2078 localInertia.setZero();
2079 btCollisionShape** shapePtr = m_shapeMap.find(colObjData->m_collisionObjectData.m_collisionShape);
2080 if (shapePtr && *shapePtr)
2081 {
2082 btTransform startTransform;
2083 colObjData->m_collisionObjectData.m_worldTransform.m_origin.m_floats[3] = 0.f;
2084 startTransform.deSerializeDouble(colObjData->m_collisionObjectData.m_worldTransform);
2085
2086 // startTransform.setBasis(btMatrix3x3::getIdentity());
2087 btCollisionShape* shape = (btCollisionShape*)*shapePtr;
2088 if (shape->isNonMoving())
2089 {
2090 mass = 0.f;
2091 }
2092 if (mass)
2093 {
2094 shape->calculateLocalInertia(mass,localInertia);
2095 }
2096 bool isDynamic = mass!=0.f;
2097 btRigidBody* body = createRigidBody(isDynamic,mass,startTransform,shape,colObjData->m_collisionObjectData.m_name);
2098 body->setFriction(btScalar(colObjData->m_collisionObjectData.m_friction));
2099 body->setRestitution(btScalar(colObjData->m_collisionObjectData.m_restitution));
2100 btVector3 linearFactor,angularFactor;
2101 linearFactor.deSerializeDouble(colObjData->m_linearFactor);
2102 angularFactor.deSerializeDouble(colObjData->m_angularFactor);
2103 body->setLinearFactor(linearFactor);
2104 body->setAngularFactor(angularFactor);
2105
2106
2107 #ifdef USE_INTERNAL_EDGE_UTILITY
2108 if (shape->getShapeType() == TRIANGLE_MESH_SHAPE_PROXYTYPE)
2109 {
2110 btBvhTriangleMeshShape* trimesh = (btBvhTriangleMeshShape*)shape;
2111 if (trimesh->getTriangleInfoMap())
2112 {
2113 body->setCollisionFlags(body->getCollisionFlags() | btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK);
2114 }
2115 }
2116 #endif //USE_INTERNAL_EDGE_UTILITY
2117 m_bodyMap.insert(colObjData,body);
2118 } else
2119 {
2120 printf("error: no shape found\n");
2121 }
2122 }
SCALED_TRIANGLE_MESH_SHAPE_PROXYTYPE
Definition: btBroadphaseProxy.h:56
btTransform::setOrigin
void setOrigin(const btVector3 &origin)
Set the translational element.
Definition: btTransform.h:150
btIndexedMesh::m_numTriangles
int m_numTriangles
Definition: btTriangleIndexVertexArray.h:30
btCollisionObjectFloatData::m_worldTransform
btTransformFloatData m_worldTransform
Definition: btCollisionObject.h:642
btRigidBody::upcast
static const btRigidBody * upcast(const btCollisionObject *colObj)
to keep collision detection and dynamics separate we don&#39;t store a rigidbody pointer but a rigidbody ...
Definition: btRigidBody.h:203
btTypedConstraintDoubleData::m_isEnabled
int m_isEnabled
Definition: btTypedConstraint.h:434
btHingeConstraintDoubleData::m_rbBFrame
btTransformDoubleData m_rbBFrame
Definition: btHingeConstraint.h:359
btBvhTriangleMeshShape::getTriangleInfoMap
const btTriangleInfoMap * getTriangleInfoMap() const
Definition: btBvhTriangleMeshShape.h:102
btSliderConstraintDoubleData::m_angularUpperLimit
double m_angularUpperLimit
Definition: btSliderConstraint.h:330
btHingeConstraintDoubleData2::m_biasFactor
double m_biasFactor
Definition: btHingeConstraint.h:450
btConeTwistConstraintData::m_damping
float m_damping
Definition: btConeTwistConstraint.h:399
btScaledTriangleMeshShapeData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btScaledBvhTriangleMeshShape.h:70
btWorldImporter::createGeneric6DofSpringConstraint
virtual btGeneric6DofSpringConstraint * createGeneric6DofSpringConstraint(btRigidBody &rbA, btRigidBody &rbB, const btTransform &frameInA, const btTransform &frameInB, bool useLinearReferenceFrameA)
Definition: btWorldImporter.cpp:1907
btConeTwistConstraint::setLimit
void setLimit(int limitIndex, btScalar limitValue)
Definition: btConeTwistConstraint.h:179
btHingeConstraintFloatData::m_rbAFrame
btTransformFloatData m_rbAFrame
Definition: btHingeConstraint.h:416
btGeneric6DofSpring2ConstraintData::m_angularUpperLimit
btVector3FloatData m_angularUpperLimit
Definition: btGeneric6DofSpring2Constraint.h:521
btConeTwistConstraintDoubleData::m_rbAFrame
btTransformDoubleData m_rbAFrame
Definition: btConeTwistConstraint.h:366
btPoint2PointConstraintDoubleData::m_pivotInA
btVector3DoubleData m_pivotInA
Definition: btPoint2PointConstraint.h:156
btStridingMeshInterfaceData::m_meshPartsPtr
btMeshPartData * m_meshPartsPtr
Definition: btStridingMeshInterface.h:148
CONE_SHAPE_PROXYTYPE
Definition: btBroadphaseProxy.h:43
btGeneric6DofSpringConstraintDoubleData2::m_springStiffness
double m_springStiffness[6]
Definition: btGeneric6DofSpringConstraint.h:113
btGeneric6DofSpring2ConstraintDoubleData2::m_rbBFrame
btTransformDoubleData m_rbBFrame
Definition: btGeneric6DofSpring2Constraint.h:547
btWorldImporter::createGeneric6DofConstraint
virtual btGeneric6DofConstraint * createGeneric6DofConstraint(btRigidBody &rbA, btRigidBody &rbB, const btTransform &frameInA, const btTransform &frameInB, bool useLinearReferenceFrameA)
Definition: btWorldImporter.cpp:1884
btAlignedObjectArray::push_back
void push_back(const T &_Val)
Definition: btAlignedObjectArray.h:274
btSliderConstraint::setUpperLinLimit
void setUpperLinLimit(btScalar upperLimit)
Definition: btSliderConstraint.h:195
btGeneric6DofSpring2ConstraintData::m_rotateOrder
int m_rotateOrder
Definition: btGeneric6DofSpring2Constraint.h:540
SPHERE_SHAPE_PROXYTYPE
Definition: btBroadphaseProxy.h:40
btWorldImporter::convertConstraintBackwardsCompatible281
void convertConstraintBackwardsCompatible281(btTypedConstraintData *constraintData, btRigidBody *rbA, btRigidBody *rbB, int fileVersion)
Definition: btWorldImporter.cpp:528
btGeneric6DofSpringConstraintData
Definition: btGeneric6DofSpringConstraint.h:97
btGeneric6DofSpring2ConstraintData::m_angularSpringDampingLimited
char m_angularSpringDampingLimited[4]
Definition: btGeneric6DofSpring2Constraint.h:538
btCompoundShapeData::m_childShapePtr
btCompoundShapeChildData * m_childShapePtr
Definition: btCompoundShape.h:192
btWorldImporter::convertCollisionShape
btCollisionShape * convertCollisionShape(btCollisionShapeData *shapeData)
Definition: btWorldImporter.cpp:149
btWorldImporter::getTriangleInfoMapByIndex
btTriangleInfoMap * getTriangleInfoMapByIndex(int index) const
Definition: btWorldImporter.cpp:2019
btSliderConstraintDoubleData::m_angularLowerLimit
double m_angularLowerLimit
Definition: btSliderConstraint.h:331
btWorldImporter::createStridingMeshInterfaceData
virtual btStridingMeshInterfaceData * createStridingMeshInterfaceData(btStridingMeshInterfaceData *interfaceData)
Definition: btWorldImporter.cpp:1533
btGeneric6DofSpringConstraintDoubleData2::m_6dofData
btGeneric6DofConstraintDoubleData2 m_6dofData
Definition: btGeneric6DofSpringConstraint.h:109
btTypedConstraintDoubleData::m_breakingImpulseThreshold
double m_breakingImpulseThreshold
Definition: btTypedConstraint.h:433
btPoint2PointConstraint
point to point constraint between two rigidbodies each with a pivotpoint that descibes the &#39;ballsocke...
Definition: btPoint2PointConstraint.h:54
btConeTwistConstraintData::m_rbAFrame
btTransformFloatData m_rbAFrame
Definition: btConeTwistConstraint.h:388
btStaticPlaneShapeData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btStaticPlaneShape.h:72
btTransform::deSerializeFloat
void deSerializeFloat(const struct btTransformFloatData &dataIn)
Definition: btTransform.h:286
SOFTBODY_SHAPE_PROXYTYPE
Definition: btBroadphaseProxy.h:73
btWorldImporter::createTriangleMeshContainer
virtual class btTriangleIndexVertexArray * createTriangleMeshContainer()
Definition: btWorldImporter.cpp:1752
btWorldImporter::convertRigidBodyDouble
void convertRigidBodyDouble(btRigidBodyDoubleData *colObjData)
Definition: btWorldImporter.cpp:2074
btWorldImporter::createBvhTriangleMeshShape
virtual btBvhTriangleMeshShape * createBvhTriangleMeshShape(btStridingMeshInterface *trimesh, btOptimizedBvh *bvh)
Definition: btWorldImporter.cpp:1774
btGeneric6DofSpring2ConstraintDoubleData2::m_linearEquilibriumPoint
btVector3DoubleData m_linearEquilibriumPoint
Definition: btGeneric6DofSpring2Constraint.h:561
btVector3::deSerializeDouble
void deSerializeDouble(const struct btVector3DoubleData &dataIn)
Definition: btVector3.h:1343
btWorldImporter::createSphereShape
virtual btCollisionShape * createSphereShape(btScalar radius)
Definition: btWorldImporter.cpp:1681
btTypedConstraintData::m_name
char * m_name
Definition: btTypedConstraint.h:397
btSliderConstraint::setLowerLinLimit
void setLowerLinLimit(btScalar lowerLimit)
Definition: btSliderConstraint.h:193
btIntIndexData::m_value
int m_value
Definition: btStridingMeshInterface.h:106
PHY_UCHAR
Definition: btConcaveShape.h:31
btCollisionShape::calculateLocalInertia
virtual void calculateLocalInertia(btScalar mass, btVector3 &inertia) const =0
btWorldImporter::createConeTwistConstraint
virtual btConeTwistConstraint * createConeTwistConstraint(btRigidBody &rbA, btRigidBody &rbB, const btTransform &rbAFrame, const btTransform &rbBFrame)
Definition: btWorldImporter.cpp:1869
btWorldImporter::createTriangleInfoMap
virtual btTriangleInfoMap * createTriangleInfoMap()
Definition: btWorldImporter.cpp:1767
btIndexedMesh
The btIndexedMesh indexes a single vertex and index array.
Definition: btTriangleIndexVertexArray.h:26
btWorldImporter::convertRigidBodyFloat
void convertRigidBodyFloat(btRigidBodyFloatData *colObjData)
Definition: btWorldImporter.cpp:2025
btSliderConstraint::setLowerAngLimit
void setLowerAngLimit(btScalar lowerLimit)
Definition: btSliderConstraint.h:197
btRigidBodyFloatData::m_angularFactor
btVector3FloatData m_angularFactor
Definition: btRigidBody.h:570
FIXED_CONSTRAINT_TYPE
Definition: btTypedConstraint.h:46
btWorldImporter::createCylinderShapeZ
virtual btCollisionShape * createCylinderShapeZ(btScalar radius, btScalar height)
Definition: btWorldImporter.cpp:1724
btGImpactMeshShape::setLocalScaling
virtual void setLocalScaling(const btVector3 &scaling)
Definition: btGImpactShape.h:964
btGeneric6DofSpring2ConstraintData::m_linearSpringStiffness
btVector3FloatData m_linearSpringStiffness
Definition: btGeneric6DofSpring2Constraint.h:511
btAlignedObjectArray< btVector3 >
btBulletDynamicsCommon.h
btGeneric6DofSpring2ConstraintData::m_linearEquilibriumPoint
btVector3FloatData m_linearEquilibriumPoint
Definition: btGeneric6DofSpring2Constraint.h:513
btWorldImporter::m_charIndexArrays
btAlignedObjectArray< unsigned char * > m_charIndexArrays
Definition: btWorldImporter.h:82
btTypedConstraintFloatData::m_breakingImpulseThreshold
float m_breakingImpulseThreshold
Definition: btTypedConstraint.h:383
btGeneric6DofSpringConstraintDoubleData2::m_springEnabled
int m_springEnabled[6]
Definition: btGeneric6DofSpringConstraint.h:111
btGeneric6DofSpring2ConstraintDoubleData2::m_linearSpringDamping
btVector3DoubleData m_linearSpringDamping
Definition: btGeneric6DofSpring2Constraint.h:560
btGeneric6DofSpring2ConstraintData::m_linearLowerLimit
btVector3FloatData m_linearLowerLimit
Definition: btGeneric6DofSpring2Constraint.h:502
btGearConstraintFloatData::m_ratio
float m_ratio
Definition: btGearConstraint.h:114
btVector3DoubleData::m_floats
double m_floats[4]
Definition: btVector3.h:1318
btSliderConstraintData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btSliderConstraint.h:303
btTypedConstraintFloatData::m_objectType
int m_objectType
Definition: btTypedConstraint.h:372
btGeneric6DofConstraintDoubleData2
Definition: btGeneric6DofConstraint.h:596
btHashMap::find
const Value * find(const Key &key) const
Definition: btHashMap.h:419
btShortIntIndexData::m_value
short m_value
Definition: btStridingMeshInterface.h:111
btGeneric6DofSpring2ConstraintData::m_rbBFrame
btTransformFloatData m_rbBFrame
Definition: btGeneric6DofSpring2Constraint.h:499
btHingeConstraintDoubleData2::m_motorTargetVelocity
double m_motorTargetVelocity
Definition: btHingeConstraint.h:444
btMultiSphereShapeData::m_localPositionArraySize
int m_localPositionArraySize
Definition: btMultiSphereShape.h:88
btGeneric6DofSpring2ConstraintDoubleData2::m_linearUpperLimit
btVector3DoubleData m_linearUpperLimit
Definition: btGeneric6DofSpring2Constraint.h:549
btHingeConstraintFloatData::m_motorTargetVelocity
float m_motorTargetVelocity
Definition: btHingeConstraint.h:422
btConeTwistConstraintData::m_limitSoftness
float m_limitSoftness
Definition: btConeTwistConstraint.h:395
btGeneric6DofConstraintData
Definition: btGeneric6DofConstraint.h:580
btGearConstraint
The btGeatConstraint will couple the angular velocity for two bodies around given local axis and rati...
Definition: btGearConstraint.h:36
btMultiSphereShape
The btMultiSphereShape represents the convex hull of a collection of spheres.
Definition: btMultiSphereShape.h:28
btWorldImporter::createRigidBody
virtual btRigidBody * createRigidBody(bool isDynamic, btScalar mass, const btTransform &startTransform, btCollisionShape *shape, const char *bodyName)
Definition: btWorldImporter.cpp:1644
btScaledTriangleMeshShapeData::m_trimeshShapeData
btTriangleMeshShapeData m_trimeshShapeData
Definition: btScaledBvhTriangleMeshShape.h:72
btGeneric6DofConstraint
btGeneric6DofConstraint between two rigidbodies each with a pivotpoint that descibes the axis locatio...
Definition: btGeneric6DofConstraint.h:279
CAPSULE_SHAPE_PROXYTYPE
Definition: btBroadphaseProxy.h:42
btCharIndexTripletData
Definition: btStridingMeshInterface.h:121
btWorldImporter::btWorldImporter
btWorldImporter(btDynamicsWorld *world)
Definition: btWorldImporter.cpp:21
btHingeConstraintDoubleData::m_lowerLimit
float m_lowerLimit
Definition: btHingeConstraint.h:366
btGeneric6DofSpring2ConstraintDoubleData2::m_angularSpringStiffnessLimited
char m_angularSpringStiffnessLimited[4]
Definition: btGeneric6DofSpring2Constraint.h:585
btStaticPlaneShapeData::m_planeConstant
float m_planeConstant
Definition: btStaticPlaneShape.h:78
btGeneric6DofSpring2ConstraintDoubleData2::m_rbAFrame
btTransformDoubleData m_rbAFrame
Definition: btGeneric6DofSpring2Constraint.h:546
btTypedConstraintFloatData::m_disableCollisionsBetweenLinkedBodies
int m_disableCollisionsBetweenLinkedBodies
Definition: btTypedConstraint.h:380
btTypedConstraintData::m_disableCollisionsBetweenLinkedBodies
int m_disableCollisionsBetweenLinkedBodies
Definition: btTypedConstraint.h:407
TRIANGLE_MESH_SHAPE_PROXYTYPE
Definition: btBroadphaseProxy.h:55
btCapsuleShape
The btCapsuleShape represents a capsule around the Y axis, there is also the btCapsuleShapeX aligned ...
Definition: btCapsuleShape.h:26
btConvexHullShapeData::m_unscaledPointsDoublePtr
btVector3DoubleData * m_unscaledPointsDoublePtr
Definition: btConvexHullShape.h:106
CONST_GIMPACT_TRIMESH_SHAPE
Definition: btGImpactShape.h:50
btHingeConstraintDoubleData
this structure is not used, except for loading pre-2.82 .bullet files
Definition: btHingeConstraint.h:355
btTransform::setIdentity
void setIdentity()
Set this transformation to the identity.
Definition: btTransform.h:172
btAssert
#define btAssert(x)
Definition: btScalar.h:114
btDynamicsWorld
The btDynamicsWorld is the interface class for several dynamics implementation, basic, discrete, parallel, and continuous etc.
Definition: btDynamicsWorld.h:42
btGeneric6DofSpring2ConstraintDoubleData2::m_linearEnableSpring
char m_linearEnableSpring[4]
Definition: btGeneric6DofSpring2Constraint.h:564
btGeneric6DofSpring2ConstraintData::m_angularLowerLimit
btVector3FloatData m_angularLowerLimit
Definition: btGeneric6DofSpring2Constraint.h:522
btWorldImporter::createConvexHullShape
virtual class btConvexHullShape * createConvexHullShape()
Definition: btWorldImporter.cpp:1804
btConeTwistConstraintDoubleData::m_swingSpan2
double m_swingSpan2
Definition: btConeTwistConstraint.h:371
btCollisionShape
The btCollisionShape class provides an interface for collision shapes that can be shared among btColl...
Definition: btCollisionShape.h:27
btGImpactShape.h
btWorldImporter::getNumCollisionShapes
int getNumCollisionShapes() const
Definition: btWorldImporter.cpp:1937
btCapsuleShapeX
btCapsuleShapeX represents a capsule around the Z axis the total height is height+2*radius, so the height is just the height between the center of each &#39;sphere&#39; of the capsule caps.
Definition: btCapsuleShape.h:116
btGeneric6DofConstraintData::m_linearLowerLimit
btVector3FloatData m_linearLowerLimit
Definition: btGeneric6DofConstraint.h:587
btConeShapeX
btConeShape implements a Cone shape, around the X axis
Definition: btConeShape.h:113
btGeneric6DofSpring2ConstraintDoubleData2::m_angularEquilibriumPoint
btVector3DoubleData m_angularEquilibriumPoint
Definition: btGeneric6DofSpring2Constraint.h:581
btWorldImporter::m_nameShapeMap
btHashMap< btHashString, btCollisionShape * > m_nameShapeMap
Definition: btWorldImporter.h:91
btWorldImporter::m_shortIndexArrays
btAlignedObjectArray< short int * > m_shortIndexArrays
Definition: btWorldImporter.h:81
btVector3::getY
const btScalar & getY() const
Return the y value.
Definition: btVector3.h:573
btConeTwistConstraint::setDamping
void setDamping(btScalar damping)
Definition: btConeTwistConstraint.h:305
btConeTwistConstraintDoubleData::m_swingSpan1
double m_swingSpan1
Definition: btConeTwistConstraint.h:370
btWorldImporter::createConvexTriangleMeshShape
virtual btCollisionShape * createConvexTriangleMeshShape(btStridingMeshInterface *trimesh)
Definition: btWorldImporter.cpp:1789
btSphereShape
The btSphereShape implements an implicit sphere, centered around a local origin with radius...
Definition: btSphereShape.h:22
btStridingMeshInterface::setScaling
void setScaling(const btVector3 &scaling)
Definition: btStridingMeshInterface.h:91
btWorldImporter::createCapsuleShapeY
virtual btCollisionShape * createCapsuleShapeY(btScalar radius, btScalar height)
Definition: btWorldImporter.cpp:1696
btWorldImporter::createCylinderShapeX
virtual btCollisionShape * createCylinderShapeX(btScalar radius, btScalar height)
Definition: btWorldImporter.cpp:1710
btCollisionObjectDoubleData::m_name
char * m_name
Definition: btCollisionObject.h:605
btWorldImporter::getCollisionShapeByName
btCollisionShape * getCollisionShapeByName(const char *name)
Definition: btWorldImporter.cpp:1947
btConeTwistConstraintData::m_rbBFrame
btTransformFloatData m_rbBFrame
Definition: btConeTwistConstraint.h:389
btTypedConstraintDoubleData::m_disableCollisionsBetweenLinkedBodies
int m_disableCollisionsBetweenLinkedBodies
Definition: btTypedConstraint.h:430
btPoint2PointConstraintFloatData::m_pivotInA
btVector3FloatData m_pivotInA
Definition: btPoint2PointConstraint.h:137
btGeneric6DofConstraint::setAngularUpperLimit
void setAngularUpperLimit(const btVector3 &angularUpper)
Definition: btGeneric6DofConstraint.h:487
btMeshPartData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btStridingMeshInterface.h:129
btManifoldPoint
ManifoldContactPoint collects and maintains persistent contactpoints.
Definition: btManifoldPoint.h:48
btHingeConstraintFloatData::m_upperLimit
float m_upperLimit
Definition: btHingeConstraint.h:426
btSliderConstraint::setUseFrameOffset
void setUseFrameOffset(bool frameOffsetOnOff)
Definition: btSliderConstraint.h:269
btTriangleMeshShapeData::m_meshInterface
btStridingMeshInterfaceData m_meshInterface
Definition: btBvhTriangleMeshShape.h:128
btDynamicsWorld::setGravity
virtual void setGravity(const btVector3 &gravity)=0
btMeshPartData::m_numVertices
int m_numVertices
Definition: btStridingMeshInterface.h:141
btConvexInternalShapeData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btConvexInternalShape.h:144
btGearConstraintDoubleData::m_axisInB
btVector3DoubleData m_axisInB
Definition: btGearConstraint.h:123
btCollisionShapeData::m_shapeType
int m_shapeType
Definition: btCollisionShape.h:158
GEAR_CONSTRAINT_TYPE
Definition: btTypedConstraint.h:45
btMeshPartData::m_vertices3f
btVector3FloatData * m_vertices3f
Definition: btStridingMeshInterface.h:131
btConeTwistConstraintDoubleData::m_relaxationFactor
double m_relaxationFactor
Definition: btConeTwistConstraint.h:375
btRigidBody::setLinearFactor
void setLinearFactor(const btVector3 &linearFactor)
Definition: btRigidBody.h:268
btWorldImporter::createCylinderShapeY
virtual btCollisionShape * createCylinderShapeY(btScalar radius, btScalar height)
Definition: btWorldImporter.cpp:1717
btWorldImporter::m_allocatedBvhs
btAlignedObjectArray< btOptimizedBvh * > m_allocatedBvhs
Definition: btWorldImporter.h:73
btGeneric6DofConstraintDoubleData2::m_linearLowerLimit
btVector3DoubleData m_linearLowerLimit
Definition: btGeneric6DofConstraint.h:603
btGearConstraintFloatData::m_axisInB
btVector3FloatData m_axisInB
Definition: btGearConstraint.h:112
btWorldImporter::createConeShapeX
virtual btCollisionShape * createConeShapeX(btScalar radius, btScalar height)
Definition: btWorldImporter.cpp:1731
btCompoundShape::addChildShape
void addChildShape(const btTransform &localTransform, btCollisionShape *shape)
Definition: btCompoundShape.cpp:51
btVector3FloatData::m_floats
float m_floats[4]
Definition: btVector3.h:1313
btTypedConstraintFloatData::m_name
char * m_name
Definition: btTypedConstraint.h:370
btCollisionObjectFloatData::m_restitution
float m_restitution
Definition: btCollisionObject.h:653
BOX_SHAPE_PROXYTYPE
Definition: btBroadphaseProxy.h:31
btGImpactMeshShape
This class manages a mesh supplied by the btStridingMeshInterface interface.
Definition: btGImpactShape.h:890
btGeneric6DofSpringConstraint::setStiffness
void setStiffness(int index, btScalar stiffness)
Definition: btGeneric6DofSpringConstraint.cpp:65
GIMPACT_SHAPE_PROXYTYPE
Used for GIMPACT Trimesh integration.
Definition: btBroadphaseProxy.h:62
btSliderConstraintDoubleData::m_linearLowerLimit
double m_linearLowerLimit
Definition: btSliderConstraint.h:328
btRigidBodyDoubleData::m_inverseMass
double m_inverseMass
Definition: btRigidBody.h:603
btTriangleMeshShapeData::m_triangleInfoMap
btTriangleInfoMapData * m_triangleInfoMap
Definition: btBvhTriangleMeshShape.h:133
btSliderConstraintData::m_linearLowerLimit
float m_linearLowerLimit
Definition: btSliderConstraint.h:310
btConcaveShape::setMargin
virtual void setMargin(btScalar collisionMargin)
Definition: btConcaveShape.h:53
btMeshPartData::m_numTriangles
int m_numTriangles
Definition: btStridingMeshInterface.h:140
btConeTwistConstraintDoubleData::m_twistSpan
double m_twistSpan
Definition: btConeTwistConstraint.h:372
btWorldImporter::createCapsuleShapeZ
virtual btCollisionShape * createCapsuleShapeZ(btScalar radius, btScalar height)
Definition: btWorldImporter.cpp:1703
btSliderConstraintData::m_rbBFrame
btTransformFloatData m_rbBFrame
Definition: btSliderConstraint.h:307
btHingeConstraint
hinge constraint between two rigidbodies each with a pivotpoint that descibes the axis location in lo...
Definition: btHingeConstraint.h:51
btSliderConstraintData::m_linearUpperLimit
float m_linearUpperLimit
Definition: btSliderConstraint.h:309
btGeneric6DofSpring2Constraint
Definition: btGeneric6DofSpring2Constraint.h:277
btShortIntIndexTripletData
Definition: btStridingMeshInterface.h:115
btHingeConstraintDoubleData2::m_maxMotorImpulse
double m_maxMotorImpulse
Definition: btHingeConstraint.h:445
btConeTwistConstraintData::m_twistSpan
float m_twistSpan
Definition: btConeTwistConstraint.h:394
btGeneric6DofConstraintData::m_rbBFrame
btTransformFloatData m_rbBFrame
Definition: btGeneric6DofConstraint.h:584
btConeTwistConstraintData::m_swingSpan2
float m_swingSpan2
Definition: btConeTwistConstraint.h:393
btCollisionObject::setRestitution
void setRestitution(btScalar rest)
Definition: btCollisionObject.h:302
btRigidBodyFloatData::m_collisionObjectData
btCollisionObjectFloatData m_collisionObjectData
Definition: btRigidBody.h:566
btRigidBodyDoubleData::m_linearFactor
btVector3DoubleData m_linearFactor
Definition: btRigidBody.h:597
btWorldImporter::createPlaneShape
virtual btCollisionShape * createPlaneShape(const btVector3 &planeNormal, btScalar planeConstant)
shapes
Definition: btWorldImporter.cpp:1669
btShortIntIndexTripletData::m_values
short m_values[3]
Definition: btStridingMeshInterface.h:117
btHingeConstraintFloatData::m_limitSoftness
float m_limitSoftness
Definition: btHingeConstraint.h:427
btWorldImporter::m_allocatedTriangleInfoMaps
btAlignedObjectArray< btTriangleInfoMap * > m_allocatedTriangleInfoMaps
Definition: btWorldImporter.h:74
btSliderConstraintData::m_angularUpperLimit
float m_angularUpperLimit
Definition: btSliderConstraint.h:312
btConvexInternalShapeData::m_collisionMargin
float m_collisionMargin
Definition: btConvexInternalShape.h:152
btWorldImporter::deleteAllData
virtual void deleteAllData()
delete all memory collision shapes, rigid bodies, constraints etc.
Definition: btWorldImporter.cpp:32
btIndexedMesh::m_indexType
PHY_ScalarType m_indexType
Definition: btTriangleIndexVertexArray.h:41
btGeneric6DofSpringConstraintData::m_6dofData
btGeneric6DofConstraintData m_6dofData
Definition: btGeneric6DofSpringConstraint.h:99
btMeshPartData::m_indices16
btShortIntIndexData * m_indices16
Definition: btStridingMeshInterface.h:138
btTypedConstraintDoubleData::m_objectType
int m_objectType
Definition: btTypedConstraint.h:422
btAlignedObjectArray::clear
void clear()
clear the array, deallocated memory. Generally it is better to use array.resize(0), to reduce performance overhead of run-time memory (de)allocations.
Definition: btAlignedObjectArray.h:190
btWorldImporter::getConstraintByName
btTypedConstraint * getConstraintByName(const char *name)
Definition: btWorldImporter.cpp:1967
btDynamicsWorld::addRigidBody
virtual void addRigidBody(btRigidBody *body)=0
btMeshPartData::m_3indices8
btCharIndexTripletData * m_3indices8
Definition: btStridingMeshInterface.h:136
btPoint2PointConstraintDoubleData2
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btPoint2PointConstraint.h:142
btTypedConstraint::setBreakingImpulseThreshold
void setBreakingImpulseThreshold(btScalar threshold)
Definition: btTypedConstraint.h:202
btConeTwistConstraintDoubleData::m_damping
double m_damping
Definition: btConeTwistConstraint.h:377
btPoint2PointConstraintDoubleData2::m_pivotInA
btVector3DoubleData m_pivotInA
Definition: btPoint2PointConstraint.h:145
btVector3::getZ
const btScalar & getZ() const
Return the z value.
Definition: btVector3.h:575
D6_SPRING_2_CONSTRAINT_TYPE
Definition: btTypedConstraint.h:47
btCylinderShapeZ
Definition: btCylinderShape.h:160
btTypedConstraintDoubleData::m_name
char * m_name
Definition: btTypedConstraint.h:420
btWorldImporter::getNumRigidBodies
int getNumRigidBodies() const
Definition: btWorldImporter.cpp:1986
btWorldImporter::createCompoundShape
virtual class btCompoundShape * createCompoundShape()
Definition: btWorldImporter.cpp:1811
btBvhTriangleMeshShape
The btBvhTriangleMeshShape is a static-triangle mesh shape, it can only be used for fixed/non-moving ...
Definition: btBvhTriangleMeshShape.h:34
btWorldImporter::getRigidBodyByIndex
btCollisionObject * getRigidBodyByIndex(int index) const
Definition: btWorldImporter.cpp:1991
btTypedConstraint::setDbgDrawSize
void setDbgDrawSize(btScalar dbgDrawSize)
Definition: btTypedConstraint.h:316
btStridingMeshInterfaceData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btStridingMeshInterface.h:146
btHingeConstraintDoubleData2::m_angularOnly
int m_angularOnly
Definition: btHingeConstraint.h:442
btAdjustInternalEdgeContacts
void btAdjustInternalEdgeContacts(btManifoldPoint &cp, const btCollisionObjectWrapper *colObj0Wrap, const btCollisionObjectWrapper *colObj1Wrap, int partId0, int index0, int normalAdjustFlags)
Changes a btManifoldPoint collision normal to the normal from the mesh.
Definition: btInternalEdgeUtility.cpp:449
btGImpactMeshShapeData::m_collisionMargin
float m_collisionMargin
Definition: btGImpactShape.h:1153
btHingeConstraintFloatData::m_biasFactor
float m_biasFactor
Definition: btHingeConstraint.h:428
btTriangleIndexVertexArray
The btTriangleIndexVertexArray allows to access multiple triangle meshes, by indexing into existing t...
Definition: btTriangleIndexVertexArray.h:68
btCollisionObjectFloatData::m_collisionShape
void * m_collisionShape
Definition: btCollisionObject.h:638
btCollisionObject::getWorldTransform
btTransform & getWorldTransform()
Definition: btCollisionObject.h:370
CYLINDER_SHAPE_PROXYTYPE
Definition: btBroadphaseProxy.h:45
btConvexInternalShape::setMargin
virtual void setMargin(btScalar margin)
Definition: btConvexInternalShape.h:109
btCapsuleShapeData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btCapsuleShape.h:149
btGeneric6DofSpring2ConstraintData::m_angularEnableSpring
char m_angularEnableSpring[4]
Definition: btGeneric6DofSpring2Constraint.h:536
btGeneric6DofSpring2ConstraintDoubleData2::m_angularLowerLimit
btVector3DoubleData m_angularLowerLimit
Definition: btGeneric6DofSpring2Constraint.h:570
btGeneric6DofConstraintData::m_angularLowerLimit
btVector3FloatData m_angularLowerLimit
Definition: btGeneric6DofConstraint.h:590
btWorldImporter::m_bvhMap
btHashMap< btHashPtr, btOptimizedBvh * > m_bvhMap
Definition: btWorldImporter.h:88
btConvexHullShapeData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btConvexHullShape.h:101
btDynamicsWorld::removeConstraint
virtual void removeConstraint(btTypedConstraint *constraint)
Definition: btDynamicsWorld.h:77
btMeshPartData::m_3indices16
btShortIntIndexTripletData * m_3indices16
Definition: btStridingMeshInterface.h:135
btGeneric6DofSpring2ConstraintData::m_linearUpperLimit
btVector3FloatData m_linearUpperLimit
Definition: btGeneric6DofSpring2Constraint.h:501
btTransform::getOrigin
btVector3 & getOrigin()
Return the origin vector translation.
Definition: btTransform.h:117
btWorldImporter::m_doubleVertexArrays
btAlignedObjectArray< btVector3DoubleData * > m_doubleVertexArrays
Definition: btWorldImporter.h:85
btConeTwistConstraintDoubleData::m_limitSoftness
double m_limitSoftness
Definition: btConeTwistConstraint.h:373
btWorldImporter::m_allocatedbtStridingMeshInterfaceDatas
btAlignedObjectArray< btStridingMeshInterfaceData * > m_allocatedbtStridingMeshInterfaceDatas
Definition: btWorldImporter.h:76
btSliderConstraintData::m_useLinearReferenceFrameA
int m_useLinearReferenceFrameA
Definition: btSliderConstraint.h:315
btTriangleIndexVertexArray::addIndexedMesh
void addIndexedMesh(const btIndexedMesh &mesh, PHY_ScalarType indexType=PHY_INTEGER)
Definition: btTriangleIndexVertexArray.h:90
btIndexedMesh::m_triangleIndexStride
int m_triangleIndexStride
Definition: btTriangleIndexVertexArray.h:33
btHingeConstraintDoubleData::m_motorTargetVelocity
float m_motorTargetVelocity
Definition: btHingeConstraint.h:363
btWorldImporter::createGimpactShape
virtual btGImpactMeshShape * createGimpactShape(btStridingMeshInterface *trimesh)
Definition: btWorldImporter.cpp:1793
btWorldImporter::m_nameConstraintMap
btHashMap< btHashString, btTypedConstraint * > m_nameConstraintMap
Definition: btWorldImporter.h:93
btTransformFloatData::m_origin
btVector3FloatData m_origin
Definition: btTransform.h:256
btCollisionObject::setFriction
void setFriction(btScalar frict)
Definition: btCollisionObject.h:311
btSliderConstraintDoubleData::m_useOffsetForConstraintFrame
int m_useOffsetForConstraintFrame
Definition: btSliderConstraint.h:334
btWorldImporter::createGearConstraint
virtual btGearConstraint * createGearConstraint(btRigidBody &rbA, btRigidBody &rbB, const btVector3 &axisInA, const btVector3 &axisInB, btScalar ratio)
Definition: btWorldImporter.cpp:1929
btConeShapeData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btConeShape.h:153
btGearConstraintFloatData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btGearConstraint.h:107
btWorldImporter::getBvhByIndex
btOptimizedBvh * getBvhByIndex(int index) const
Definition: btWorldImporter.cpp:2009
btHingeConstraintDoubleData2::m_relaxationFactor
double m_relaxationFactor
Definition: btHingeConstraint.h:451
btRigidBodyDoubleData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btRigidBody.h:590
btShortIntIndexData
Definition: btStridingMeshInterface.h:109
btGeneric6DofSpringConstraint::enableSpring
void enableSpring(int index, bool onOff)
Definition: btGeneric6DofSpringConstraint.cpp:49
btGeneric6DofConstraintData::m_useLinearReferenceFrameA
int m_useLinearReferenceFrameA
Definition: btGeneric6DofConstraint.h:592
btHingeConstraintDoubleData::m_relaxationFactor
float m_relaxationFactor
Definition: btHingeConstraint.h:370
btTypedConstraintData::m_dbgDrawSize
float m_dbgDrawSize
Definition: btTypedConstraint.h:405
btQuantizedBvh::deSerializeDouble
virtual void deSerializeDouble(struct btQuantizedBvhDoubleData &quantizedBvhDoubleData)
Definition: btQuantizedBvh.cpp:1238
btGeneric6DofConstraintDoubleData2::m_angularLowerLimit
btVector3DoubleData m_angularLowerLimit
Definition: btGeneric6DofConstraint.h:606
btGeneric6DofSpring2ConstraintDoubleData2::m_linearSpringStiffnessLimited
char m_linearSpringStiffnessLimited[4]
Definition: btGeneric6DofSpring2Constraint.h:565
btGeneric6DofConstraintData::m_linearUpperLimit
btVector3FloatData m_linearUpperLimit
Definition: btGeneric6DofConstraint.h:586
btPoint2PointConstraintFloatData::m_pivotInB
btVector3FloatData m_pivotInB
Definition: btPoint2PointConstraint.h:138
btConeShape
The btConeShape implements a cone shape primitive, centered around the origin and aligned with the Y ...
Definition: btConeShape.h:23
btWorldImporter::createConeShapeZ
virtual btCollisionShape * createConeShapeZ(btScalar radius, btScalar height)
Definition: btWorldImporter.cpp:1745
PHY_DOUBLE
Definition: btConcaveShape.h:27
PHY_SHORT
Definition: btConcaveShape.h:29
btTypedConstraint::setOverrideNumSolverIterations
void setOverrideNumSolverIterations(int overideNumIterations)
override the number of constraint solver iterations used to solve this constraint -1 will use the def...
Definition: btTypedConstraint.h:162
btWorldImporter::createOptimizedBvh
virtual btOptimizedBvh * createOptimizedBvh()
acceleration and connectivity structures
Definition: btWorldImporter.cpp:1759
btGeneric6DofSpringConstraint::setEquilibriumPoint
void setEquilibriumPoint()
Definition: btGeneric6DofSpringConstraint.cpp:79
btGearConstraintDoubleData
Definition: btGearConstraint.h:118
btGeneric6DofSpringConstraint::setDamping
void setDamping(int index, btScalar damping)
Definition: btGeneric6DofSpringConstraint.cpp:72
btCharIndexTripletData::m_values
unsigned char m_values[3]
Definition: btStridingMeshInterface.h:123
btWorldImporter::m_shapeMap
btHashMap< btHashPtr, btCollisionShape * > m_shapeMap
Definition: btWorldImporter.h:96
btGeneric6DofSpringConstraintData::m_springEnabled
int m_springEnabled[6]
Definition: btGeneric6DofSpringConstraint.h:101
btMultiSphereShapeData::m_localPositionArrayPtr
btPositionAndRadius * m_localPositionArrayPtr
Definition: btMultiSphereShape.h:87
btGImpactMeshShapeData::m_meshInterface
btStridingMeshInterfaceData m_meshInterface
Definition: btGImpactShape.h:1149
btVector3::setW
void setW(btScalar _w)
Set the w value.
Definition: btVector3.h:583
btDynamicsWorld::removeRigidBody
virtual void removeRigidBody(btRigidBody *body)=0
btStridingMeshInterfaceData::m_numMeshParts
int m_numMeshParts
Definition: btStridingMeshInterface.h:150
btCompoundShapeChildData::m_transform
btTransformFloatData m_transform
Definition: btCompoundShape.h:181
btConeTwistConstraintDoubleData
Definition: btConeTwistConstraint.h:363
btSliderConstraint::setUpperAngLimit
void setUpperAngLimit(btScalar upperLimit)
Definition: btSliderConstraint.h:199
MULTI_SPHERE_SHAPE_PROXYTYPE
Definition: btBroadphaseProxy.h:41
btCollisionObjectDoubleData::m_friction
double m_friction
Definition: btCollisionObject.h:614
btGeneric6DofSpring2ConstraintDoubleData2::m_rotateOrder
int m_rotateOrder
Definition: btGeneric6DofSpring2Constraint.h:588
btWorldImporter::duplicateName
char * duplicateName(const char *name)
Definition: btWorldImporter.cpp:514
btAlignedFree
#define btAlignedFree(ptr)
Definition: btAlignedAllocator.h:48
btPositionAndRadius::m_pos
btVector3FloatData m_pos
Definition: btMultiSphereShape.h:79
btTypedConstraintDoubleData
Definition: btTypedConstraint.h:416
btCollisionObject
btCollisionObject can be used to manage collision detection objects.
Definition: btCollisionObject.h:49
btWorldImporter::createBoxShape
virtual btCollisionShape * createBoxShape(const btVector3 &halfExtents)
Definition: btWorldImporter.cpp:1675
btHingeConstraintFloatData::m_relaxationFactor
float m_relaxationFactor
Definition: btHingeConstraint.h:429
btBvhTriangleMeshShape::setOptimizedBvh
void setOptimizedBvh(btOptimizedBvh *bvh, const btVector3 &localScaling=btVector3(1, 1, 1))
Definition: btBvhTriangleMeshShape.cpp:356
btHashMap::insert
void insert(const Key &key, const Value &value)
Definition: btHashMap.h:269
btWorldImporter::m_allocatedConstraints
btAlignedObjectArray< btTypedConstraint * > m_allocatedConstraints
Definition: btWorldImporter.h:72
btHingeConstraintDoubleData2::m_limitSoftness
double m_limitSoftness
Definition: btHingeConstraint.h:449
btWorldImporter::createScaledTrangleMeshShape
virtual class btScaledBvhTriangleMeshShape * createScaledTrangleMeshShape(btBvhTriangleMeshShape *meshShape, const btVector3 &localScalingbtBvhTriangleMeshShape)
Definition: btWorldImporter.cpp:1819
btVector3::setZero
void setZero()
Definition: btVector3.h:681
btGeneric6DofConstraintDoubleData2::m_angularUpperLimit
btVector3DoubleData m_angularUpperLimit
Definition: btGeneric6DofConstraint.h:605
btConeTwistConstraintData::m_biasFactor
float m_biasFactor
Definition: btConeTwistConstraint.h:396
btWorldImporter::createGeneric6DofSpring2Constraint
virtual btGeneric6DofSpring2Constraint * createGeneric6DofSpring2Constraint(btRigidBody &rbA, btRigidBody &rbB, const btTransform &frameInA, const btTransform &frameInB, int rotateOrder)
Definition: btWorldImporter.cpp:1898
btRigidBody
The btRigidBody is the main class for rigid body objects.
Definition: btRigidBody.h:62
btSliderConstraintDoubleData::m_linearUpperLimit
double m_linearUpperLimit
Definition: btSliderConstraint.h:327
btOptimizedBvh
The btOptimizedBvh extends the btQuantizedBvh to create AABB tree for triangle meshes, through the btStridingMeshInterface.
Definition: btOptimizedBvh.h:27
btSliderConstraintDoubleData::m_useLinearReferenceFrameA
int m_useLinearReferenceFrameA
Definition: btSliderConstraint.h:333
btConvexInternalShapeData::m_localScaling
btVector3FloatData m_localScaling
Definition: btConvexInternalShape.h:148
btGeneric6DofSpring2ConstraintDoubleData2::m_linearLowerLimit
btVector3DoubleData m_linearLowerLimit
Definition: btGeneric6DofSpring2Constraint.h:550
btStridingMeshInterfaceData::m_scaling
btVector3FloatData m_scaling
Definition: btStridingMeshInterface.h:149
D6_SPRING_CONSTRAINT_TYPE
Definition: btTypedConstraint.h:44
btGeneric6DofConstraintDoubleData2::m_useLinearReferenceFrameA
int m_useLinearReferenceFrameA
Definition: btGeneric6DofConstraint.h:608
btCollisionShape::setMargin
virtual void setMargin(btScalar margin)=0
btGImpactMeshShapeData::m_gimpactSubType
int m_gimpactSubType
Definition: btGImpactShape.h:1155
btGeneric6DofSpring2Constraint::setEquilibriumPoint
void setEquilibriumPoint()
Definition: btGeneric6DofSpring2Constraint.cpp:1052
btWorldImporter::createCollisionObject
virtual btCollisionObject * createCollisionObject(const btTransform &startTransform, btCollisionShape *shape, const char *bodyName)
Definition: btWorldImporter.cpp:1629
btIndexedMesh::m_triangleIndexBase
const unsigned char * m_triangleIndexBase
Definition: btTriangleIndexVertexArray.h:31
btGeneric6DofSpring2ConstraintData::m_linearSpringStiffnessLimited
char m_linearSpringStiffnessLimited[4]
Definition: btGeneric6DofSpring2Constraint.h:517
btGeneric6DofSpring2Constraint::setLinearUpperLimit
void setLinearUpperLimit(const btVector3 &linearUpper)
Definition: btGeneric6DofSpring2Constraint.h:366
btRigidBodyFloatData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btRigidBody.h:564
btTypedConstraintData
this structure is not used, except for loading pre-2.82 .bullet files
Definition: btTypedConstraint.h:393
btGeneric6DofSpring2Constraint::setLinearLowerLimit
void setLinearLowerLimit(const btVector3 &linearLower)
Definition: btGeneric6DofSpring2Constraint.h:364
SLIDER_CONSTRAINT_TYPE
Definition: btTypedConstraint.h:42
btRigidBodyDoubleData::m_angularFactor
btVector3DoubleData m_angularFactor
Definition: btRigidBody.h:596
btGeneric6DofConstraintDoubleData2::m_rbAFrame
btTransformDoubleData m_rbAFrame
Definition: btGeneric6DofConstraint.h:599
btHingeConstraintDoubleData::m_upperLimit
float m_upperLimit
Definition: btHingeConstraint.h:367
btGeneric6DofSpring2Constraint::setAngularLowerLimit
void setAngularLowerLimit(const btVector3 &angularLower)
Definition: btGeneric6DofSpring2Constraint.h:369
btPositionAndRadius::m_radius
float m_radius
Definition: btMultiSphereShape.h:80
btCollisionObject::setWorldTransform
void setWorldTransform(const btTransform &worldTrans)
Definition: btCollisionObject.h:380
btConvexInternalShapeData::m_implicitShapeDimensions
btVector3FloatData m_implicitShapeDimensions
Definition: btConvexInternalShape.h:150
btConvexHullShapeData::m_unscaledPointsFloatPtr
btVector3FloatData * m_unscaledPointsFloatPtr
Definition: btConvexHullShape.h:105
btWorldImporter::m_indexArrays
btAlignedObjectArray< int * > m_indexArrays
Definition: btWorldImporter.h:80
btScaledTriangleMeshShapeData::m_localScaling
btVector3FloatData m_localScaling
Definition: btScaledBvhTriangleMeshShape.h:74
btTypedConstraintFloatData::m_isEnabled
int m_isEnabled
Definition: btTypedConstraint.h:384
btCollisionShape::setLocalScaling
virtual void setLocalScaling(const btVector3 &scaling)=0
btWorldImporter::convertConstraintFloat
void convertConstraintFloat(btTypedConstraintFloatData *constraintData, btRigidBody *rbA, btRigidBody *rbB, int fileVersion)
Definition: btWorldImporter.cpp:749
btSliderConstraintDoubleData
Definition: btSliderConstraint.h:321
btTriangleMeshShapeData::m_quantizedDoubleBvh
btQuantizedBvhDoubleData * m_quantizedDoubleBvh
Definition: btBvhTriangleMeshShape.h:131
btGearConstraintDoubleData::m_axisInA
btVector3DoubleData m_axisInA
Definition: btGearConstraint.h:122
btCollisionObject::getCollisionFlags
int getCollisionFlags() const
Definition: btCollisionObject.h:483
btGearConstraintFloatData::m_axisInA
btVector3FloatData m_axisInA
Definition: btGearConstraint.h:111
btWorldImporter::setDynamicsWorldInfo
virtual void setDynamicsWorldInfo(const btVector3 &gravity, const btContactSolverInfo &solverInfo)
those virtuals are called by load and can be overridden by the user
Definition: btWorldImporter.cpp:1634
btConeTwistConstraintDoubleData::m_rbBFrame
btTransformDoubleData m_rbBFrame
Definition: btConeTwistConstraint.h:367
btBoxShape
The btBoxShape is a box primitive around the origin, its sides axis aligned with length specified by ...
Definition: btBoxShape.h:26
btConeTwistConstraintDoubleData::m_biasFactor
double m_biasFactor
Definition: btConeTwistConstraint.h:374
btWorldImporter::createMeshInterface
virtual btTriangleIndexVertexArray * createMeshInterface(btStridingMeshInterfaceData &meshData)
Definition: btWorldImporter.cpp:1415
btWorldImporter::createConeShapeY
virtual btCollisionShape * createConeShapeY(btScalar radius, btScalar height)
Definition: btWorldImporter.cpp:1738
btGeneric6DofSpring2ConstraintData
Definition: btGeneric6DofSpring2Constraint.h:495
btVector3
btVector3 can be used to represent 3D points and vectors.
Definition: btVector3.h:83
btWorldImporter::getNumConstraints
int getNumConstraints() const
Definition: btWorldImporter.cpp:1995
ContactAddedCallback
bool(* ContactAddedCallback)(btManifoldPoint &cp, const btCollisionObjectWrapper *colObj0Wrap, int partId0, int index0, const btCollisionObjectWrapper *colObj1Wrap, int partId1, int index1)
Definition: btManifoldResult.h:32
btGeneric6DofSpring2ConstraintData::m_linearSpringDamping
btVector3FloatData m_linearSpringDamping
Definition: btGeneric6DofSpring2Constraint.h:512
btGeneric6DofSpring2ConstraintData::m_angularSpringStiffnessLimited
char m_angularSpringStiffnessLimited[4]
Definition: btGeneric6DofSpring2Constraint.h:537
btRigidBodyFloatData::m_inverseMass
float m_inverseMass
Definition: btRigidBody.h:577
btAlignedObjectArray::size
int size() const
return the number of elements in the array
Definition: btAlignedObjectArray.h:155
btHingeConstraintFloatData::m_useReferenceFrameA
int m_useReferenceFrameA
Definition: btHingeConstraint.h:418
btTypedConstraintData::m_objectType
int m_objectType
Definition: btTypedConstraint.h:399
btWorldImporter::createPoint2PointConstraint
virtual btPoint2PointConstraint * createPoint2PointConstraint(btRigidBody &rbA, btRigidBody &rbB, const btVector3 &pivotInA, const btVector3 &pivotInB)
constraints
Definition: btWorldImporter.cpp:1840
btHingeConstraint::setAngularOnly
void setAngularOnly(bool angularOnly)
Definition: btHingeConstraint.h:163
btTransform
The btTransform class supports rigid transforms with only translation and rotation and no scaling/she...
Definition: btTransform.h:34
btConeTwistConstraint
btConeTwistConstraint can be used to simulate ragdoll joints (upper arm, leg etc) ...
Definition: btConeTwistConstraint.h:62
btTypedConstraintData::m_overrideNumSolverIterations
int m_overrideNumSolverIterations
Definition: btTypedConstraint.h:408
btRigidBody::setMassProps
void setMassProps(btScalar mass, const btVector3 &inertia)
Definition: btRigidBody.cpp:233
btContactSolverInfo
Definition: btContactSolverInfo.h:65
btTypedConstraintData::m_breakingImpulseThreshold
float m_breakingImpulseThreshold
Definition: btTypedConstraint.h:410
btCollisionObjectFloatData::m_friction
float m_friction
Definition: btCollisionObject.h:649
btStridingMeshInterface
The btStridingMeshInterface is the interface class for high performance generic access to triangle me...
Definition: btStridingMeshInterface.h:30
btConeShapeZ
btConeShapeZ implements a Cone shape, around the Z axis
Definition: btConeShape.h:133
btCollisionShape::isNonMoving
bool isNonMoving() const
Definition: btCollisionShape.h:77
btHingeConstraintDoubleData::m_angularOnly
int m_angularOnly
Definition: btHingeConstraint.h:361
btWorldImporter::m_allocatedNames
btAlignedObjectArray< char * > m_allocatedNames
Definition: btWorldImporter.h:78
btCollisionObject::setCollisionFlags
void setCollisionFlags(int flags)
Definition: btCollisionObject.h:488
btGeneric6DofSpring2ConstraintData::m_rbAFrame
btTransformFloatData m_rbAFrame
Definition: btGeneric6DofSpring2Constraint.h:498
btRigidBodyDoubleData::m_collisionObjectData
btCollisionObjectDoubleData m_collisionObjectData
Definition: btRigidBody.h:592
btHingeConstraintDoubleData::m_biasFactor
float m_biasFactor
Definition: btHingeConstraint.h:369
btGeneric6DofSpring2ConstraintData::m_angularEquilibriumPoint
btVector3FloatData m_angularEquilibriumPoint
Definition: btGeneric6DofSpring2Constraint.h:533
btConeShapeData::m_upIndex
int m_upIndex
Definition: btConeShape.h:157
btCollisionObjectFloatData::m_name
char * m_name
Definition: btCollisionObject.h:640
btHingeConstraintDoubleData::m_rbAFrame
btTransformDoubleData m_rbAFrame
Definition: btHingeConstraint.h:358
btCollisionObjectDoubleData::m_worldTransform
btTransformDoubleData m_worldTransform
Definition: btCollisionObject.h:607
btQuantizedBvh::deSerializeFloat
virtual void deSerializeFloat(struct btQuantizedBvhFloatData &quantizedBvhFloatData)
Definition: btQuantizedBvh.cpp:1167
btTriangleMeshShapeData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btBvhTriangleMeshShape.h:124
PHY_INTEGER
Definition: btConcaveShape.h:28
btWorldImporter::getConstraintByIndex
btTypedConstraint * getConstraintByIndex(int index) const
Definition: btWorldImporter.cpp:2000
CONETWIST_CONSTRAINT_TYPE
Definition: btTypedConstraint.h:40
btGeneric6DofSpringConstraintData::m_equilibriumPoint
float m_equilibriumPoint[6]
Definition: btGeneric6DofSpringConstraint.h:102
btTypedConstraint
TypedConstraint is the baseclass for Bullet constraints and vehicles.
Definition: btTypedConstraint.h:78
btHingeConstraint::setLimit
void setLimit(btScalar low, btScalar high, btScalar _softness=0.9f, btScalar _biasFactor=0.3f, btScalar _relaxationFactor=1.0f)
Definition: btHingeConstraint.h:185
btTriangleIndexVertexArray::getNumSubParts
virtual int getNumSubParts() const
getNumSubParts returns the number of seperate subparts each subpart has a continuous array of vertice...
Definition: btTriangleIndexVertexArray.h:109
btWorldImporter::getNameForPointer
const char * getNameForPointer(const void *ptr) const
Definition: btWorldImporter.cpp:1977
btAlignedObjectArray::resize
void resize(int newsize, const T &fillData=T())
Definition: btAlignedObjectArray.h:218
CONVEX_HULL_SHAPE_PROXYTYPE
Definition: btBroadphaseProxy.h:35
btGeneric6DofSpringConstraintDoubleData2
Definition: btGeneric6DofSpringConstraint.h:107
btSliderConstraintData::m_rbAFrame
btTransformFloatData m_rbAFrame
Definition: btSliderConstraint.h:306
btCompoundShapeData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btCompoundShape.h:188
btTypedConstraintFloatData::m_dbgDrawSize
float m_dbgDrawSize
Definition: btTypedConstraint.h:378
btWorldImporter::getFixedBody
static btRigidBody & getFixedBody()
Definition: btWorldImporter.cpp:1833
btHingeConstraintFloatData::m_angularOnly
int m_angularOnly
Definition: btHingeConstraint.h:419
btQuantizedBvh::isQuantized
bool isQuantized()
Definition: btQuantizedBvh.h:488
btHingeConstraintFloatData::m_enableAngularMotor
int m_enableAngularMotor
Definition: btHingeConstraint.h:421
btHingeConstraintDoubleData2::m_upperLimit
double m_upperLimit
Definition: btHingeConstraint.h:448
btDynamicsWorld::addConstraint
virtual void addConstraint(btTypedConstraint *constraint, bool disableCollisionsBetweenLinkedBodies=false)
Definition: btDynamicsWorld.h:72
btGeneric6DofSpring2Constraint::setStiffness
void setStiffness(int index, btScalar stiffness, bool limitIfNeeded=true)
Definition: btGeneric6DofSpring2Constraint.cpp:1028
btTypedConstraint::setEnabled
void setEnabled(bool enabled)
Definition: btTypedConstraint.h:212
btHingeConstraintFloatData
Definition: btHingeConstraint.h:413
btGeneric6DofSpringConstraintDoubleData2::m_equilibriumPoint
double m_equilibriumPoint[6]
Definition: btGeneric6DofSpringConstraint.h:112
btGImpactMeshShapeData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btGImpactShape.h:1145
btGeneric6DofSpring2ConstraintDoubleData2::m_angularUpperLimit
btVector3DoubleData m_angularUpperLimit
Definition: btGeneric6DofSpring2Constraint.h:569
btPoint2PointConstraintDoubleData::m_pivotInB
btVector3DoubleData m_pivotInB
Definition: btPoint2PointConstraint.h:157
btWorldImporter::getNumTriangleInfoMaps
int getNumTriangleInfoMaps() const
Definition: btWorldImporter.cpp:2014
btWorldImporter::m_allocatedCollisionShapes
btAlignedObjectArray< btCollisionShape * > m_allocatedCollisionShapes
Definition: btWorldImporter.h:70
btTriangleInfoMap::deSerialize
void deSerialize(struct btTriangleInfoMapData &data)
fills the dataBuffer and returns the struct name (and 0 on failure)
Definition: btTriangleInfoMap.h:204
btWorldImporter::createHingeConstraint
virtual btHingeConstraint * createHingeConstraint(btRigidBody &rbA, btRigidBody &rbB, const btTransform &rbAFrame, const btTransform &rbBFrame, bool useReferenceFrameA=false)
Definition: btWorldImporter.cpp:1855
btStaticPlaneShapeData::m_localScaling
btVector3FloatData m_localScaling
Definition: btStaticPlaneShape.h:76
btGeneric6DofSpring2ConstraintDoubleData2::m_angularSpringStiffness
btVector3DoubleData m_angularSpringStiffness
Definition: btGeneric6DofSpring2Constraint.h:579
btCylinderShape
The btCylinderShape class implements a cylinder shape primitive, centered around the origin...
Definition: btCylinderShape.h:24
btIndexedMesh::m_numVertices
int m_numVertices
Definition: btTriangleIndexVertexArray.h:34
btGeneric6DofSpringConstraintData::m_springStiffness
float m_springStiffness[6]
Definition: btGeneric6DofSpringConstraint.h:103
gContactAddedCallback
ContactAddedCallback gContactAddedCallback
This is to allow MaterialCombiner/Custom Friction/Restitution values.
Definition: btManifoldResult.cpp:23
btGeneric6DofSpring2ConstraintDoubleData2
Definition: btGeneric6DofSpring2Constraint.h:543
btIntIndexData
Definition: btStridingMeshInterface.h:104
RotateOrder
RotateOrder
Definition: btGeneric6DofSpring2Constraint.h:59
btGearConstraintDoubleData::m_ratio
double m_ratio
Definition: btGearConstraint.h:125
btGeneric6DofSpringConstraintDoubleData2::m_springDamping
double m_springDamping[6]
Definition: btGeneric6DofSpringConstraint.h:114
btScaledBvhTriangleMeshShape
The btScaledBvhTriangleMeshShape allows to instance a scaled version of an existing btBvhTriangleMesh...
Definition: btScaledBvhTriangleMeshShape.h:24
btGeneric6DofConstraint::setLinearLowerLimit
void setLinearLowerLimit(const btVector3 &linearLower)
Definition: btGeneric6DofConstraint.h:455
btWorldImporter.h
btGeneric6DofConstraintDoubleData2::m_linearUpperLimit
btVector3DoubleData m_linearUpperLimit
Definition: btGeneric6DofConstraint.h:602
btGeneric6DofSpring2ConstraintData::m_angularSpringStiffness
btVector3FloatData m_angularSpringStiffness
Definition: btGeneric6DofSpring2Constraint.h:531
btGeneric6DofSpring2ConstraintDoubleData2::m_linearSpringStiffness
btVector3DoubleData m_linearSpringStiffness
Definition: btGeneric6DofSpring2Constraint.h:559
btWorldImporter::getCollisionShapeByIndex
btCollisionShape * getCollisionShapeByIndex(int index)
Definition: btWorldImporter.cpp:1942
btWorldImporter::getRigidBodyByName
btRigidBody * getRigidBodyByName(const char *name)
Definition: btWorldImporter.cpp:1957
btHingeConstraintFloatData::m_maxMotorImpulse
float m_maxMotorImpulse
Definition: btHingeConstraint.h:423
btSliderConstraint
Definition: btSliderConstraint.h:71
btHingeConstraintDoubleData2::m_rbBFrame
btTransformDoubleData m_rbBFrame
Definition: btHingeConstraint.h:440
btAlignedAlloc
#define btAlignedAlloc(size, alignment)
Definition: btAlignedAllocator.h:47
btWorldImporter::m_bodyMap
btHashMap< btHashPtr, btCollisionObject * > m_bodyMap
Definition: btWorldImporter.h:97
btGeneric6DofSpring2ConstraintDoubleData2::m_angularSpringDamping
btVector3DoubleData m_angularSpringDamping
Definition: btGeneric6DofSpring2Constraint.h:580
btCapsuleShapeZ
btCapsuleShapeZ represents a capsule around the Z axis the total height is height+2*radius, so the height is just the height between the center of each &#39;sphere&#39; of the capsule caps.
Definition: btCapsuleShape.h:134
btMeshPartData::m_indices32
btIntIndexData * m_indices32
Definition: btStridingMeshInterface.h:134
btCapsuleShape::deSerializeFloat
void deSerializeFloat(struct btCapsuleShapeData *dataBuffer)
Definition: btCapsuleShape.h:175
btBvhTriangleMeshShape::setTriangleInfoMap
void setTriangleInfoMap(btTriangleInfoMap *triangleInfoMap)
Definition: btBvhTriangleMeshShape.h:97
btStaticPlaneShapeData::m_planeNormal
btVector3FloatData m_planeNormal
Definition: btStaticPlaneShape.h:77
btSliderConstraintDoubleData::m_rbBFrame
btTransformDoubleData m_rbBFrame
Definition: btSliderConstraint.h:325
btConvexHullShape::addPoint
void addPoint(const btVector3 &point, bool recalculateLocalAabb=true)
Definition: btConvexHullShape.cpp:54
btWorldImporter::createSliderConstraint
virtual btSliderConstraint * createSliderConstraint(btRigidBody &rbA, btRigidBody &rbB, const btTransform &frameInA, const btTransform &frameInB, bool useLinearReferenceFrameA)
Definition: btWorldImporter.cpp:1915
btCompoundShapeData::m_numChildShapes
int m_numChildShapes
Definition: btCompoundShape.h:194
btGeneric6DofSpringConstraintData::m_springDamping
float m_springDamping[6]
Definition: btGeneric6DofSpringConstraint.h:104
COMPOUND_SHAPE_PROXYTYPE
Definition: btBroadphaseProxy.h:71
btConeTwistConstraintData
this structure is not used, except for loading pre-2.82 .bullet files
Definition: btConeTwistConstraint.h:385
btConvexHullShape
The btConvexHullShape implements an implicit convex hull of an array of vertices. ...
Definition: btConvexHullShape.h:26
btHingeConstraintDoubleData::m_enableAngularMotor
int m_enableAngularMotor
Definition: btHingeConstraint.h:362
btCollisionObjectDoubleData::m_collisionShape
void * m_collisionShape
Definition: btCollisionObject.h:603
btCollisionShape::getShapeType
int getShapeType() const
Definition: btCollisionShape.h:112
POINT2POINT_CONSTRAINT_TYPE
Definition: btTypedConstraint.h:38
btGeneric6DofSpring2Constraint::enableSpring
void enableSpring(int index, bool onOff)
Definition: btGeneric6DofSpring2Constraint.cpp:1019
D6_CONSTRAINT_TYPE
Definition: btTypedConstraint.h:41
btGeneric6DofSpring2Constraint::setAngularUpperLimit
void setAngularUpperLimit(const btVector3 &angularUpper)
Definition: btGeneric6DofSpring2Constraint.h:393
btVector3FloatData
Definition: btVector3.h:1311
btTypedConstraintDoubleData::m_dbgDrawSize
double m_dbgDrawSize
Definition: btTypedConstraint.h:428
btTriangleMeshShapeData::m_collisionMargin
float m_collisionMargin
Definition: btBvhTriangleMeshShape.h:135
btTriangleInfoMap
The btTriangleInfoMap stores edge angle information for some triangles. You can compute this informat...
Definition: btTriangleInfoMap.h:58
btHingeConstraintDoubleData2::m_lowerLimit
double m_lowerLimit
Definition: btHingeConstraint.h:447
btTriangleMeshShapeData::m_quantizedFloatBvh
btQuantizedBvhFloatData * m_quantizedFloatBvh
Definition: btBvhTriangleMeshShape.h:130
btHingeConstraintDoubleData2::m_rbAFrame
btTransformDoubleData m_rbAFrame
Definition: btHingeConstraint.h:439
btCompoundShape
The btCompoundShape allows to store multiple other btCollisionShapes This allows for moving concave c...
Definition: btCompoundShape.h:54
btGeneric6DofSpring2ConstraintDoubleData2::m_angularSpringDampingLimited
char m_angularSpringDampingLimited[4]
Definition: btGeneric6DofSpring2Constraint.h:586
HINGE_CONSTRAINT_TYPE
Definition: btTypedConstraint.h:39
btHingeConstraintFloatData::m_lowerLimit
float m_lowerLimit
Definition: btHingeConstraint.h:425
btGImpactShapeInterface::updateBound
void updateBound()
performs refit operation
Definition: btGImpactShape.h:123
btVector3::deSerializeFloat
void deSerializeFloat(const struct btVector3FloatData &dataIn)
Definition: btVector3.h:1329
btCapsuleShapeData::m_upAxis
int m_upAxis
Definition: btCapsuleShape.h:153
btCompoundShapeChildData::m_childShape
btCollisionShapeData * m_childShape
Definition: btCompoundShape.h:182
btWorldImporter::m_allocatedTriangleIndexArrays
btAlignedObjectArray< btTriangleIndexVertexArray * > m_allocatedTriangleIndexArrays
Definition: btWorldImporter.h:75
btGeneric6DofSpring2ConstraintData::m_linearEnableSpring
char m_linearEnableSpring[4]
Definition: btGeneric6DofSpring2Constraint.h:516
btPoint2PointConstraintDoubleData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 th...
Definition: btPoint2PointConstraint.h:153
btStaticPlaneShape
The btStaticPlaneShape simulates an infinite non-moving (static) collision plane. ...
Definition: btStaticPlaneShape.h:23
btGeneric6DofSpring2ConstraintData::m_linearSpringDampingLimited
char m_linearSpringDampingLimited[4]
Definition: btGeneric6DofSpring2Constraint.h:518
btTransform::deSerializeDouble
void deSerializeDouble(const struct btTransformDoubleData &dataIn)
Definition: btTransform.h:292
btWorldImporter::m_allocatedRigidBodies
btAlignedObjectArray< btCollisionObject * > m_allocatedRigidBodies
Definition: btWorldImporter.h:71
btCollisionObjectDoubleData::m_restitution
double m_restitution
Definition: btCollisionObject.h:618
btGeneric6DofConstraint::setLinearUpperLimit
void setLinearUpperLimit(const btVector3 &linearUpper)
Definition: btGeneric6DofConstraint.h:465
btWorldImporter::~btWorldImporter
virtual ~btWorldImporter()
Definition: btWorldImporter.cpp:28
btHingeConstraintDoubleData::m_limitSoftness
float m_limitSoftness
Definition: btHingeConstraint.h:368
btIndexedMesh::m_vertexStride
int m_vertexStride
Definition: btTriangleIndexVertexArray.h:37
btSliderConstraintDoubleData::m_rbAFrame
btTransformDoubleData m_rbAFrame
Definition: btSliderConstraint.h:324
btGImpactMeshShapeData::m_localScaling
btVector3FloatData m_localScaling
Definition: btGImpactShape.h:1151
btHingeConstraintDoubleData2::m_enableAngularMotor
int m_enableAngularMotor
Definition: btHingeConstraint.h:443
btGeneric6DofConstraintData::m_angularUpperLimit
btVector3FloatData m_angularUpperLimit
Definition: btGeneric6DofConstraint.h:589
btWorldImporter::m_dynamicsWorld
btDynamicsWorld * m_dynamicsWorld
Definition: btWorldImporter.h:66
btGeneric6DofConstraintData::m_rbAFrame
btTransformFloatData m_rbAFrame
Definition: btGeneric6DofConstraint.h:583
btPoint2PointConstraintFloatData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btPoint2PointConstraint.h:134
btGeneric6DofSpring2Constraint::setDamping
void setDamping(int index, btScalar damping, bool limitIfNeeded=true)
Definition: btGeneric6DofSpring2Constraint.cpp:1040
btWorldImporter::m_floatVertexArrays
btAlignedObjectArray< btVector3FloatData * > m_floatVertexArrays
Definition: btWorldImporter.h:84
btRigidBody::setAngularFactor
void setAngularFactor(const btVector3 &angFac)
Definition: btRigidBody.h:493
btTypedConstraintDoubleData::m_overrideNumSolverIterations
int m_overrideNumSolverIterations
Definition: btTypedConstraint.h:431
btConeTwistConstraintData::m_relaxationFactor
float m_relaxationFactor
Definition: btConeTwistConstraint.h:397
btWorldImporter::m_objectNameMap
btHashMap< btHashPtr, const char * > m_objectNameMap
Definition: btWorldImporter.h:94
btTypedConstraintData::m_isEnabled
int m_isEnabled
Definition: btTypedConstraint.h:411
btHingeConstraintDoubleData::m_maxMotorImpulse
float m_maxMotorImpulse
Definition: btHingeConstraint.h:364
btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK
Definition: btCollisionObject.h:136
btTransform::inverse
btTransform inverse() const
Return the inverse of this transform.
Definition: btTransform.h:188
btDynamicsWorld::getSolverInfo
btContactSolverInfo & getSolverInfo()
Definition: btDynamicsWorld.h:133
btTransformDoubleData::m_origin
btVector3DoubleData m_origin
Definition: btTransform.h:262
btWorldImporter::createCapsuleShapeX
virtual btCollisionShape * createCapsuleShapeX(btScalar radius, btScalar height)
Definition: btWorldImporter.cpp:1689
RO_XYZ
Definition: btGeneric6DofSpring2Constraint.h:61
btGeneric6DofSpring2ConstraintDoubleData2::m_linearSpringDampingLimited
char m_linearSpringDampingLimited[4]
Definition: btGeneric6DofSpring2Constraint.h:566
btGeneric6DofSpring2ConstraintDoubleData2::m_angularEnableSpring
char m_angularEnableSpring[4]
Definition: btGeneric6DofSpring2Constraint.h:584
btGeneric6DofConstraint::setAngularLowerLimit
void setAngularLowerLimit(const btVector3 &angularLower)
Definition: btGeneric6DofConstraint.h:475
btGeneric6DofSpringConstraint
Generic 6 DOF constraint that allows to set spring motors to any translational and rotational DOF...
Definition: btGeneric6DofSpringConstraint.h:44
btSliderConstraintData::m_angularLowerLimit
float m_angularLowerLimit
Definition: btSliderConstraint.h:313
btCollisionShapeData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btCollisionShape.h:155
btHingeConstraintDoubleData::m_useReferenceFrameA
int m_useReferenceFrameA
Definition: btHingeConstraint.h:360
btWorldImporter::m_nameBodyMap
btHashMap< btHashString, btRigidBody * > m_nameBodyMap
Definition: btWorldImporter.h:92
btWorldImporter::createMultiSphereShape
virtual class btMultiSphereShape * createMultiSphereShape(const btVector3 *positions, const btScalar *radi, int numSpheres)
Definition: btWorldImporter.cpp:1826
btTypedConstraintFloatData::m_overrideNumSolverIterations
int m_overrideNumSolverIterations
Definition: btTypedConstraint.h:381
btVector3::getX
const btScalar & getX() const
Return the x value.
Definition: btVector3.h:571
btCylinderShapeData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btCylinderShape.h:184
btHingeConstraintDoubleData2
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btHingeConstraint.h:436
btGeneric6DofSpring2ConstraintData::m_angularSpringDamping
btVector3FloatData m_angularSpringDamping
Definition: btGeneric6DofSpring2Constraint.h:532
btTypedConstraintFloatData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btTypedConstraint.h:366
btWorldImporter::convertConstraintDouble
void convertConstraintDouble(btTypedConstraintDoubleData *constraintData, btRigidBody *rbA, btRigidBody *rbB, int fileVersion)
Definition: btWorldImporter.cpp:1077
btScalar
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition: btScalar.h:279
btCylinderShapeX
Definition: btCylinderShape.h:137
btIndexedMesh::m_vertexType
PHY_ScalarType m_vertexType
Definition: btTriangleIndexVertexArray.h:46
btVector3DoubleData
Definition: btVector3.h:1316
btSliderConstraintData::m_useOffsetForConstraintFrame
int m_useOffsetForConstraintFrame
Definition: btSliderConstraint.h:316
btConeTwistConstraintData::m_swingSpan1
float m_swingSpan1
Definition: btConeTwistConstraint.h:392
btCylinderShapeData::m_upAxis
int m_upAxis
Definition: btCylinderShape.h:188
btHingeConstraintDoubleData2::m_useReferenceFrameA
int m_useReferenceFrameA
Definition: btHingeConstraint.h:441
btRigidBodyFloatData::m_linearFactor
btVector3FloatData m_linearFactor
Definition: btRigidBody.h:571
PHY_FLOAT
Definition: btConcaveShape.h:26
btIndexedMesh::m_vertexBase
const unsigned char * m_vertexBase
Definition: btTriangleIndexVertexArray.h:35
btHingeConstraint::enableAngularMotor
void enableAngularMotor(bool enableMotor, btScalar targetVelocity, btScalar maxMotorImpulse)
Definition: btHingeConstraint.h:168
btWorldImporter::getNumBvhs
int getNumBvhs() const
Definition: btWorldImporter.cpp:2005
btHingeConstraintFloatData::m_rbBFrame
btTransformFloatData m_rbBFrame
Definition: btHingeConstraint.h:417
STATIC_PLANE_PROXYTYPE
Definition: btBroadphaseProxy.h:67
btPoint2PointConstraintDoubleData2::m_pivotInB
btVector3DoubleData m_pivotInB
Definition: btPoint2PointConstraint.h:146
btMultiSphereShapeData
Definition: btMultiSphereShape.h:83
btGImpactMeshShape::setMargin
virtual void setMargin(btScalar margin)
Definition: btGImpactShape.h:978
btConvexHullShapeData::m_numUnscaledPoints
int m_numUnscaledPoints
Definition: btConvexHullShape.h:108
btGeneric6DofConstraintDoubleData2::m_rbBFrame
btTransformDoubleData m_rbBFrame
Definition: btGeneric6DofConstraint.h:600
btMeshPartData::m_vertices3d
btVector3DoubleData * m_vertices3d
Definition: btStridingMeshInterface.h:132