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

Bullet Collision Detection & Physics Library

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

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 #include "BulletCollision/Gimpact/btGImpactShape.h"
19
20 btWorldImporter::btWorldImporter(btDynamicsWorld* world)
21 :m_dynamicsWorld(world),
22 m_verboseMode(0)
23 {
24
25 }
26
27 btWorldImporter::~btWorldImporter()
28 {
29 }
30
31 void btWorldImporter::deleteAllData()
32 {
33 int i;
34 for (i=0;i<m_allocatedConstraints.size();i++)
35 {
36 if(m_dynamicsWorld)
37 m_dynamicsWorld->removeConstraint(m_allocatedConstraints[i]);
38 delete m_allocatedConstraints[i];
39 }
40 m_allocatedConstraints.clear();
41
42
43 for (i=0;i<m_allocatedRigidBodies.size();i++)
44 {
45 if(m_dynamicsWorld)
46 m_dynamicsWorld->removeRigidBody(btRigidBody::upcast(m_allocatedRigidBodies[i]));
47 delete m_allocatedRigidBodies[i];
48 }
49
50 m_allocatedRigidBodies.clear();
51
52
53 for (i=0;i<m_allocatedCollisionShapes.size();i++)
54 {
55 delete m_allocatedCollisionShapes[i];
56 }
57 m_allocatedCollisionShapes.clear();
58
59
60 for (i=0;i<m_allocatedBvhs.size();i++)
61 {
62 delete m_allocatedBvhs[i];
63 }
64 m_allocatedBvhs.clear();
65
66 for (i=0;i<m_allocatedTriangleInfoMaps.size();i++)
67 {
68 delete m_allocatedTriangleInfoMaps[i];
69 }
70 m_allocatedTriangleInfoMaps.clear();
71 for (i=0;i<m_allocatedTriangleIndexArrays.size();i++)
72 {
73 delete m_allocatedTriangleIndexArrays[i];
74 }
75 m_allocatedTriangleIndexArrays.clear();
76 for (i=0;i<m_allocatedNames.size();i++)
77 {
78 delete[] m_allocatedNames[i];
79 }
80 m_allocatedNames.clear();
81
82 for (i=0;i<m_allocatedbtStridingMeshInterfaceDatas.size();i++)
83 {
84 btStridingMeshInterfaceData* curData = m_allocatedbtStridingMeshInterfaceDatas[i];
85
86 for(int a = 0;a < curData->m_numMeshParts;a++)
87 {
88 btMeshPartData* curPart = &curData->m_meshPartsPtr[a];
89 if(curPart->m_vertices3f)
90 delete [] curPart->m_vertices3f;
91
92 if(curPart->m_vertices3d)
93 delete [] curPart->m_vertices3d;
94
95 if(curPart->m_indices32)
96 delete [] curPart->m_indices32;
97
98 if(curPart->m_3indices16)
99 delete [] curPart->m_3indices16;
100
101 if(curPart->m_indices16)
102 delete [] curPart->m_indices16;
103
104 if (curPart->m_3indices8)
105 delete [] curPart->m_3indices8;
106
107 }
108 delete [] curData->m_meshPartsPtr;
109 delete curData;
110 }
111 m_allocatedbtStridingMeshInterfaceDatas.clear();
112
113 for (i=0;i<m_indexArrays.size();i++)
114 {
115 btAlignedFree(m_indexArrays[i]);
116 }
117 m_indexArrays.clear();
118
119 for (i=0;i<m_shortIndexArrays.size();i++)
120 {
121 btAlignedFree(m_shortIndexArrays[i]);
122 }
123 m_shortIndexArrays.clear();
124
125 for (i=0;i<m_charIndexArrays.size();i++)
126 {
127 btAlignedFree(m_charIndexArrays[i]);
128 }
129 m_charIndexArrays.clear();
130
131 for (i=0;i<m_floatVertexArrays.size();i++)
132 {
133 btAlignedFree(m_floatVertexArrays[i]);
134 }
135 m_floatVertexArrays.clear();
136
137 for (i=0;i<m_doubleVertexArrays.size();i++)
138 {
139 btAlignedFree(m_doubleVertexArrays[i]);
140 }
141 m_doubleVertexArrays.clear();
142
143
144 }
145
146
147
148 btCollisionShape* btWorldImporter::convertCollisionShape( btCollisionShapeData* shapeData )
149 {
150 btCollisionShape* shape = 0;
151
152 switch (shapeData->m_shapeType)
153 {
154 case STATIC_PLANE_PROXYTYPE:
155 {
156 btStaticPlaneShapeData* planeData = (btStaticPlaneShapeData*)shapeData;
157 btVector3 planeNormal,localScaling;
158 planeNormal.deSerializeFloat(planeData->m_planeNormal);
159 localScaling.deSerializeFloat(planeData->m_localScaling);
160 shape = createPlaneShape(planeNormal,planeData->m_planeConstant);
161 shape->setLocalScaling(localScaling);
162
163 break;
164 }
165 case SCALED_TRIANGLE_MESH_SHAPE_PROXYTYPE:
166 {
167 btScaledTriangleMeshShapeData* scaledMesh = (btScaledTriangleMeshShapeData*) shapeData;
168 btCollisionShapeData* colShapeData = (btCollisionShapeData*) &scaledMesh->m_trimeshShapeData;
169 colShapeData->m_shapeType = TRIANGLE_MESH_SHAPE_PROXYTYPE;
170 btCollisionShape* childShape = convertCollisionShape(colShapeData);
171 btBvhTriangleMeshShape* meshShape = (btBvhTriangleMeshShape*)childShape;
172 btVector3 localScaling;
173 localScaling.deSerializeFloat(scaledMesh->m_localScaling);
174
175 shape = createScaledTrangleMeshShape(meshShape, localScaling);
176 break;
177 }
178 case GIMPACT_SHAPE_PROXYTYPE:
179 {
180 btGImpactMeshShapeData* gimpactData = (btGImpactMeshShapeData*) shapeData;
181 if (gimpactData->m_gimpactSubType == CONST_GIMPACT_TRIMESH_SHAPE)
182 {
183 btStridingMeshInterfaceData* interfaceData = createStridingMeshInterfaceData(&gimpactData->m_meshInterface);
184 btTriangleIndexVertexArray* meshInterface = createMeshInterface(*interfaceData);
185
186
187 btGImpactMeshShape* gimpactShape = createGimpactShape(meshInterface);
188 btVector3 localScaling;
189 localScaling.deSerializeFloat(gimpactData->m_localScaling);
190 gimpactShape->setLocalScaling(localScaling);
191 gimpactShape->setMargin(btScalar(gimpactData->m_collisionMargin));
192 gimpactShape->updateBound();
193 shape = gimpactShape;
194 } else
195 {
196 printf("unsupported gimpact sub type\n");
197 }
198 break;
199 }
200 //The btCapsuleShape* API has issue passing the margin/scaling/halfextents unmodified through the API
201 //so deal with this
202 case CAPSULE_SHAPE_PROXYTYPE:
203 {
204 btCapsuleShapeData* capData = (btCapsuleShapeData*)shapeData;
205
206
207 switch (capData->m_upAxis)
208 {
209 case 0:
210 {
211 shape = createCapsuleShapeX(1,1);
212 break;
213 }
214 case 1:
215 {
216 shape = createCapsuleShapeY(1,1);
217 break;
218 }
219 case 2:
220 {
221 shape = createCapsuleShapeZ(1,1);
222 break;
223 }
224 default:
225 {
226 printf("error: wrong up axis for btCapsuleShape\n");
227 }
228
229
230 };
231 if (shape)
232 {
233 btCapsuleShape* cap = (btCapsuleShape*) shape;
234 cap->deSerializeFloat(capData);
235 }
236 break;
237 }
238 case CYLINDER_SHAPE_PROXYTYPE:
239 case CONE_SHAPE_PROXYTYPE:
240 case BOX_SHAPE_PROXYTYPE:
241 case SPHERE_SHAPE_PROXYTYPE:
242 case MULTI_SPHERE_SHAPE_PROXYTYPE:
243 case CONVEX_HULL_SHAPE_PROXYTYPE:
244 {
245 btConvexInternalShapeData* bsd = (btConvexInternalShapeData*)shapeData;
246 btVector3 implicitShapeDimensions;
247 implicitShapeDimensions.deSerializeFloat(bsd->m_implicitShapeDimensions);
248 btVector3 localScaling;
249 localScaling.deSerializeFloat(bsd->m_localScaling);
250 btVector3 margin(bsd->m_collisionMargin,bsd->m_collisionMargin,bsd->m_collisionMargin);
251 switch (shapeData->m_shapeType)
252 {
253 case BOX_SHAPE_PROXYTYPE:
254 {
255 btBoxShape* box= (btBoxShape*)createBoxShape(implicitShapeDimensions/localScaling+margin);
256 //box->initializePolyhedralFeatures();
257 shape = box;
258
259 break;
260 }
261 case SPHERE_SHAPE_PROXYTYPE:
262 {
263 shape = createSphereShape(implicitShapeDimensions.getX());
264 break;
265 }
266
267 case CYLINDER_SHAPE_PROXYTYPE:
268 {
269 btCylinderShapeData* cylData = (btCylinderShapeData*) shapeData;
270 btVector3 halfExtents = implicitShapeDimensions+margin;
271 switch (cylData->m_upAxis)
272 {
273 case 0:
274 {
275 shape = createCylinderShapeX(halfExtents.getY(),halfExtents.getX());
276 break;
277 }
278 case 1:
279 {
280 shape = createCylinderShapeY(halfExtents.getX(),halfExtents.getY());
281 break;
282 }
283 case 2:
284 {
285 shape = createCylinderShapeZ(halfExtents.getX(),halfExtents.getZ());
286 break;
287 }
288 default:
289 {
290 printf("unknown Cylinder up axis\n");
291 }
292
293 };
294
295
296
297 break;
298 }
299 case CONE_SHAPE_PROXYTYPE:
300 {
301 btConeShapeData* conData = (btConeShapeData*) shapeData;
302 btVector3 halfExtents = implicitShapeDimensions;//+margin;
303 switch (conData->m_upIndex)
304 {
305 case 0:
306 {
307 shape = createConeShapeX(halfExtents.getY(),halfExtents.getX());
308 break;
309 }
310 case 1:
311 {
312 shape = createConeShapeY(halfExtents.getX(),halfExtents.getY());
313 break;
314 }
315 case 2:
316 {
317 shape = createConeShapeZ(halfExtents.getX(),halfExtents.getZ());
318 break;
319 }
320 default:
321 {
322 printf("unknown Cone up axis\n");
323 }
324
325 };
326
327
328
329 break;
330 }
331 case MULTI_SPHERE_SHAPE_PROXYTYPE:
332 {
333 btMultiSphereShapeData* mss = (btMultiSphereShapeData*)bsd;
334 int numSpheres = mss->m_localPositionArraySize;
335
336 btAlignedObjectArray<btVector3> tmpPos;
337 btAlignedObjectArray<btScalar> radii;
338 radii.resize(numSpheres);
339 tmpPos.resize(numSpheres);
340 int i;
341 for ( i=0;i<numSpheres;i++)
342 {
343 tmpPos[i].deSerializeFloat(mss->m_localPositionArrayPtr[i].m_pos);
344 radii[i] = mss->m_localPositionArrayPtr[i].m_radius;
345 }
346 shape = createMultiSphereShape(&tmpPos[0],&radii[0],numSpheres);
347 break;
348 }
349 case CONVEX_HULL_SHAPE_PROXYTYPE:
350 {
351 // int sz = sizeof(btConvexHullShapeData);
352 // int sz2 = sizeof(btConvexInternalShapeData);
353 // int sz3 = sizeof(btCollisionShapeData);
354 btConvexHullShapeData* convexData = (btConvexHullShapeData*)bsd;
355 int numPoints = convexData->m_numUnscaledPoints;
356
357 btAlignedObjectArray<btVector3> tmpPoints;
358 tmpPoints.resize(numPoints);
359 int i;
360 for ( i=0;i<numPoints;i++)
361 {
362 #ifdef BT_USE_DOUBLE_PRECISION
363 if (convexData->m_unscaledPointsDoublePtr)
364 tmpPoints[i].deSerialize(convexData->m_unscaledPointsDoublePtr[i]);
365 if (convexData->m_unscaledPointsFloatPtr)
366 tmpPoints[i].deSerializeFloat(convexData->m_unscaledPointsFloatPtr[i]);
367 #else
368 if (convexData->m_unscaledPointsFloatPtr)
369 tmpPoints[i].deSerialize(convexData->m_unscaledPointsFloatPtr[i]);
370 if (convexData->m_unscaledPointsDoublePtr)
371 tmpPoints[i].deSerializeDouble(convexData->m_unscaledPointsDoublePtr[i]);
372 #endif //BT_USE_DOUBLE_PRECISION
373 }
374 btConvexHullShape* hullShape = createConvexHullShape();
375 for (i=0;i<numPoints;i++)
376 {
377 hullShape->addPoint(tmpPoints[i]);
378 }
379 hullShape->setMargin(bsd->m_collisionMargin);
380 //hullShape->initializePolyhedralFeatures();
381 shape = hullShape;
382 break;
383 }
384 default:
385 {
386 printf("error: cannot create shape type (%d)\n",shapeData->m_shapeType);
387 }
388 }
389
390 if (shape)
391 {
392 shape->setMargin(bsd->m_collisionMargin);
393
394 btVector3 localScaling;
395 localScaling.deSerializeFloat(bsd->m_localScaling);
396 shape->setLocalScaling(localScaling);
397
398 }
399 break;
400 }
401 case TRIANGLE_MESH_SHAPE_PROXYTYPE:
402 {
403 btTriangleMeshShapeData* trimesh = (btTriangleMeshShapeData*)shapeData;
404 btStridingMeshInterfaceData* interfaceData = createStridingMeshInterfaceData(&trimesh->m_meshInterface);
405 btTriangleIndexVertexArray* meshInterface = createMeshInterface(*interfaceData);
406 if (!meshInterface->getNumSubParts())
407 {
408 return 0;
409 }
410
411 btVector3 scaling; scaling.deSerializeFloat(trimesh->m_meshInterface.m_scaling);
412 meshInterface->setScaling(scaling);
413
414
415 btOptimizedBvh* bvh = 0;
416 #if 1
417 if (trimesh->m_quantizedFloatBvh)
418 {
419 btOptimizedBvh** bvhPtr = m_bvhMap.find(trimesh->m_quantizedFloatBvh);
420 if (bvhPtr && *bvhPtr)
421 {
422 bvh = *bvhPtr;
423 } else
424 {
425 bvh = createOptimizedBvh();
426 bvh->deSerializeFloat(*trimesh->m_quantizedFloatBvh);
427 }
428 }
429 if (trimesh->m_quantizedDoubleBvh)
430 {
431 btOptimizedBvh** bvhPtr = m_bvhMap.find(trimesh->m_quantizedDoubleBvh);
432 if (bvhPtr && *bvhPtr)
433 {
434 bvh = *bvhPtr;
435 } else
436 {
437 bvh = createOptimizedBvh();
438 bvh->deSerializeDouble(*trimesh->m_quantizedDoubleBvh);
439 }
440 }
441 #endif
442
443
444 btBvhTriangleMeshShape* trimeshShape = createBvhTriangleMeshShape(meshInterface,bvh);
445 trimeshShape->setMargin(trimesh->m_collisionMargin);
446 shape = trimeshShape;
447
448 if (trimesh->m_triangleInfoMap)
449 {
450 btTriangleInfoMap* map = createTriangleInfoMap();
451 map->deSerialize(*trimesh->m_triangleInfoMap);
452 trimeshShape->setTriangleInfoMap(map);
453
454 #ifdef USE_INTERNAL_EDGE_UTILITY
455 gContactAddedCallback = btAdjustInternalEdgeContactsCallback;
456 #endif //USE_INTERNAL_EDGE_UTILITY
457
458 }
459
460 //printf("trimesh->m_collisionMargin=%f\n",trimesh->m_collisionMargin);
461 break;
462 }
463 case COMPOUND_SHAPE_PROXYTYPE:
464 {
465 btCompoundShapeData* compoundData = (btCompoundShapeData*)shapeData;
466 btCompoundShape* compoundShape = createCompoundShape();
467
468 btCompoundShapeChildData* childShapeDataArray = &compoundData->m_childShapePtr[0];
469
470
471 btAlignedObjectArray<btCollisionShape*> childShapes;
472 for (int i=0;i<compoundData->m_numChildShapes;i++)
473 {
474 btCompoundShapeChildData* ptr = &compoundData->m_childShapePtr[i];
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]);
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]);
998 }
999 for (i=0;i<3;i++)
1000 {
1001 dof->setStiffness(i+3,dofData->m_angularSpringStiffness.m_floats[i]);
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]);
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]);
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]);
1328 }
1329 for (i=0;i<3;i++)
1330 {
1331 dof->setStiffness(i+3,dofData->m_angularSpringStiffness.m_floats[i]);
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]);
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 btGImpactMeshShape* shape = new btGImpactMeshShape(trimesh);
1796 m_allocatedCollisionShapes.push_back(shape);
1797 return shape;
1798
1799 }
1800 btConvexHullShape* btWorldImporter::createConvexHullShape()
1801 {
1802 btConvexHullShape* shape = new btConvexHullShape();
1803 m_allocatedCollisionShapes.push_back(shape);
1804 return shape;
1805 }
1806
1807 btCompoundShape* btWorldImporter::createCompoundShape()
1808 {
1809 btCompoundShape* shape = new btCompoundShape();
1810 m_allocatedCollisionShapes.push_back(shape);
1811 return shape;
1812 }
1813
1814
1815 btScaledBvhTriangleMeshShape* btWorldImporter::createScaledTrangleMeshShape(btBvhTriangleMeshShape* meshShape,const btVector3& localScaling)
1816 {
1817 btScaledBvhTriangleMeshShape* shape = new btScaledBvhTriangleMeshShape(meshShape,localScaling);
1818 m_allocatedCollisionShapes.push_back(shape);
1819 return shape;
1820 }
1821
1822 btMultiSphereShape* btWorldImporter::createMultiSphereShape(const btVector3* positions,const btScalar* radi,int numSpheres)
1823 {
1824 btMultiSphereShape* shape = new btMultiSphereShape(positions, radi, numSpheres);
1825 m_allocatedCollisionShapes.push_back(shape);
1826 return shape;
1827 }
1828
1829 btRigidBody& btWorldImporter::getFixedBody()
1830 {
1831 static btRigidBody s_fixed(0, 0,0);
1832 s_fixed.setMassProps(btScalar(0.),btVector3(btScalar(0.),btScalar(0.),btScalar(0.)));
1833 return s_fixed;
1834 }
1835
1836 btPoint2PointConstraint* btWorldImporter::createPoint2PointConstraint(btRigidBody& rbA,btRigidBody& rbB, const btVector3& pivotInA,const btVector3& pivotInB)
1837 {
1838 btPoint2PointConstraint* p2p = new btPoint2PointConstraint(rbA,rbB,pivotInA,pivotInB);
1839 m_allocatedConstraints.push_back(p2p);
1840 return p2p;
1841 }
1842
1843 btPoint2PointConstraint* btWorldImporter::createPoint2PointConstraint(btRigidBody& rbA,const btVector3& pivotInA)
1844 {
1845 btPoint2PointConstraint* p2p = new btPoint2PointConstraint(rbA,pivotInA);
1846 m_allocatedConstraints.push_back(p2p);
1847 return p2p;
1848 }
1849
1850
1851 btHingeConstraint* btWorldImporter::createHingeConstraint(btRigidBody& rbA,btRigidBody& rbB, const btTransform& rbAFrame, const btTransform& rbBFrame, bool useReferenceFrameA)
1852 {
1853 btHingeConstraint* hinge = new btHingeConstraint(rbA,rbB,rbAFrame,rbBFrame,useReferenceFrameA);
1854 m_allocatedConstraints.push_back(hinge);
1855 return hinge;
1856 }
1857
1858 btHingeConstraint* btWorldImporter::createHingeConstraint(btRigidBody& rbA,const btTransform& rbAFrame, bool useReferenceFrameA)
1859 {
1860 btHingeConstraint* hinge = new btHingeConstraint(rbA,rbAFrame,useReferenceFrameA);
1861 m_allocatedConstraints.push_back(hinge);
1862 return hinge;
1863 }
1864
1865 btConeTwistConstraint* btWorldImporter::createConeTwistConstraint(btRigidBody& rbA,btRigidBody& rbB,const btTransform& rbAFrame, const btTransform& rbBFrame)
1866 {
1867 btConeTwistConstraint* cone = new btConeTwistConstraint(rbA,rbB,rbAFrame,rbBFrame);
1868 m_allocatedConstraints.push_back(cone);
1869 return cone;
1870 }
1871
1872 btConeTwistConstraint* btWorldImporter::createConeTwistConstraint(btRigidBody& rbA,const btTransform& rbAFrame)
1873 {
1874 btConeTwistConstraint* cone = new btConeTwistConstraint(rbA,rbAFrame);
1875 m_allocatedConstraints.push_back(cone);
1876 return cone;
1877 }
1878
1879
1880 btGeneric6DofConstraint* btWorldImporter::createGeneric6DofConstraint(btRigidBody& rbA, btRigidBody& rbB, const btTransform& frameInA, const btTransform& frameInB ,bool useLinearReferenceFrameA)
1881 {
1882 btGeneric6DofConstraint* dof = new btGeneric6DofConstraint(rbA,rbB,frameInA,frameInB,useLinearReferenceFrameA);
1883 m_allocatedConstraints.push_back(dof);
1884 return dof;
1885 }
1886
1887 btGeneric6DofConstraint* btWorldImporter::createGeneric6DofConstraint(btRigidBody& rbB, const btTransform& frameInB, bool useLinearReferenceFrameB)
1888 {
1889 btGeneric6DofConstraint* dof = new btGeneric6DofConstraint(rbB,frameInB,useLinearReferenceFrameB);
1890 m_allocatedConstraints.push_back(dof);
1891 return dof;
1892 }
1893
1894 btGeneric6DofSpring2Constraint* btWorldImporter::createGeneric6DofSpring2Constraint(btRigidBody& rbA, btRigidBody& rbB, const btTransform& frameInA, const btTransform& frameInB, int rotateOrder)
1895 {
1896 btGeneric6DofSpring2Constraint* dof = new btGeneric6DofSpring2Constraint(rbA,rbB,frameInA,frameInB, (RotateOrder)rotateOrder);
1897 m_allocatedConstraints.push_back(dof);
1898 return dof;
1899 }
1900
1901
1902
1903 btGeneric6DofSpringConstraint* btWorldImporter::createGeneric6DofSpringConstraint(btRigidBody& rbA, btRigidBody& rbB, const btTransform& frameInA, const btTransform& frameInB ,bool useLinearReferenceFrameA)
1904 {
1905 btGeneric6DofSpringConstraint* dof = new btGeneric6DofSpringConstraint(rbA,rbB,frameInA,frameInB,useLinearReferenceFrameA);
1906 m_allocatedConstraints.push_back(dof);
1907 return dof;
1908 }
1909
1910
1911 btSliderConstraint* btWorldImporter::createSliderConstraint(btRigidBody& rbA, btRigidBody& rbB, const btTransform& frameInA, const btTransform& frameInB ,bool useLinearReferenceFrameA)
1912 {
1913 btSliderConstraint* slider = new btSliderConstraint(rbA,rbB,frameInA,frameInB,useLinearReferenceFrameA);
1914 m_allocatedConstraints.push_back(slider);
1915 return slider;
1916 }
1917
1918 btSliderConstraint* btWorldImporter::createSliderConstraint(btRigidBody& rbB, const btTransform& frameInB, bool useLinearReferenceFrameA)
1919 {
1920 btSliderConstraint* slider = new btSliderConstraint(rbB,frameInB,useLinearReferenceFrameA);
1921 m_allocatedConstraints.push_back(slider);
1922 return slider;
1923 }
1924
1925 btGearConstraint* btWorldImporter::createGearConstraint(btRigidBody& rbA, btRigidBody& rbB, const btVector3& axisInA,const btVector3& axisInB, btScalar ratio)
1926 {
1927 btGearConstraint* gear = new btGearConstraint(rbA,rbB,axisInA,axisInB,ratio);
1928 m_allocatedConstraints.push_back(gear);
1929 return gear;
1930 }
1931
1932 // query for data
1933 int btWorldImporter::getNumCollisionShapes() const
1934 {
1935 return m_allocatedCollisionShapes.size();
1936 }
1937
1938 btCollisionShape* btWorldImporter::getCollisionShapeByIndex(int index)
1939 {
1940 return m_allocatedCollisionShapes[index];
1941 }
1942
1943 btCollisionShape* btWorldImporter::getCollisionShapeByName(const char* name)
1944 {
1945 btCollisionShape** shapePtr = m_nameShapeMap.find(name);
1946 if (shapePtr&& *shapePtr)
1947 {
1948 return *shapePtr;
1949 }
1950 return 0;
1951 }
1952
1953 btRigidBody* btWorldImporter::getRigidBodyByName(const char* name)
1954 {
1955 btRigidBody** bodyPtr = m_nameBodyMap.find(name);
1956 if (bodyPtr && *bodyPtr)
1957 {
1958 return *bodyPtr;
1959 }
1960 return 0;
1961 }
1962
1963 btTypedConstraint* btWorldImporter::getConstraintByName(const char* name)
1964 {
1965 btTypedConstraint** constraintPtr = m_nameConstraintMap.find(name);
1966 if (constraintPtr && *constraintPtr)
1967 {
1968 return *constraintPtr;
1969 }
1970 return 0;
1971 }
1972
1973 const char* btWorldImporter::getNameForPointer(const void* ptr) const
1974 {
1975 const char*const * namePtr = m_objectNameMap.find(ptr);
1976 if (namePtr && *namePtr)
1977 return *namePtr;
1978 return 0;
1979 }
1980
1981
1982 int btWorldImporter::getNumRigidBodies() const
1983 {
1984 return m_allocatedRigidBodies.size();
1985 }
1986
1987 btCollisionObject* btWorldImporter::getRigidBodyByIndex(int index) const
1988 {
1989 return m_allocatedRigidBodies[index];
1990 }
1991 int btWorldImporter::getNumConstraints() const
1992 {
1993 return m_allocatedConstraints.size();
1994 }
1995
1996 btTypedConstraint* btWorldImporter::getConstraintByIndex(int index) const
1997 {
1998 return m_allocatedConstraints[index];
1999 }
2000
2001 int btWorldImporter::getNumBvhs() const
2002 {
2003 return m_allocatedBvhs.size();
2004 }
2005 btOptimizedBvh* btWorldImporter::getBvhByIndex(int index) const
2006 {
2007 return m_allocatedBvhs[index];
2008 }
2009
2010 int btWorldImporter::getNumTriangleInfoMaps() const
2011 {
2012 return m_allocatedTriangleInfoMaps.size();
2013 }
2014
2015 btTriangleInfoMap* btWorldImporter::getTriangleInfoMapByIndex(int index) const
2016 {
2017 return m_allocatedTriangleInfoMaps[index];
2018 }
2019
2020
2021 void btWorldImporter::convertRigidBodyFloat( btRigidBodyFloatData* colObjData)
2022 {
2023 btScalar mass = btScalar(colObjData->m_inverseMass? 1.f/colObjData->m_inverseMass : 0.f);
2024 btVector3 localInertia;
2025 localInertia.setZero();
2026 btCollisionShape** shapePtr = m_shapeMap.find(colObjData->m_collisionObjectData.m_collisionShape);
2027 if (shapePtr && *shapePtr)
2028 {
2029 btTransform startTransform;
2030 colObjData->m_collisionObjectData.m_worldTransform.m_origin.m_floats[3] = 0.f;
2031 startTransform.deSerializeFloat(colObjData->m_collisionObjectData.m_worldTransform);
2032
2033 // startTransform.setBasis(btMatrix3x3::getIdentity());
2034 btCollisionShape* shape = (btCollisionShape*)*shapePtr;
2035 if (shape->isNonMoving())
2036 {
2037 mass = 0.f;
2038 }
2039 if (mass)
2040 {
2041 shape->calculateLocalInertia(mass,localInertia);
2042 }
2043 bool isDynamic = mass!=0.f;
2044 btRigidBody* body = createRigidBody(isDynamic,mass,startTransform,shape,colObjData->m_collisionObjectData.m_name);
2045 body->setFriction(colObjData->m_collisionObjectData.m_friction);
2046 body->setRestitution(colObjData->m_collisionObjectData.m_restitution);
2047 btVector3 linearFactor,angularFactor;
2048 linearFactor.deSerializeFloat(colObjData->m_linearFactor);
2049 angularFactor.deSerializeFloat(colObjData->m_angularFactor);
2050 body->setLinearFactor(linearFactor);
2051 body->setAngularFactor(angularFactor);
2052
2053 #ifdef USE_INTERNAL_EDGE_UTILITY
2054 if (shape->getShapeType() == TRIANGLE_MESH_SHAPE_PROXYTYPE)
2055 {
2056 btBvhTriangleMeshShape* trimesh = (btBvhTriangleMeshShape*)shape;
2057 if (trimesh->getTriangleInfoMap())
2058 {
2059 body->setCollisionFlags(body->getCollisionFlags() | btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK);
2060 }
2061 }
2062 #endif //USE_INTERNAL_EDGE_UTILITY
2063 m_bodyMap.insert(colObjData,body);
2064 } else
2065 {
2066 printf("error: no shape found\n");
2067 }
2068 }
2069
2070 void btWorldImporter::convertRigidBodyDouble( btRigidBodyDoubleData* colObjData)
2071 {
2072 btScalar mass = btScalar(colObjData->m_inverseMass? 1.f/colObjData->m_inverseMass : 0.f);
2073 btVector3 localInertia;
2074 localInertia.setZero();
2075 btCollisionShape** shapePtr = m_shapeMap.find(colObjData->m_collisionObjectData.m_collisionShape);
2076 if (shapePtr && *shapePtr)
2077 {
2078 btTransform startTransform;
2079 colObjData->m_collisionObjectData.m_worldTransform.m_origin.m_floats[3] = 0.f;
2080 startTransform.deSerializeDouble(colObjData->m_collisionObjectData.m_worldTransform);
2081
2082 // startTransform.setBasis(btMatrix3x3::getIdentity());
2083 btCollisionShape* shape = (btCollisionShape*)*shapePtr;
2084 if (shape->isNonMoving())
2085 {
2086 mass = 0.f;
2087 }
2088 if (mass)
2089 {
2090 shape->calculateLocalInertia(mass,localInertia);
2091 }
2092 bool isDynamic = mass!=0.f;
2093 btRigidBody* body = createRigidBody(isDynamic,mass,startTransform,shape,colObjData->m_collisionObjectData.m_name);
2094 body->setFriction(btScalar(colObjData->m_collisionObjectData.m_friction));
2095 body->setRestitution(btScalar(colObjData->m_collisionObjectData.m_restitution));
2096 btVector3 linearFactor,angularFactor;
2097 linearFactor.deSerializeDouble(colObjData->m_linearFactor);
2098 angularFactor.deSerializeDouble(colObjData->m_angularFactor);
2099 body->setLinearFactor(linearFactor);
2100 body->setAngularFactor(angularFactor);
2101
2102
2103 #ifdef USE_INTERNAL_EDGE_UTILITY
2104 if (shape->getShapeType() == TRIANGLE_MESH_SHAPE_PROXYTYPE)
2105 {
2106 btBvhTriangleMeshShape* trimesh = (btBvhTriangleMeshShape*)shape;
2107 if (trimesh->getTriangleInfoMap())
2108 {
2109 body->setCollisionFlags(body->getCollisionFlags() | btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK);
2110 }
2111 }
2112 #endif //USE_INTERNAL_EDGE_UTILITY
2113 m_bodyMap.insert(colObjData,body);
2114 } else
2115 {
2116 printf("error: no shape found\n");
2117 }
2118 }
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:555
btRigidBody::upcast
static const btRigidBody * upcast(const btCollisionObject *colObj)
to keep collision detection and dynamics separate we don't store a rigidbody pointer but a rigidbody ...
Definition: btRigidBody.h:200
btTypedConstraintDoubleData::m_isEnabled
int m_isEnabled
Definition: btTypedConstraint.h:438
btHingeConstraintDoubleData::m_rbBFrame
btTransformDoubleData m_rbBFrame
Definition: btHingeConstraint.h:324
btSliderConstraintDoubleData::m_angularUpperLimit
double m_angularUpperLimit
Definition: btSliderConstraint.h:323
btHingeConstraintDoubleData2::m_biasFactor
double m_biasFactor
Definition: btHingeConstraint.h:415
btConeTwistConstraintData::m_damping
float m_damping
Definition: btConeTwistConstraint.h:345
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:1903
btConeTwistConstraint::setLimit
void setLimit(int limitIndex, btScalar limitValue)
Definition: btConeTwistConstraint.h:174
btHingeConstraintFloatData::m_rbAFrame
btTransformFloatData m_rbAFrame
Definition: btHingeConstraint.h:381
btGeneric6DofSpring2ConstraintData::m_angularUpperLimit
btVector3FloatData m_angularUpperLimit
Definition: btGeneric6DofSpring2Constraint.h:507
btConeTwistConstraintDoubleData::m_rbAFrame
btTransformDoubleData m_rbAFrame
Definition: btConeTwistConstraint.h:312
btPoint2PointConstraintDoubleData::m_pivotInA
btVector3DoubleData m_pivotInA
Definition: btPoint2PointConstraint.h:151
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:93
btGeneric6DofSpring2ConstraintDoubleData2::m_rbBFrame
btTransformDoubleData m_rbBFrame
Definition: btGeneric6DofSpring2Constraint.h:533
btWorldImporter::createGeneric6DofConstraint
virtual btGeneric6DofConstraint * createGeneric6DofConstraint(btRigidBody &rbA, btRigidBody &rbB, const btTransform &frameInA, const btTransform &frameInB, bool useLinearReferenceFrameA)
Definition: btWorldImporter.cpp:1880
btAlignedObjectArray::push_back
void push_back(const T &_Val)
Definition: btAlignedObjectArray.h:276
btSliderConstraint::setUpperLinLimit
void setUpperLinLimit(btScalar upperLimit)
Definition: btSliderConstraint.h:193
btGeneric6DofSpring2ConstraintData::m_rotateOrder
int m_rotateOrder
Definition: btGeneric6DofSpring2Constraint.h:525
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:77
btCompoundShapeData::m_childShapePtr
btCompoundShapeChildData * m_childShapePtr
Definition: btCompoundShape.h:192
btWorldImporter::convertCollisionShape
btCollisionShape * convertCollisionShape(btCollisionShapeData *shapeData)
Definition: btWorldImporter.cpp:148
btCollisionShape::getShapeType
int getShapeType() const
Definition: btCollisionShape.h:112
btSliderConstraintDoubleData::m_angularLowerLimit
double m_angularLowerLimit
Definition: btSliderConstraint.h:324
btWorldImporter::createStridingMeshInterfaceData
virtual btStridingMeshInterfaceData * createStridingMeshInterfaceData(btStridingMeshInterfaceData *interfaceData)
Definition: btWorldImporter.cpp:1533
btGeneric6DofSpringConstraintDoubleData2::m_6dofData
btGeneric6DofConstraintDoubleData2 m_6dofData
Definition: btGeneric6DofSpringConstraint.h:89
btTypedConstraintDoubleData::m_breakingImpulseThreshold
double m_breakingImpulseThreshold
Definition: btTypedConstraint.h:437
btPoint2PointConstraint
point to point constraint between two rigidbodies each with a pivotpoint that descibes the 'ballsocke...
Definition: btPoint2PointConstraint.h:54
btConeTwistConstraintData::m_rbAFrame
btTransformFloatData m_rbAFrame
Definition: btConeTwistConstraint.h:334
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:2070
btWorldImporter::createBvhTriangleMeshShape
virtual btBvhTriangleMeshShape * createBvhTriangleMeshShape(btStridingMeshInterface *trimesh, btOptimizedBvh *bvh)
Definition: btWorldImporter.cpp:1774
btGeneric6DofSpring2ConstraintDoubleData2::m_linearEquilibriumPoint
btVector3DoubleData m_linearEquilibriumPoint
Definition: btGeneric6DofSpring2Constraint.h:547
btVector3::deSerializeDouble
void deSerializeDouble(const struct btVector3DoubleData &dataIn)
Definition: btVector3.h:1333
btWorldImporter::createSphereShape
virtual btCollisionShape * createSphereShape(btScalar radius)
Definition: btWorldImporter.cpp:1681
btTypedConstraintData::m_name
char * m_name
Definition: btTypedConstraint.h:401
btBvhTriangleMeshShape::getTriangleInfoMap
const btTriangleInfoMap * getTriangleInfoMap() const
Definition: btBvhTriangleMeshShape.h:98
btSliderConstraint::setLowerLinLimit
void setLowerLinLimit(btScalar lowerLimit)
Definition: btSliderConstraint.h:191
btIntIndexData::m_value
int m_value
Definition: btStridingMeshInterface.h:106
btWorldImporter::getNumCollisionShapes
int getNumCollisionShapes() const
Definition: btWorldImporter.cpp:1933
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:1865
btWorldImporter::createTriangleInfoMap
virtual btTriangleInfoMap * createTriangleInfoMap()
Definition: btWorldImporter.cpp:1767
btIndexedMesh
The btIndexedMesh indexes a single vertex and index array.
Definition: btTriangleIndexVertexArray.h:26
btWorldImporter::getNameForPointer
const char * getNameForPointer(const void *ptr) const
Definition: btWorldImporter.cpp:1973
btWorldImporter::convertRigidBodyFloat
void convertRigidBodyFloat(btRigidBodyFloatData *colObjData)
Definition: btWorldImporter.cpp:2021
btSliderConstraint::setLowerAngLimit
void setLowerAngLimit(btScalar lowerLimit)
Definition: btSliderConstraint.h:195
btRigidBodyFloatData::m_angularFactor
btVector3FloatData m_angularFactor
Definition: btRigidBody.h:567
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:984
btGeneric6DofSpring2ConstraintData::m_linearSpringStiffness
btVector3FloatData m_linearSpringStiffness
Definition: btGeneric6DofSpring2Constraint.h:499
btAlignedObjectArray< btVector3 >
btBulletDynamicsCommon.h
btGeneric6DofSpring2ConstraintData::m_linearEquilibriumPoint
btVector3FloatData m_linearEquilibriumPoint
Definition: btGeneric6DofSpring2Constraint.h:501
btWorldImporter::m_charIndexArrays
btAlignedObjectArray< unsigned char * > m_charIndexArrays
Definition: btWorldImporter.h:82
btTypedConstraintFloatData::m_breakingImpulseThreshold
float m_breakingImpulseThreshold
Definition: btTypedConstraint.h:387
btGeneric6DofSpringConstraintDoubleData2::m_springEnabled
int m_springEnabled[6]
Definition: btGeneric6DofSpringConstraint.h:91
btGeneric6DofSpring2ConstraintDoubleData2::m_linearSpringDamping
btVector3DoubleData m_linearSpringDamping
Definition: btGeneric6DofSpring2Constraint.h:546
btGeneric6DofSpring2ConstraintData::m_linearLowerLimit
btVector3FloatData m_linearLowerLimit
Definition: btGeneric6DofSpring2Constraint.h:490
btGearConstraintFloatData::m_ratio
float m_ratio
Definition: btGearConstraint.h:114
btVector3DoubleData::m_floats
double m_floats[4]
Definition: btVector3.h:1308
btSliderConstraintData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btSliderConstraint.h:296
btTypedConstraintFloatData::m_objectType
int m_objectType
Definition: btTypedConstraint.h:376
btGeneric6DofConstraintDoubleData2
Definition: btGeneric6DofConstraint.h:589
btGeneric6DofSpring2Constraint::setDamping
void setDamping(int index, btScalar damping)
Definition: btGeneric6DofSpring2Constraint.cpp:1035
btShortIntIndexData::m_value
short m_value
Definition: btStridingMeshInterface.h:111
btWorldImporter::getBvhByIndex
btOptimizedBvh * getBvhByIndex(int index) const
Definition: btWorldImporter.cpp:2005
btGeneric6DofSpring2ConstraintData::m_rbBFrame
btTransformFloatData m_rbBFrame
Definition: btGeneric6DofSpring2Constraint.h:487
btHingeConstraintDoubleData2::m_motorTargetVelocity
double m_motorTargetVelocity
Definition: btHingeConstraint.h:409
btMultiSphereShapeData::m_localPositionArraySize
int m_localPositionArraySize
Definition: btMultiSphereShape.h:88
btGeneric6DofSpring2ConstraintDoubleData2::m_linearUpperLimit
btVector3DoubleData m_linearUpperLimit
Definition: btGeneric6DofSpring2Constraint.h:535
btHingeConstraintFloatData::m_motorTargetVelocity
float m_motorTargetVelocity
Definition: btHingeConstraint.h:387
btConeTwistConstraintData::m_limitSoftness
float m_limitSoftness
Definition: btConeTwistConstraint.h:341
btGeneric6DofConstraintData
Definition: btGeneric6DofConstraint.h:573
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:20
btHingeConstraintDoubleData::m_lowerLimit
float m_lowerLimit
Definition: btHingeConstraint.h:331
btStaticPlaneShapeData::m_planeConstant
float m_planeConstant
Definition: btStaticPlaneShape.h:78
btGeneric6DofSpring2ConstraintDoubleData2::m_rbAFrame
btTransformDoubleData m_rbAFrame
Definition: btGeneric6DofSpring2Constraint.h:532
btTypedConstraintFloatData::m_disableCollisionsBetweenLinkedBodies
int m_disableCollisionsBetweenLinkedBodies
Definition: btTypedConstraint.h:384
btTypedConstraintData::m_disableCollisionsBetweenLinkedBodies
int m_disableCollisionsBetweenLinkedBodies
Definition: btTypedConstraint.h:411
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:107
btWorldImporter::getNumTriangleInfoMaps
int getNumTriangleInfoMaps() const
Definition: btWorldImporter.cpp:2010
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:320
btTransform::setIdentity
void setIdentity()
Set this transformation to the identity.
Definition: btTransform.h:172
btAssert
#define btAssert(x)
Definition: btScalar.h:113
btDynamicsWorld
The btDynamicsWorld is the interface class for several dynamics implementation, basic, discrete, parallel, and continuous etc.
Definition: btDynamicsWorld.h:41
btGeneric6DofSpring2ConstraintDoubleData2::m_linearEnableSpring
char m_linearEnableSpring[4]
Definition: btGeneric6DofSpring2Constraint.h:550
btGeneric6DofSpring2ConstraintData::m_angularLowerLimit
btVector3FloatData m_angularLowerLimit
Definition: btGeneric6DofSpring2Constraint.h:508
btWorldImporter::createConvexHullShape
virtual class btConvexHullShape * createConvexHullShape()
Definition: btWorldImporter.cpp:1800
btConeTwistConstraintDoubleData::m_swingSpan2
double m_swingSpan2
Definition: btConeTwistConstraint.h:317
btCollisionShape
The btCollisionShape class provides an interface for collision shapes that can be shared among btColl...
Definition: btCollisionShape.h:27
btGImpactShape.h
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 'sphere' of the capsule caps.
Definition: btCapsuleShape.h:126
btGeneric6DofConstraintData::m_linearLowerLimit
btVector3FloatData m_linearLowerLimit
Definition: btGeneric6DofConstraint.h:580
btConeShapeX
btConeShape implements a Cone shape, around the X axis
Definition: btConeShape.h:104
btGeneric6DofSpring2ConstraintDoubleData2::m_angularEquilibriumPoint
btVector3DoubleData m_angularEquilibriumPoint
Definition: btGeneric6DofSpring2Constraint.h:565
btWorldImporter::m_nameShapeMap
btHashMap< btHashString, btCollisionShape * > m_nameShapeMap
Definition: btWorldImporter.h:91
btWorldImporter::m_shortIndexArrays
btAlignedObjectArray< short int * > m_shortIndexArrays
Definition: btWorldImporter.h:81
btConeTwistConstraint::setDamping
void setDamping(btScalar damping)
Definition: btConeTwistConstraint.h:260
btConeTwistConstraintDoubleData::m_swingSpan1
double m_swingSpan1
Definition: btConeTwistConstraint.h:316
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:520
btWorldImporter::getCollisionShapeByName
btCollisionShape * getCollisionShapeByName(const char *name)
Definition: btWorldImporter.cpp:1943
btConeTwistConstraintData::m_rbBFrame
btTransformFloatData m_rbBFrame
Definition: btConeTwistConstraint.h:335
btTypedConstraintDoubleData::m_disableCollisionsBetweenLinkedBodies
int m_disableCollisionsBetweenLinkedBodies
Definition: btTypedConstraint.h:434
btPoint2PointConstraintFloatData::m_pivotInA
btVector3FloatData m_pivotInA
Definition: btPoint2PointConstraint.h:132
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:42
btHingeConstraintFloatData::m_upperLimit
float m_upperLimit
Definition: btHingeConstraint.h:391
btCollisionObject::getCollisionFlags
int getCollisionFlags() const
Definition: btCollisionObject.h:429
btSliderConstraint::setUseFrameOffset
void setUseFrameOffset(bool frameOffsetOnOff)
Definition: btSliderConstraint.h:267
btTriangleMeshShapeData::m_meshInterface
btStridingMeshInterfaceData m_meshInterface
Definition: btBvhTriangleMeshShape.h:124
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:321
btRigidBody::setLinearFactor
void setLinearFactor(const btVector3 &linearFactor)
Definition: btRigidBody.h:265
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:596
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:49
btVector3FloatData::m_floats
float m_floats[4]
Definition: btVector3.h:1303
btTypedConstraintFloatData::m_name
char * m_name
Definition: btTypedConstraint.h:374
btCollisionObjectFloatData::m_restitution
float m_restitution
Definition: btCollisionObject.h:565
BOX_SHAPE_PROXYTYPE
Definition: btBroadphaseProxy.h:31
btGImpactMeshShape
This class manages a mesh supplied by the btStridingMeshInterface interface.
Definition: btGImpactShape.h:910
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:321
btRigidBodyDoubleData::m_inverseMass
double m_inverseMass
Definition: btRigidBody.h:600
btTriangleMeshShapeData::m_triangleInfoMap
btTriangleInfoMapData * m_triangleInfoMap
Definition: btBvhTriangleMeshShape.h:129
btSliderConstraintData::m_linearLowerLimit
float m_linearLowerLimit
Definition: btSliderConstraint.h:303
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:318
btWorldImporter::createCapsuleShapeZ
virtual btCollisionShape * createCapsuleShapeZ(btScalar radius, btScalar height)
Definition: btWorldImporter.cpp:1703
btSliderConstraintData::m_rbBFrame
btTransformFloatData m_rbBFrame
Definition: btSliderConstraint.h:300
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:302
btGeneric6DofSpring2Constraint
Definition: btGeneric6DofSpring2Constraint.h:265
btShortIntIndexTripletData
Definition: btStridingMeshInterface.h:115
btHingeConstraintDoubleData2::m_maxMotorImpulse
double m_maxMotorImpulse
Definition: btHingeConstraint.h:410
btConeTwistConstraintData::m_twistSpan
float m_twistSpan
Definition: btConeTwistConstraint.h:340
btGeneric6DofConstraintData::m_rbBFrame
btTransformFloatData m_rbBFrame
Definition: btGeneric6DofConstraint.h:577
btConeTwistConstraintData::m_swingSpan2
float m_swingSpan2
Definition: btConeTwistConstraint.h:339
btCollisionObject::setRestitution
void setRestitution(btScalar rest)
Definition: btCollisionObject.h:291
btRigidBodyFloatData::m_collisionObjectData
btCollisionObjectFloatData m_collisionObjectData
Definition: btRigidBody.h:563
btRigidBodyDoubleData::m_linearFactor
btVector3DoubleData m_linearFactor
Definition: btRigidBody.h:594
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:392
btWorldImporter::m_allocatedTriangleInfoMaps
btAlignedObjectArray< btTriangleInfoMap * > m_allocatedTriangleInfoMaps
Definition: btWorldImporter.h:74
btSliderConstraintData::m_angularUpperLimit
float m_angularUpperLimit
Definition: btSliderConstraint.h:305
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:31
btIndexedMesh::m_indexType
PHY_ScalarType m_indexType
Definition: btTriangleIndexVertexArray.h:41
btGeneric6DofSpringConstraintData::m_6dofData
btGeneric6DofConstraintData m_6dofData
Definition: btGeneric6DofSpringConstraint.h:79
btVector3::getZ
const btScalar & getZ() const
Return the z value.
Definition: btVector3.h:565
btMeshPartData::m_indices16
btShortIntIndexData * m_indices16
Definition: btStridingMeshInterface.h:138
btTypedConstraintDoubleData::m_objectType
int m_objectType
Definition: btTypedConstraint.h:426
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:184
btWorldImporter::getConstraintByName
btTypedConstraint * getConstraintByName(const char *name)
Definition: btWorldImporter.cpp:1963
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:137
btTypedConstraint::setBreakingImpulseThreshold
void setBreakingImpulseThreshold(btScalar threshold)
Definition: btTypedConstraint.h:206
btConeTwistConstraintDoubleData::m_damping
double m_damping
Definition: btConeTwistConstraint.h:323
btPoint2PointConstraintDoubleData2::m_pivotInA
btVector3DoubleData m_pivotInA
Definition: btPoint2PointConstraint.h:140
D6_SPRING_2_CONSTRAINT_TYPE
Definition: btTypedConstraint.h:47
btCylinderShapeZ
Definition: btCylinderShape.h:160
btTypedConstraintDoubleData::m_name
char * m_name
Definition: btTypedConstraint.h:424
btWorldImporter::createCompoundShape
virtual class btCompoundShape * createCompoundShape()
Definition: btWorldImporter.cpp:1807
btBvhTriangleMeshShape
The btBvhTriangleMeshShape is a static-triangle mesh shape, it can only be used for fixed/non-moving ...
Definition: btBvhTriangleMeshShape.h:34
btTypedConstraint::setDbgDrawSize
void setDbgDrawSize(btScalar dbgDrawSize)
Definition: btTypedConstraint.h:320
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:407
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:453
btGImpactMeshShapeData::m_collisionMargin
float m_collisionMargin
Definition: btGImpactShape.h:1173
btHingeConstraintFloatData::m_biasFactor
float m_biasFactor
Definition: btHingeConstraint.h:393
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:551
btCollisionObject::getWorldTransform
btTransform & getWorldTransform()
Definition: btCollisionObject.h:327
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:159
btGeneric6DofSpring2ConstraintData::m_angularEnableSpring
char m_angularEnableSpring[4]
Definition: btGeneric6DofSpring2Constraint.h:522
btGeneric6DofSpring2ConstraintDoubleData2::m_angularLowerLimit
btVector3DoubleData m_angularLowerLimit
Definition: btGeneric6DofSpring2Constraint.h:554
btGeneric6DofConstraintData::m_angularLowerLimit
btVector3FloatData m_angularLowerLimit
Definition: btGeneric6DofConstraint.h:583
btWorldImporter::m_bvhMap
btHashMap< btHashPtr, btOptimizedBvh * > m_bvhMap
Definition: btWorldImporter.h:88
btAlignedObjectArray::size
int size() const
return the number of elements in the array
Definition: btAlignedObjectArray.h:149
btConvexHullShapeData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btConvexHullShape.h:102
btDynamicsWorld::removeConstraint
virtual void removeConstraint(btTypedConstraint *constraint)
Definition: btDynamicsWorld.h:76
btMeshPartData::m_3indices16
btShortIntIndexTripletData * m_3indices16
Definition: btStridingMeshInterface.h:135
btGeneric6DofSpring2ConstraintData::m_linearUpperLimit
btVector3FloatData m_linearUpperLimit
Definition: btGeneric6DofSpring2Constraint.h:489
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:319
btWorldImporter::m_allocatedbtStridingMeshInterfaceDatas
btAlignedObjectArray< btStridingMeshInterfaceData * > m_allocatedbtStridingMeshInterfaceDatas
Definition: btWorldImporter.h:76
btSliderConstraintData::m_useLinearReferenceFrameA
int m_useLinearReferenceFrameA
Definition: btSliderConstraint.h:308
btTriangleIndexVertexArray::addIndexedMesh
void addIndexedMesh(const btIndexedMesh &mesh, PHY_ScalarType indexType=PHY_INTEGER)
Definition: btTriangleIndexVertexArray.h:90
btWorldImporter::getConstraintByIndex
btTypedConstraint * getConstraintByIndex(int index) const
Definition: btWorldImporter.cpp:1996
btCollisionShape::isNonMoving
bool isNonMoving() const
Definition: btCollisionShape.h:77
btIndexedMesh::m_triangleIndexStride
int m_triangleIndexStride
Definition: btTriangleIndexVertexArray.h:33
btHingeConstraintDoubleData::m_motorTargetVelocity
float m_motorTargetVelocity
Definition: btHingeConstraint.h:328
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:300
btSliderConstraintDoubleData::m_useOffsetForConstraintFrame
int m_useOffsetForConstraintFrame
Definition: btSliderConstraint.h:327
btWorldImporter::createGearConstraint
virtual btGearConstraint * createGearConstraint(btRigidBody &rbA, btRigidBody &rbB, const btVector3 &axisInA, const btVector3 &axisInB, btScalar ratio)
Definition: btWorldImporter.cpp:1925
btConeShapeData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btConeShape.h:144
btGearConstraintFloatData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btGearConstraint.h:107
btHingeConstraintDoubleData2::m_relaxationFactor
double m_relaxationFactor
Definition: btHingeConstraint.h:416
btRigidBodyDoubleData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btRigidBody.h:587
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:585
btHingeConstraintDoubleData::m_relaxationFactor
float m_relaxationFactor
Definition: btHingeConstraint.h:335
btWorldImporter::getNumConstraints
int getNumConstraints() const
Definition: btWorldImporter.cpp:1991
btTypedConstraintData::m_dbgDrawSize
float m_dbgDrawSize
Definition: btTypedConstraint.h:409
btQuantizedBvh::deSerializeDouble
virtual void deSerializeDouble(struct btQuantizedBvhDoubleData &quantizedBvhDoubleData)
Definition: btQuantizedBvh.cpp:1236
btGeneric6DofConstraintDoubleData2::m_angularLowerLimit
btVector3DoubleData m_angularLowerLimit
Definition: btGeneric6DofConstraint.h:599
btGeneric6DofConstraintData::m_linearUpperLimit
btVector3FloatData m_linearUpperLimit
Definition: btGeneric6DofConstraint.h:579
btPoint2PointConstraintFloatData::m_pivotInB
btVector3FloatData m_pivotInB
Definition: btPoint2PointConstraint.h:133
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:166
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:81
btMultiSphereShapeData::m_localPositionArrayPtr
btPositionAndRadius * m_localPositionArrayPtr
Definition: btMultiSphereShape.h:87
btGImpactMeshShapeData::m_meshInterface
btStridingMeshInterfaceData m_meshInterface
Definition: btGImpactShape.h:1169
btVector3::setW
void setW(btScalar _w)
Set the w value.
Definition: btVector3.h:573
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:309
btSliderConstraint::setUpperAngLimit
void setUpperAngLimit(btScalar upperLimit)
Definition: btSliderConstraint.h:197
MULTI_SPHERE_SHAPE_PROXYTYPE
Definition: btBroadphaseProxy.h:41
btVector3::getY
const btScalar & getY() const
Return the y value.
Definition: btVector3.h:563
btCollisionObjectDoubleData::m_friction
double m_friction
Definition: btCollisionObject.h:529
btGeneric6DofSpring2ConstraintDoubleData2::m_rotateOrder
int m_rotateOrder
Definition: btGeneric6DofSpring2Constraint.h:571
btWorldImporter::duplicateName
char * duplicateName(const char *name)
Definition: btWorldImporter.cpp:514
btAlignedFree
#define btAlignedFree(ptr)
Definition: btAlignedAllocator.h:42
btPositionAndRadius::m_pos
btVector3FloatData m_pos
Definition: btMultiSphereShape.h:79
btTypedConstraintDoubleData
Definition: btTypedConstraint.h:420
btGeneric6DofSpring2Constraint::setStiffness
void setStiffness(int index, btScalar stiffness)
Definition: btGeneric6DofSpring2Constraint.cpp:1026
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:394
btBvhTriangleMeshShape::setOptimizedBvh
void setOptimizedBvh(btOptimizedBvh *bvh, const btVector3 &localScaling=btVector3(1, 1, 1))
Definition: btBvhTriangleMeshShape.cpp:355
btVector3::getX
const btScalar & getX() const
Return the x value.
Definition: btVector3.h:561
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:414
btWorldImporter::createScaledTrangleMeshShape
virtual class btScaledBvhTriangleMeshShape * createScaledTrangleMeshShape(btBvhTriangleMeshShape *meshShape, const btVector3 &localScalingbtBvhTriangleMeshShape)
Definition: btWorldImporter.cpp:1815
btVector3::setZero
void setZero()
Definition: btVector3.h:671
btGeneric6DofConstraintDoubleData2::m_angularUpperLimit
btVector3DoubleData m_angularUpperLimit
Definition: btGeneric6DofConstraint.h:598
btConeTwistConstraintData::m_biasFactor
float m_biasFactor
Definition: btConeTwistConstraint.h:342
btWorldImporter::createGeneric6DofSpring2Constraint
virtual btGeneric6DofSpring2Constraint * createGeneric6DofSpring2Constraint(btRigidBody &rbA, btRigidBody &rbB, const btTransform &frameInA, const btTransform &frameInB, int rotateOrder)
Definition: btWorldImporter.cpp:1894
btRigidBody
The btRigidBody is the main class for rigid body objects.
Definition: btRigidBody.h:62
btSliderConstraintDoubleData::m_linearUpperLimit
double m_linearUpperLimit
Definition: btSliderConstraint.h:320
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:326
btConvexInternalShapeData::m_localScaling
btVector3FloatData m_localScaling
Definition: btConvexInternalShape.h:148
btGeneric6DofSpring2ConstraintDoubleData2::m_linearLowerLimit
btVector3DoubleData m_linearLowerLimit
Definition: btGeneric6DofSpring2Constraint.h:536
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:601
btCollisionShape::setMargin
virtual void setMargin(btScalar margin)=0
btGImpactMeshShapeData::m_gimpactSubType
int m_gimpactSubType
Definition: btGImpactShape.h:1175
btGeneric6DofSpring2Constraint::setEquilibriumPoint
void setEquilibriumPoint()
Definition: btGeneric6DofSpring2Constraint.cpp:1044
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
btTransform::inverse
btTransform inverse() const
Return the inverse of this transform.
Definition: btTransform.h:188
btGeneric6DofSpring2Constraint::setLinearUpperLimit
void setLinearUpperLimit(const btVector3 &linearUpper)
Definition: btGeneric6DofSpring2Constraint.h:362
btRigidBodyFloatData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btRigidBody.h:561
btTypedConstraintData
this structure is not used, except for loading pre-2.82 .bullet files
Definition: btTypedConstraint.h:397
btGeneric6DofSpring2Constraint::setLinearLowerLimit
void setLinearLowerLimit(const btVector3 &linearLower)
Definition: btGeneric6DofSpring2Constraint.h:360
SLIDER_CONSTRAINT_TYPE
Definition: btTypedConstraint.h:42
btRigidBodyDoubleData::m_angularFactor
btVector3DoubleData m_angularFactor
Definition: btRigidBody.h:593
btGeneric6DofConstraintDoubleData2::m_rbAFrame
btTransformDoubleData m_rbAFrame
Definition: btGeneric6DofConstraint.h:592
btHingeConstraintDoubleData::m_upperLimit
float m_upperLimit
Definition: btHingeConstraint.h:332
btGeneric6DofSpring2Constraint::setAngularLowerLimit
void setAngularLowerLimit(const btVector3 &angularLower)
Definition: btGeneric6DofSpring2Constraint.h:365
btPositionAndRadius::m_radius
float m_radius
Definition: btMultiSphereShape.h:80
btCollisionObject::setWorldTransform
void setWorldTransform(const btTransform &worldTrans)
Definition: btCollisionObject.h:337
btConvexInternalShapeData::m_implicitShapeDimensions
btVector3FloatData m_implicitShapeDimensions
Definition: btConvexInternalShape.h:150
btConvexHullShapeData::m_unscaledPointsFloatPtr
btVector3FloatData * m_unscaledPointsFloatPtr
Definition: btConvexHullShape.h:106
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:388
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:314
btTriangleMeshShapeData::m_quantizedDoubleBvh
btQuantizedBvhDoubleData * m_quantizedDoubleBvh
Definition: btBvhTriangleMeshShape.h:127
btGearConstraintDoubleData::m_axisInA
btVector3DoubleData m_axisInA
Definition: btGearConstraint.h:122
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:313
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:320
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:483
btVector3
btVector3 can be used to represent 3D points and vectors.
Definition: btVector3.h:83
btWorldImporter::getTriangleInfoMapByIndex
btTriangleInfoMap * getTriangleInfoMapByIndex(int index) const
Definition: btWorldImporter.cpp:2015
btHashMap::find
const Value * find(const Key &key) const
Definition: btHashMap.h:402
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:500
btRigidBodyFloatData::m_inverseMass
float m_inverseMass
Definition: btRigidBody.h:574
btHingeConstraintFloatData::m_useReferenceFrameA
int m_useReferenceFrameA
Definition: btHingeConstraint.h:383
btTypedConstraintData::m_objectType
int m_objectType
Definition: btTypedConstraint.h:403
btWorldImporter::createPoint2PointConstraint
virtual btPoint2PointConstraint * createPoint2PointConstraint(btRigidBody &rbA, btRigidBody &rbB, const btVector3 &pivotInA, const btVector3 &pivotInB)
constraints
Definition: btWorldImporter.cpp:1836
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:412
btRigidBody::setMassProps
void setMassProps(btScalar mass, const btVector3 &inertia)
Definition: btRigidBody.cpp:231
btContactSolverInfo
Definition: btContactSolverInfo.h:65
btTypedConstraintData::m_breakingImpulseThreshold
float m_breakingImpulseThreshold
Definition: btTypedConstraint.h:414
btCollisionObjectFloatData::m_friction
float m_friction
Definition: btCollisionObject.h:562
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:124
btHingeConstraintDoubleData::m_angularOnly
int m_angularOnly
Definition: btHingeConstraint.h:326
btWorldImporter::m_allocatedNames
btAlignedObjectArray< char * > m_allocatedNames
Definition: btWorldImporter.h:78
btCollisionObject::setCollisionFlags
void setCollisionFlags(int flags)
Definition: btCollisionObject.h:434
btGeneric6DofSpring2ConstraintData::m_rbAFrame
btTransformFloatData m_rbAFrame
Definition: btGeneric6DofSpring2Constraint.h:486
btRigidBodyDoubleData::m_collisionObjectData
btCollisionObjectDoubleData m_collisionObjectData
Definition: btRigidBody.h:589
btHingeConstraintDoubleData::m_biasFactor
float m_biasFactor
Definition: btHingeConstraint.h:334
btGeneric6DofSpring2ConstraintData::m_angularEquilibriumPoint
btVector3FloatData m_angularEquilibriumPoint
Definition: btGeneric6DofSpring2Constraint.h:519
btConeShapeData::m_upIndex
int m_upIndex
Definition: btConeShape.h:148
btCollisionObjectFloatData::m_name
char * m_name
Definition: btCollisionObject.h:553
btHingeConstraintDoubleData::m_rbAFrame
btTransformDoubleData m_rbAFrame
Definition: btHingeConstraint.h:323
btCollisionObjectDoubleData::m_worldTransform
btTransformDoubleData m_worldTransform
Definition: btCollisionObject.h:522
btQuantizedBvh::deSerializeFloat
virtual void deSerializeFloat(struct btQuantizedBvhFloatData &quantizedBvhFloatData)
Definition: btQuantizedBvh.cpp:1165
btTriangleMeshShapeData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btBvhTriangleMeshShape.h:120
PHY_INTEGER
Definition: btConcaveShape.h:28
CONETWIST_CONSTRAINT_TYPE
Definition: btTypedConstraint.h:40
btGeneric6DofSpringConstraintData::m_equilibriumPoint
float m_equilibriumPoint[6]
Definition: btGeneric6DofSpringConstraint.h:82
btTypedConstraint
TypedConstraint is the baseclass for Bullet constraints and vehicles.
Definition: btTypedConstraint.h:77
btHingeConstraint::setLimit
void setLimit(btScalar low, btScalar high, btScalar _softness=0.9f, btScalar _biasFactor=0.3f, btScalar _relaxationFactor=1.0f)
Definition: btHingeConstraint.h:184
btAlignedObjectArray::resize
void resize(int newsize, const T &fillData=T())
Definition: btAlignedObjectArray.h:220
CONVEX_HULL_SHAPE_PROXYTYPE
Definition: btBroadphaseProxy.h:35
btGeneric6DofSpringConstraintDoubleData2
Definition: btGeneric6DofSpringConstraint.h:87
btSliderConstraintData::m_rbAFrame
btTransformFloatData m_rbAFrame
Definition: btSliderConstraint.h:299
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:382
btWorldImporter::getFixedBody
static btRigidBody & getFixedBody()
Definition: btWorldImporter.cpp:1829
btHingeConstraintFloatData::m_angularOnly
int m_angularOnly
Definition: btHingeConstraint.h:384
btQuantizedBvh::isQuantized
bool isQuantized()
Definition: btQuantizedBvh.h:488
btHingeConstraintFloatData::m_enableAngularMotor
int m_enableAngularMotor
Definition: btHingeConstraint.h:386
btHingeConstraintDoubleData2::m_upperLimit
double m_upperLimit
Definition: btHingeConstraint.h:413
btDynamicsWorld::addConstraint
virtual void addConstraint(btTypedConstraint *constraint, bool disableCollisionsBetweenLinkedBodies=false)
Definition: btDynamicsWorld.h:71
btTypedConstraint::setEnabled
void setEnabled(bool enabled)
Definition: btTypedConstraint.h:216
btHingeConstraintFloatData
Definition: btHingeConstraint.h:378
btGeneric6DofSpringConstraintDoubleData2::m_equilibriumPoint
double m_equilibriumPoint[6]
Definition: btGeneric6DofSpringConstraint.h:92
btGImpactMeshShapeData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btGImpactShape.h:1165
btGeneric6DofSpring2ConstraintDoubleData2::m_angularUpperLimit
btVector3DoubleData m_angularUpperLimit
Definition: btGeneric6DofSpring2Constraint.h:553
btPoint2PointConstraintDoubleData::m_pivotInB
btVector3DoubleData m_pivotInB
Definition: btPoint2PointConstraint.h:152
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:1851
btStaticPlaneShapeData::m_localScaling
btVector3FloatData m_localScaling
Definition: btStaticPlaneShape.h:76
btGeneric6DofSpring2ConstraintDoubleData2::m_angularSpringStiffness
btVector3DoubleData m_angularSpringStiffness
Definition: btGeneric6DofSpring2Constraint.h:563
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:83
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
gContactAddedCallback
ContactAddedCallback gContactAddedCallback
This is to allow MaterialCombiner/Custom Friction/Restitution values.
Definition: btManifoldResult.cpp:23
btGeneric6DofSpring2ConstraintDoubleData2
Definition: btGeneric6DofSpring2Constraint.h:529
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:94
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:595
btGeneric6DofSpring2ConstraintData::m_angularSpringStiffness
btVector3FloatData m_angularSpringStiffness
Definition: btGeneric6DofSpring2Constraint.h:517
btGeneric6DofSpring2ConstraintDoubleData2::m_linearSpringStiffness
btVector3DoubleData m_linearSpringStiffness
Definition: btGeneric6DofSpring2Constraint.h:545
btWorldImporter::getCollisionShapeByIndex
btCollisionShape * getCollisionShapeByIndex(int index)
Definition: btWorldImporter.cpp:1938
btWorldImporter::getRigidBodyByName
btRigidBody * getRigidBodyByName(const char *name)
Definition: btWorldImporter.cpp:1953
btHingeConstraintFloatData::m_maxMotorImpulse
float m_maxMotorImpulse
Definition: btHingeConstraint.h:388
btSliderConstraint
Definition: btSliderConstraint.h:69
btHingeConstraintDoubleData2::m_rbBFrame
btTransformDoubleData m_rbBFrame
Definition: btHingeConstraint.h:405
btAlignedAlloc
#define btAlignedAlloc(size, alignment)
Definition: btAlignedAllocator.h:41
btWorldImporter::m_bodyMap
btHashMap< btHashPtr, btCollisionObject * > m_bodyMap
Definition: btWorldImporter.h:97
btGeneric6DofSpring2ConstraintDoubleData2::m_angularSpringDamping
btVector3DoubleData m_angularSpringDamping
Definition: btGeneric6DofSpring2Constraint.h:564
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 'sphere' of the capsule caps.
Definition: btCapsuleShape.h:144
btMeshPartData::m_indices32
btIntIndexData * m_indices32
Definition: btStridingMeshInterface.h:134
btCapsuleShape::deSerializeFloat
void deSerializeFloat(struct btCapsuleShapeData *dataBuffer)
Definition: btCapsuleShape.h:185
btBvhTriangleMeshShape::setTriangleInfoMap
void setTriangleInfoMap(btTriangleInfoMap *triangleInfoMap)
Definition: btBvhTriangleMeshShape.h:93
btStaticPlaneShapeData::m_planeNormal
btVector3FloatData m_planeNormal
Definition: btStaticPlaneShape.h:77
btSliderConstraintDoubleData::m_rbBFrame
btTransformDoubleData m_rbBFrame
Definition: btSliderConstraint.h:318
btWorldImporter::getNumBvhs
int getNumBvhs() const
Definition: btWorldImporter.cpp:2001
btConvexHullShape::addPoint
void addPoint(const btVector3 &point, bool recalculateLocalAabb=true)
Definition: btConvexHullShape.cpp:52
btWorldImporter::createSliderConstraint
virtual btSliderConstraint * createSliderConstraint(btRigidBody &rbA, btRigidBody &rbB, const btTransform &frameInA, const btTransform &frameInB, bool useLinearReferenceFrameA)
Definition: btWorldImporter.cpp:1911
btCompoundShapeChildData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btCompoundShape.h:179
btCompoundShapeData::m_numChildShapes
int m_numChildShapes
Definition: btCompoundShape.h:194
btGeneric6DofSpringConstraintData::m_springDamping
float m_springDamping[6]
Definition: btGeneric6DofSpringConstraint.h:84
COMPOUND_SHAPE_PROXYTYPE
Definition: btBroadphaseProxy.h:71
btConeTwistConstraintData
this structure is not used, except for loading pre-2.82 .bullet files
Definition: btConeTwistConstraint.h:331
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:327
btCollisionObjectDoubleData::m_collisionShape
void * m_collisionShape
Definition: btCollisionObject.h:518
POINT2POINT_CONSTRAINT_TYPE
Definition: btTypedConstraint.h:38
btGeneric6DofSpring2Constraint::enableSpring
void enableSpring(int index, bool onOff)
Definition: btGeneric6DofSpring2Constraint.cpp:1017
D6_CONSTRAINT_TYPE
Definition: btTypedConstraint.h:41
btGeneric6DofSpring2Constraint::setAngularUpperLimit
void setAngularUpperLimit(const btVector3 &angularUpper)
Definition: btGeneric6DofSpring2Constraint.h:389
btVector3FloatData
Definition: btVector3.h:1301
btTypedConstraintDoubleData::m_dbgDrawSize
double m_dbgDrawSize
Definition: btTypedConstraint.h:432
btTriangleMeshShapeData::m_collisionMargin
float m_collisionMargin
Definition: btBvhTriangleMeshShape.h:131
btTriangleInfoMap
The btTriangleInfoMap stores edge angle information for some triangles. You can compute this informat...
Definition: btTriangleInfoMap.h:58
btWorldImporter::getNumRigidBodies
int getNumRigidBodies() const
Definition: btWorldImporter.cpp:1982
btHingeConstraintDoubleData2::m_lowerLimit
double m_lowerLimit
Definition: btHingeConstraint.h:412
btTriangleMeshShapeData::m_quantizedFloatBvh
btQuantizedBvhFloatData * m_quantizedFloatBvh
Definition: btBvhTriangleMeshShape.h:126
btHingeConstraintDoubleData2::m_rbAFrame
btTransformDoubleData m_rbAFrame
Definition: btHingeConstraint.h:404
btCompoundShape
The btCompoundShape allows to store multiple other btCollisionShapes This allows for moving concave c...
Definition: btCompoundShape.h:54
HINGE_CONSTRAINT_TYPE
Definition: btTypedConstraint.h:39
btHingeConstraintFloatData::m_lowerLimit
float m_lowerLimit
Definition: btHingeConstraint.h:390
btGImpactShapeInterface::updateBound
void updateBound()
performs refit operation
Definition: btGImpactShape.h:123
btVector3::deSerializeFloat
void deSerializeFloat(const struct btVector3FloatData &dataIn)
Definition: btVector3.h:1319
btCapsuleShapeData::m_upAxis
int m_upAxis
Definition: btCapsuleShape.h:163
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:504
btPoint2PointConstraintDoubleData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 th...
Definition: btPoint2PointConstraint.h:148
btStaticPlaneShape
The btStaticPlaneShape simulates an infinite non-moving (static) collision plane. ...
Definition: btStaticPlaneShape.h:23
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:531
btGeneric6DofConstraint::setLinearUpperLimit
void setLinearUpperLimit(const btVector3 &linearUpper)
Definition: btGeneric6DofConstraint.h:465
btWorldImporter::~btWorldImporter
virtual ~btWorldImporter()
Definition: btWorldImporter.cpp:27
btHingeConstraintDoubleData::m_limitSoftness
float m_limitSoftness
Definition: btHingeConstraint.h:333
btIndexedMesh::m_vertexStride
int m_vertexStride
Definition: btTriangleIndexVertexArray.h:37
btSliderConstraintDoubleData::m_rbAFrame
btTransformDoubleData m_rbAFrame
Definition: btSliderConstraint.h:317
btGImpactMeshShapeData::m_localScaling
btVector3FloatData m_localScaling
Definition: btGImpactShape.h:1171
btHingeConstraintDoubleData2::m_enableAngularMotor
int m_enableAngularMotor
Definition: btHingeConstraint.h:408
btGeneric6DofConstraintData::m_angularUpperLimit
btVector3FloatData m_angularUpperLimit
Definition: btGeneric6DofConstraint.h:582
btWorldImporter::m_dynamicsWorld
btDynamicsWorld * m_dynamicsWorld
Definition: btWorldImporter.h:66
btGeneric6DofConstraintData::m_rbAFrame
btTransformFloatData m_rbAFrame
Definition: btGeneric6DofConstraint.h:576
btPoint2PointConstraintFloatData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btPoint2PointConstraint.h:129
btWorldImporter::m_floatVertexArrays
btAlignedObjectArray< btVector3FloatData * > m_floatVertexArrays
Definition: btWorldImporter.h:84
btRigidBody::setAngularFactor
void setAngularFactor(const btVector3 &angFac)
Definition: btRigidBody.h:490
btTypedConstraintDoubleData::m_overrideNumSolverIterations
int m_overrideNumSolverIterations
Definition: btTypedConstraint.h:435
btConeTwistConstraintData::m_relaxationFactor
float m_relaxationFactor
Definition: btConeTwistConstraint.h:343
btWorldImporter::m_objectNameMap
btHashMap< btHashPtr, const char * > m_objectNameMap
Definition: btWorldImporter.h:94
btTypedConstraintData::m_isEnabled
int m_isEnabled
Definition: btTypedConstraint.h:415
btHingeConstraintDoubleData::m_maxMotorImpulse
float m_maxMotorImpulse
Definition: btHingeConstraint.h:329
btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK
Definition: btCollisionObject.h:127
btDynamicsWorld::getSolverInfo
btContactSolverInfo & getSolverInfo()
Definition: btDynamicsWorld.h:132
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_angularEnableSpring
char m_angularEnableSpring[4]
Definition: btGeneric6DofSpring2Constraint.h:568
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:306
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:325
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:1822
btTypedConstraintFloatData::m_overrideNumSolverIterations
int m_overrideNumSolverIterations
Definition: btTypedConstraint.h:385
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:401
btGeneric6DofSpring2ConstraintData::m_angularSpringDamping
btVector3FloatData m_angularSpringDamping
Definition: btGeneric6DofSpring2Constraint.h:518
btTypedConstraintFloatData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btTypedConstraint.h:370
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:278
btCylinderShapeX
Definition: btCylinderShape.h:137
btIndexedMesh::m_vertexType
PHY_ScalarType m_vertexType
Definition: btTriangleIndexVertexArray.h:46
btVector3DoubleData
Definition: btVector3.h:1306
btSliderConstraintData::m_useOffsetForConstraintFrame
int m_useOffsetForConstraintFrame
Definition: btSliderConstraint.h:309
btConeTwistConstraintData::m_swingSpan1
float m_swingSpan1
Definition: btConeTwistConstraint.h:338
btCylinderShapeData::m_upAxis
int m_upAxis
Definition: btCylinderShape.h:188
btHingeConstraintDoubleData2::m_useReferenceFrameA
int m_useReferenceFrameA
Definition: btHingeConstraint.h:406
btRigidBodyFloatData::m_linearFactor
btVector3FloatData m_linearFactor
Definition: btRigidBody.h:568
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::getRigidBodyByIndex
btCollisionObject * getRigidBodyByIndex(int index) const
Definition: btWorldImporter.cpp:1987
btHingeConstraintFloatData::m_rbBFrame
btTransformFloatData m_rbBFrame
Definition: btHingeConstraint.h:382
STATIC_PLANE_PROXYTYPE
Definition: btBroadphaseProxy.h:67
btPoint2PointConstraintDoubleData2::m_pivotInB
btVector3DoubleData m_pivotInB
Definition: btPoint2PointConstraint.h:141
btMultiSphereShapeData
Definition: btMultiSphereShape.h:83
btGImpactMeshShape::setMargin
virtual void setMargin(btScalar margin)
Definition: btGImpactShape.h:998
btConvexHullShapeData::m_numUnscaledPoints
int m_numUnscaledPoints
Definition: btConvexHullShape.h:109
btGeneric6DofConstraintDoubleData2::m_rbBFrame
btTransformDoubleData m_rbBFrame
Definition: btGeneric6DofConstraint.h:593
btMeshPartData::m_vertices3d
btVector3DoubleData * m_vertices3d
Definition: btStridingMeshInterface.h:132