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