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

Bullet Collision Detection & Physics Library

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