Bullet Collision Detection & Physics Library: btRigidBody.h Source File

Bullet Collision Detection & Physics Library

btRigidBody.h
Go to the documentation of this file.
1 /*
2 Bullet Continuous Collision Detection and Physics Library
3 Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
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 #ifndef BT_RIGIDBODY_H
17 #define BT_RIGIDBODY_H
18
19 #include "LinearMath/btAlignedObjectArray.h"
20 #include "LinearMath/btTransform.h"
21 #include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
22 #include "BulletCollision/CollisionDispatch/btCollisionObject.h"
23
24 class btCollisionShape;
25 class btMotionState;
26 class btTypedConstraint;
27
28
29 extern btScalar gDeactivationTime;
30 extern bool gDisableDeactivation;
31
32 #ifdef BT_USE_DOUBLE_PRECISION
33 #define btRigidBodyData btRigidBodyDoubleData
34 #define btRigidBodyDataName "btRigidBodyDoubleData"
35 #else
36 #define btRigidBodyData btRigidBodyFloatData
37 #define btRigidBodyDataName "btRigidBodyFloatData"
38 #endif //BT_USE_DOUBLE_PRECISION
39
40
41 enum btRigidBodyFlags
42 {
43 BT_DISABLE_WORLD_GRAVITY = 1,
47 BT_ENABLE_GYROSCOPIC_FORCE_EXPLICIT = 2,
48 BT_ENABLE_GYROSCOPIC_FORCE_IMPLICIT_WORLD=4,
49 BT_ENABLE_GYROSCOPIC_FORCE_IMPLICIT_BODY=8,
50 BT_ENABLE_GYROPSCOPIC_FORCE = BT_ENABLE_GYROSCOPIC_FORCE_IMPLICIT_BODY,
51 };
52
53
62 class btRigidBody : public btCollisionObject
63 {
64
65 btMatrix3x3 m_invInertiaTensorWorld;
66 btVector3 m_linearVelocity;
67 btVector3 m_angularVelocity;
68 btScalar m_inverseMass;
69 btVector3 m_linearFactor;
70
71 btVector3 m_gravity;
72 btVector3 m_gravity_acceleration;
73 btVector3 m_invInertiaLocal;
74 btVector3 m_totalForce;
75 btVector3 m_totalTorque;
76
77 btScalar m_linearDamping;
78 btScalar m_angularDamping;
79
80 bool m_additionalDamping;
81 btScalar m_additionalDampingFactor;
82 btScalar m_additionalLinearDampingThresholdSqr;
83 btScalar m_additionalAngularDampingThresholdSqr;
84 btScalar m_additionalAngularDampingFactor;
85
86
87 btScalar m_linearSleepingThreshold;
88 btScalar m_angularSleepingThreshold;
89
90 //m_optionalMotionState allows to automatic synchronize the world transform for active objects
91 btMotionState* m_optionalMotionState;
92
93 //keep track of typed constraints referencing this rigid body, to disable collision between linked bodies
94 btAlignedObjectArray<btTypedConstraint*> m_constraintRefs;
95
96 int m_rigidbodyFlags;
97
98 int m_debugBodyId;
99
100
101 protected:
102
103 ATTRIBUTE_ALIGNED16(btVector3 m_deltaLinearVelocity);
104 btVector3 m_deltaAngularVelocity;
105 btVector3 m_angularFactor;
106 btVector3 m_invMass;
107 btVector3 m_pushVelocity;
108 btVector3 m_turnVelocity;
109
110
111 public:
112
113
119 struct btRigidBodyConstructionInfo
120 {
121 btScalar m_mass;
122
125 btMotionState* m_motionState;
126 btTransform m_startWorldTransform;
127
128 btCollisionShape* m_collisionShape;
129 btVector3 m_localInertia;
130 btScalar m_linearDamping;
131 btScalar m_angularDamping;
132
134 btScalar m_friction;
137 btScalar m_rollingFriction;
138 btScalar m_spinningFriction;//torsional friction around contact normal
139
141 btScalar m_restitution;
142
143 btScalar m_linearSleepingThreshold;
144 btScalar m_angularSleepingThreshold;
145
146 //Additional damping can help avoiding lowpass jitter motion, help stability for ragdolls etc.
147 //Such damping is undesirable, so once the overall simulation quality of the rigid body dynamics system has improved, this should become obsolete
148 bool m_additionalDamping;
149 btScalar m_additionalDampingFactor;
150 btScalar m_additionalLinearDampingThresholdSqr;
151 btScalar m_additionalAngularDampingThresholdSqr;
152 btScalar m_additionalAngularDampingFactor;
153
154 btRigidBodyConstructionInfo( btScalar mass, btMotionState* motionState, btCollisionShape* collisionShape, const btVector3& localInertia=btVector3(0,0,0)):
155 m_mass(mass),
156 m_motionState(motionState),
157 m_collisionShape(collisionShape),
158 m_localInertia(localInertia),
159 m_linearDamping(btScalar(0.)),
160 m_angularDamping(btScalar(0.)),
161 m_friction(btScalar(0.5)),
162 m_rollingFriction(btScalar(0)),
163 m_spinningFriction(btScalar(0)),
164 m_restitution(btScalar(0.)),
165 m_linearSleepingThreshold(btScalar(0.8)),
166 m_angularSleepingThreshold(btScalar(1.f)),
167 m_additionalDamping(false),
168 m_additionalDampingFactor(btScalar(0.005)),
169 m_additionalLinearDampingThresholdSqr(btScalar(0.01)),
170 m_additionalAngularDampingThresholdSqr(btScalar(0.01)),
171 m_additionalAngularDampingFactor(btScalar(0.01))
172 {
173 m_startWorldTransform.setIdentity();
174 }
175 };
176
178 btRigidBody( const btRigidBodyConstructionInfo& constructionInfo);
179
182 btRigidBody( btScalar mass, btMotionState* motionState, btCollisionShape* collisionShape, const btVector3& localInertia=btVector3(0,0,0));
183
184
185 virtual ~btRigidBody()
186 {
187 //No constraints should point to this rigidbody
188 //Remove constraints from the dynamics world before you delete the related rigidbodies.
189 btAssert(m_constraintRefs.size()==0);
190 }
191
192 protected:
193
195 void setupRigidBody(const btRigidBodyConstructionInfo& constructionInfo);
196
197 public:
198
199 void proceedToTransform(const btTransform& newTrans);
200
203 static const btRigidBody* upcast(const btCollisionObject* colObj)
204 {
205 if (colObj->getInternalType()&btCollisionObject::CO_RIGID_BODY)
206 return (const btRigidBody*)colObj;
207 return 0;
208 }
209 static btRigidBody* upcast(btCollisionObject* colObj)
210 {
211 if (colObj->getInternalType()&btCollisionObject::CO_RIGID_BODY)
212 return (btRigidBody*)colObj;
213 return 0;
214 }
215
217 void predictIntegratedTransform(btScalar step, btTransform& predictedTransform) ;
218
219 void saveKinematicState(btScalar step);
220
221 void applyGravity();
222
223 void setGravity(const btVector3& acceleration);
224
225 const btVector3& getGravity() const
226 {
227 return m_gravity_acceleration;
228 }
229
230 void setDamping(btScalar lin_damping, btScalar ang_damping);
231
232 btScalar getLinearDamping() const
233 {
234 return m_linearDamping;
235 }
236
237 btScalar getAngularDamping() const
238 {
239 return m_angularDamping;
240 }
241
242 btScalar getLinearSleepingThreshold() const
243 {
244 return m_linearSleepingThreshold;
245 }
246
247 btScalar getAngularSleepingThreshold() const
248 {
249 return m_angularSleepingThreshold;
250 }
251
252 void applyDamping(btScalar timeStep);
253
254 SIMD_FORCE_INLINE const btCollisionShape* getCollisionShape() const {
255 return m_collisionShape;
256 }
257
258 SIMD_FORCE_INLINE btCollisionShape* getCollisionShape() {
259 return m_collisionShape;
260 }
261
262 void setMassProps(btScalar mass, const btVector3& inertia);
263
264 const btVector3& getLinearFactor() const
265 {
266 return m_linearFactor;
267 }
268 void setLinearFactor(const btVector3& linearFactor)
269 {
270 m_linearFactor = linearFactor;
271 m_invMass = m_linearFactor*m_inverseMass;
272 }
273 btScalar getInvMass() const { return m_inverseMass; }
274 const btMatrix3x3& getInvInertiaTensorWorld() const {
275 return m_invInertiaTensorWorld;
276 }
277
278 void integrateVelocities(btScalar step);
279
280 void setCenterOfMassTransform(const btTransform& xform);
281
282 void applyCentralForce(const btVector3& force)
283 {
284 m_totalForce += force*m_linearFactor;
285 }
286
287 const btVector3& getTotalForce() const
288 {
289 return m_totalForce;
290 };
291
292 const btVector3& getTotalTorque() const
293 {
294 return m_totalTorque;
295 };
296
297 const btVector3& getInvInertiaDiagLocal() const
298 {
299 return m_invInertiaLocal;
300 };
301
302 void setInvInertiaDiagLocal(const btVector3& diagInvInertia)
303 {
304 m_invInertiaLocal = diagInvInertia;
305 }
306
307 void setSleepingThresholds(btScalar linear,btScalar angular)
308 {
309 m_linearSleepingThreshold = linear;
310 m_angularSleepingThreshold = angular;
311 }
312
313 void applyTorque(const btVector3& torque)
314 {
315 m_totalTorque += torque*m_angularFactor;
316 }
317
318 void applyForce(const btVector3& force, const btVector3& rel_pos)
319 {
320 applyCentralForce(force);
321 applyTorque(rel_pos.cross(force*m_linearFactor));
322 }
323
324 void applyCentralImpulse(const btVector3& impulse)
325 {
326 m_linearVelocity += impulse *m_linearFactor * m_inverseMass;
327 }
328
329 void applyTorqueImpulse(const btVector3& torque)
330 {
331 m_angularVelocity += m_invInertiaTensorWorld * torque * m_angularFactor;
332 }
333
334 void applyImpulse(const btVector3& impulse, const btVector3& rel_pos)
335 {
336 if (m_inverseMass != btScalar(0.))
337 {
338 applyCentralImpulse(impulse);
339 if (m_angularFactor)
340 {
341 applyTorqueImpulse(rel_pos.cross(impulse*m_linearFactor));
342 }
343 }
344 }
345
346 void clearForces()
347 {
348 m_totalForce.setValue(btScalar(0.0), btScalar(0.0), btScalar(0.0));
349 m_totalTorque.setValue(btScalar(0.0), btScalar(0.0), btScalar(0.0));
350 }
351
352 void updateInertiaTensor();
353
354 const btVector3& getCenterOfMassPosition() const {
355 return m_worldTransform.getOrigin();
356 }
357 btQuaternion getOrientation() const;
358
359 const btTransform& getCenterOfMassTransform() const {
360 return m_worldTransform;
361 }
362 const btVector3& getLinearVelocity() const {
363 return m_linearVelocity;
364 }
365 const btVector3& getAngularVelocity() const {
366 return m_angularVelocity;
367 }
368
369
370 inline void setLinearVelocity(const btVector3& lin_vel)
371 {
372 m_updateRevision++;
373 m_linearVelocity = lin_vel;
374 }
375
376 inline void setAngularVelocity(const btVector3& ang_vel)
377 {
378 m_updateRevision++;
379 m_angularVelocity = ang_vel;
380 }
381
382 btVector3 getVelocityInLocalPoint(const btVector3& rel_pos) const
383 {
384 //we also calculate lin/ang velocity for kinematic objects
385 return m_linearVelocity + m_angularVelocity.cross(rel_pos);
386
387 //for kinematic objects, we could also use use:
388 // return (m_worldTransform(rel_pos) - m_interpolationWorldTransform(rel_pos)) / m_kinematicTimeStep;
389 }
390
391 void translate(const btVector3& v)
392 {
393 m_worldTransform.getOrigin() += v;
394 }
395
396
397 void getAabb(btVector3& aabbMin,btVector3& aabbMax) const;
398
399
400
401
402
403 SIMD_FORCE_INLINE btScalar computeImpulseDenominator(const btVector3& pos, const btVector3& normal) const
404 {
405 btVector3 r0 = pos - getCenterOfMassPosition();
406
407 btVector3 c0 = (r0).cross(normal);
408
409 btVector3 vec = (c0 * getInvInertiaTensorWorld()).cross(r0);
410
411 return m_inverseMass + normal.dot(vec);
412
413 }
414
415 SIMD_FORCE_INLINE btScalar computeAngularImpulseDenominator(const btVector3& axis) const
416 {
417 btVector3 vec = axis * getInvInertiaTensorWorld();
418 return axis.dot(vec);
419 }
420
421 SIMD_FORCE_INLINE void updateDeactivation(btScalar timeStep)
422 {
423 if ( (getActivationState() == ISLAND_SLEEPING) || (getActivationState() == DISABLE_DEACTIVATION))
424 return;
425
426 if ((getLinearVelocity().length2() < m_linearSleepingThreshold*m_linearSleepingThreshold) &&
427 (getAngularVelocity().length2() < m_angularSleepingThreshold*m_angularSleepingThreshold))
428 {
429 m_deactivationTime += timeStep;
430 } else
431 {
432 m_deactivationTime=btScalar(0.);
433 setActivationState(0);
434 }
435
436 }
437
438 SIMD_FORCE_INLINE bool wantsSleeping()
439 {
440
441 if (getActivationState() == DISABLE_DEACTIVATION)
442 return false;
443
444 //disable deactivation
445 if (gDisableDeactivation || (gDeactivationTime == btScalar(0.)))
446 return false;
447
448 if ( (getActivationState() == ISLAND_SLEEPING) || (getActivationState() == WANTS_DEACTIVATION))
449 return true;
450
451 if (m_deactivationTime> gDeactivationTime)
452 {
453 return true;
454 }
455 return false;
456 }
457
458
459
460 const btBroadphaseProxy* getBroadphaseProxy() const
461 {
462 return m_broadphaseHandle;
463 }
464 btBroadphaseProxy* getBroadphaseProxy()
465 {
466 return m_broadphaseHandle;
467 }
468 void setNewBroadphaseProxy(btBroadphaseProxy* broadphaseProxy)
469 {
470 m_broadphaseHandle = broadphaseProxy;
471 }
472
473 //btMotionState allows to automatic synchronize the world transform for active objects
474 btMotionState* getMotionState()
475 {
476 return m_optionalMotionState;
477 }
478 const btMotionState* getMotionState() const
479 {
480 return m_optionalMotionState;
481 }
482 void setMotionState(btMotionState* motionState)
483 {
484 m_optionalMotionState = motionState;
485 if (m_optionalMotionState)
486 motionState->getWorldTransform(m_worldTransform);
487 }
488
489 //for experimental overriding of friction/contact solver func
490 int m_contactSolverType;
491 int m_frictionSolverType;
492
493 void setAngularFactor(const btVector3& angFac)
494 {
495 m_updateRevision++;
496 m_angularFactor = angFac;
497 }
498
499 void setAngularFactor(btScalar angFac)
500 {
501 m_updateRevision++;
502 m_angularFactor.setValue(angFac,angFac,angFac);
503 }
504 const btVector3& getAngularFactor() const
505 {
506 return m_angularFactor;
507 }
508
509 //is this rigidbody added to a btCollisionWorld/btDynamicsWorld/btBroadphase?
510 bool isInWorld() const
511 {
512 return (getBroadphaseProxy() != 0);
513 }
514
515 void addConstraintRef(btTypedConstraint* c);
516 void removeConstraintRef(btTypedConstraint* c);
517
518 btTypedConstraint* getConstraintRef(int index)
519 {
520 return m_constraintRefs[index];
521 }
522
523 int getNumConstraintRefs() const
524 {
525 return m_constraintRefs.size();
526 }
527
528 void setFlags(int flags)
529 {
530 m_rigidbodyFlags = flags;
531 }
532
533 int getFlags() const
534 {
535 return m_rigidbodyFlags;
536 }
537
538
539
540
542 btVector3 computeGyroscopicImpulseImplicit_World(btScalar dt) const;
543
545 btVector3 computeGyroscopicImpulseImplicit_Body(btScalar step) const;
546
548 btVector3 computeGyroscopicForceExplicit(btScalar maxGyroscopicForce) const;
549 btVector3 getLocalInertia() const;
550
552
553 virtual int calculateSerializeBufferSize() const;
554
556 virtual const char* serialize(void* dataBuffer, class btSerializer* serializer) const;
557
558 virtual void serializeSingleObject(class btSerializer* serializer) const;
559
560 };
561
562 //@todo add m_optionalMotionState and m_constraintRefs to btRigidBodyData
564 struct btRigidBodyFloatData
565 {
566 btCollisionObjectFloatData m_collisionObjectData;
567 btMatrix3x3FloatData m_invInertiaTensorWorld;
568 btVector3FloatData m_linearVelocity;
569 btVector3FloatData m_angularVelocity;
570 btVector3FloatData m_angularFactor;
571 btVector3FloatData m_linearFactor;
572 btVector3FloatData m_gravity;
573 btVector3FloatData m_gravity_acceleration;
574 btVector3FloatData m_invInertiaLocal;
575 btVector3FloatData m_totalForce;
576 btVector3FloatData m_totalTorque;
577 float m_inverseMass;
578 float m_linearDamping;
579 float m_angularDamping;
580 float m_additionalDampingFactor;
581 float m_additionalLinearDampingThresholdSqr;
582 float m_additionalAngularDampingThresholdSqr;
583 float m_additionalAngularDampingFactor;
584 float m_linearSleepingThreshold;
585 float m_angularSleepingThreshold;
586 int m_additionalDamping;
587 };
588
590 struct btRigidBodyDoubleData
591 {
592 btCollisionObjectDoubleData m_collisionObjectData;
593 btMatrix3x3DoubleData m_invInertiaTensorWorld;
594 btVector3DoubleData m_linearVelocity;
595 btVector3DoubleData m_angularVelocity;
596 btVector3DoubleData m_angularFactor;
597 btVector3DoubleData m_linearFactor;
598 btVector3DoubleData m_gravity;
599 btVector3DoubleData m_gravity_acceleration;
600 btVector3DoubleData m_invInertiaLocal;
601 btVector3DoubleData m_totalForce;
602 btVector3DoubleData m_totalTorque;
603 double m_inverseMass;
604 double m_linearDamping;
605 double m_angularDamping;
606 double m_additionalDampingFactor;
607 double m_additionalLinearDampingThresholdSqr;
608 double m_additionalAngularDampingThresholdSqr;
609 double m_additionalAngularDampingFactor;
610 double m_linearSleepingThreshold;
611 double m_angularSleepingThreshold;
612 int m_additionalDamping;
613 char m_padding[4];
614 };
615
616
617
618 #endif //BT_RIGIDBODY_H
619
btRigidBody::upcast
static const btRigidBody * upcast(const btCollisionObject *colObj)
to keep collision detection and dynamics separate we don&#39;t store a rigidbody pointer but a rigidbody ...
Definition: btRigidBody.h:203
btRigidBody::getMotionState
const btMotionState * getMotionState() const
Definition: btRigidBody.h:478
btRigidBody::btRigidBodyConstructionInfo::m_additionalDampingFactor
btScalar m_additionalDampingFactor
Definition: btRigidBody.h:149
btRigidBody::getLinearDamping
btScalar getLinearDamping() const
Definition: btRigidBody.h:232
btRigidBody::computeAngularImpulseDenominator
btScalar computeAngularImpulseDenominator(const btVector3 &axis) const
Definition: btRigidBody.h:415
btRigidBodyFloatData::m_gravity
btVector3FloatData m_gravity
Definition: btRigidBody.h:572
btCollisionObjectFloatData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btCollisionObject.h:637
btMatrix3x3FloatData
for serialization
Definition: btMatrix3x3.h:1302
btRigidBody::getAabb
void getAabb(btVector3 &aabbMin, btVector3 &aabbMax) const
Definition: btRigidBody.cpp:129
BT_DISABLE_WORLD_GRAVITY
Definition: btRigidBody.h:43
btRigidBody::computeImpulseDenominator
btScalar computeImpulseDenominator(const btVector3 &pos, const btVector3 &normal) const
Definition: btRigidBody.h:403
btRigidBody::translate
void translate(const btVector3 &v)
Definition: btRigidBody.h:391
btRigidBody::getAngularVelocity
const btVector3 & getAngularVelocity() const
Definition: btRigidBody.h:365
btRigidBody::applyGravity
void applyGravity()
Definition: btRigidBody.cpp:218
btRigidBody::m_totalTorque
btVector3 m_totalTorque
Definition: btRigidBody.h:75
btRigidBody::btRigidBodyConstructionInfo::m_angularSleepingThreshold
btScalar m_angularSleepingThreshold
Definition: btRigidBody.h:144
btRigidBody::m_contactSolverType
int m_contactSolverType
Definition: btRigidBody.h:490
btVector3::setValue
void setValue(const btScalar &_x, const btScalar &_y, const btScalar &_z)
Definition: btVector3.h:652
btRigidBody::getTotalTorque
const btVector3 & getTotalTorque() const
Definition: btRigidBody.h:292
btRigidBody::applyTorqueImpulse
void applyTorqueImpulse(const btVector3 &torque)
Definition: btRigidBody.h:329
btRigidBody::computeGyroscopicForceExplicit
btVector3 computeGyroscopicForceExplicit(btScalar maxGyroscopicForce) const
explicit version is best avoided, it gains energy
Definition: btRigidBody.cpp:294
btRigidBodyFloatData::m_angularFactor
btVector3FloatData m_angularFactor
Definition: btRigidBody.h:570
btAlignedObjectArray
The btAlignedObjectArray template class uses a subset of the stl::vector interface for its methods It...
Definition: btAlignedObjectArray.h:53
btRigidBody::predictIntegratedTransform
void predictIntegratedTransform(btScalar step, btTransform &predictedTransform)
continuous collision detection needs prediction
Definition: btRigidBody.cpp:106
btRigidBody::updateInertiaTensor
void updateInertiaTensor()
Definition: btRigidBody.cpp:256
btRigidBody::m_totalForce
btVector3 m_totalForce
Definition: btRigidBody.h:74
btRigidBody::m_angularDamping
btScalar m_angularDamping
Definition: btRigidBody.h:78
btRigidBodyFloatData::m_angularVelocity
btVector3FloatData m_angularVelocity
Definition: btRigidBody.h:569
btRigidBody::getCenterOfMassTransform
const btTransform & getCenterOfMassTransform() const
Definition: btRigidBody.h:359
gDisableDeactivation
bool gDisableDeactivation
Definition: btRigidBody.cpp:26
btRigidBody::wantsSleeping
bool wantsSleeping()
Definition: btRigidBody.h:438
btRigidBody::getAngularSleepingThreshold
btScalar getAngularSleepingThreshold() const
Definition: btRigidBody.h:247
btRigidBodyDoubleData::m_totalForce
btVector3DoubleData m_totalForce
Definition: btRigidBody.h:601
btRigidBody::calculateSerializeBufferSize
virtual int calculateSerializeBufferSize() const
Definition: btRigidBody.cpp:476
btRigidBody::m_turnVelocity
btVector3 m_turnVelocity
Definition: btRigidBody.h:108
btRigidBody::getBroadphaseProxy
btBroadphaseProxy * getBroadphaseProxy()
Definition: btRigidBody.h:464
btTransform::setIdentity
void setIdentity()
Set this transformation to the identity.
Definition: btTransform.h:172
btAssert
#define btAssert(x)
Definition: btScalar.h:131
btRigidBody::m_gravity
btVector3 m_gravity
Definition: btRigidBody.h:71
btCollisionShape
The btCollisionShape class provides an interface for collision shapes that can be shared among btColl...
Definition: btCollisionShape.h:27
btRigidBodyFloatData::m_additionalAngularDampingThresholdSqr
float m_additionalAngularDampingThresholdSqr
Definition: btRigidBody.h:582
btRigidBodyDoubleData::m_gravity
btVector3DoubleData m_gravity
Definition: btRigidBody.h:598
SIMD_FORCE_INLINE
#define SIMD_FORCE_INLINE
Definition: btScalar.h:81
btRigidBody::getLinearFactor
const btVector3 & getLinearFactor() const
Definition: btRigidBody.h:264
btTransform.h
btRigidBodyDoubleData::m_linearDamping
double m_linearDamping
Definition: btRigidBody.h:604
btRigidBodyDoubleData::m_additionalDampingFactor
double m_additionalDampingFactor
Definition: btRigidBody.h:606
btCollisionObject::getActivationState
int getActivationState() const
Definition: btCollisionObject.h:282
btRigidBody::btRigidBodyConstructionInfo::m_mass
btScalar m_mass
Definition: btRigidBody.h:121
btRigidBodyDoubleData::m_linearVelocity
btVector3DoubleData m_linearVelocity
Definition: btRigidBody.h:594
btRigidBody::btRigidBody
btRigidBody(const btRigidBodyConstructionInfo &constructionInfo)
btRigidBody constructor using construction info
Definition: btRigidBody.cpp:30
btRigidBody::setDamping
void setDamping(btScalar lin_damping, btScalar ang_damping)
Definition: btRigidBody.cpp:151
btRigidBody::m_angularSleepingThreshold
btScalar m_angularSleepingThreshold
Definition: btRigidBody.h:88
btRigidBody::getOrientation
btQuaternion getOrientation() const
Definition: btRigidBody.cpp:405
btRigidBody::setLinearFactor
void setLinearFactor(const btVector3 &linearFactor)
Definition: btRigidBody.h:268
btRigidBody::m_additionalDamping
bool m_additionalDamping
Definition: btRigidBody.h:80
btRigidBodyFloatData::m_linearSleepingThreshold
float m_linearSleepingThreshold
Definition: btRigidBody.h:584
btRigidBody::m_additionalLinearDampingThresholdSqr
btScalar m_additionalLinearDampingThresholdSqr
Definition: btRigidBody.h:82
btRigidBody::m_rigidbodyFlags
int m_rigidbodyFlags
Definition: btRigidBody.h:96
btRigidBody::btRigidBodyConstructionInfo::m_localInertia
btVector3 m_localInertia
Definition: btRigidBody.h:129
btRigidBody::setSleepingThresholds
void setSleepingThresholds(btScalar linear, btScalar angular)
Definition: btRigidBody.h:307
btRigidBodyFloatData::m_additionalDampingFactor
float m_additionalDampingFactor
Definition: btRigidBody.h:580
btCollisionObject::m_worldTransform
btTransform m_worldTransform
Definition: btCollisionObject.h:54
btRigidBodyDoubleData::m_inverseMass
double m_inverseMass
Definition: btRigidBody.h:603
ISLAND_SLEEPING
#define ISLAND_SLEEPING
Definition: btCollisionObject.h:23
btRigidBody::getAngularFactor
const btVector3 & getAngularFactor() const
Definition: btRigidBody.h:504
btRigidBody::btRigidBodyConstructionInfo::m_rollingFriction
btScalar m_rollingFriction
the m_rollingFriction prevents rounded shapes, such as spheres, cylinders and capsules from rolling f...
Definition: btRigidBody.h:137
btRigidBodyFloatData::m_additionalLinearDampingThresholdSqr
float m_additionalLinearDampingThresholdSqr
Definition: btRigidBody.h:581
btRigidBodyFloatData::m_linearDamping
float m_linearDamping
Definition: btRigidBody.h:578
btRigidBody::m_pushVelocity
btVector3 m_pushVelocity
Definition: btRigidBody.h:107
btRigidBodyFloatData::m_collisionObjectData
btCollisionObjectFloatData m_collisionObjectData
Definition: btRigidBody.h:566
btRigidBodyDoubleData::m_linearFactor
btVector3DoubleData m_linearFactor
Definition: btRigidBody.h:597
btSerializer
Definition: btSerializer.h:68
btRigidBodyFloatData::m_totalForce
btVector3FloatData m_totalForce
Definition: btRigidBody.h:575
btRigidBody::getCollisionShape
const btCollisionShape * getCollisionShape() const
Definition: btRigidBody.h:254
btRigidBodyDoubleData::m_angularDamping
double m_angularDamping
Definition: btRigidBody.h:605
btRigidBody::btRigidBodyConstructionInfo::m_additionalLinearDampingThresholdSqr
btScalar m_additionalLinearDampingThresholdSqr
Definition: btRigidBody.h:150
btRigidBody::m_inverseMass
btScalar m_inverseMass
Definition: btRigidBody.h:68
btRigidBody::applyCentralForce
void applyCentralForce(const btVector3 &force)
Definition: btRigidBody.h:282
BT_ENABLE_GYROSCOPIC_FORCE_EXPLICIT
BT_ENABLE_GYROPSCOPIC_FORCE flags is enabled by default in Bullet 2.83 and onwards.
Definition: btRigidBody.h:47
btCollisionObject::m_deactivationTime
btScalar m_deactivationTime
Definition: btCollisionObject.h:85
btRigidBody::integrateVelocities
void integrateVelocities(btScalar step)
Definition: btRigidBody.cpp:387
btRigidBody::updateDeactivation
void updateDeactivation(btScalar timeStep)
Definition: btRigidBody.h:421
btRigidBody::m_invInertiaLocal
btVector3 m_invInertiaLocal
Definition: btRigidBody.h:73
btRigidBodyFloatData::m_additionalDamping
int m_additionalDamping
Definition: btRigidBody.h:586
btCollisionObjectDoubleData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btCollisionObject.h:602
btRigidBody::computeGyroscopicImpulseImplicit_World
btVector3 computeGyroscopicImpulseImplicit_World(btScalar dt) const
perform implicit force computation in world space
Definition: btRigidBody.cpp:350
btRigidBodyDoubleData::m_additionalAngularDampingFactor
double m_additionalAngularDampingFactor
Definition: btRigidBody.h:609
btRigidBody::m_deltaLinearVelocity
btVector3 m_deltaLinearVelocity
Definition: btRigidBody.h:103
btRigidBody::applyTorque
void applyTorque(const btVector3 &torque)
Definition: btRigidBody.h:313
btRigidBody::getInvInertiaDiagLocal
const btVector3 & getInvInertiaDiagLocal() const
Definition: btRigidBody.h:297
gDeactivationTime
btScalar gDeactivationTime
Definition: btRigidBody.cpp:25
btTransform::getOrigin
btVector3 & getOrigin()
Return the origin vector translation.
Definition: btTransform.h:117
btRigidBody::getLinearVelocity
const btVector3 & getLinearVelocity() const
Definition: btRigidBody.h:362
btRigidBody::setupRigidBody
void setupRigidBody(const btRigidBodyConstructionInfo &constructionInfo)
setupRigidBody is only used internally by the constructor
Definition: btRigidBody.cpp:41
btRigidBodyFloatData::m_angularDamping
float m_angularDamping
Definition: btRigidBody.h:579
btRigidBodyDoubleData::m_invInertiaTensorWorld
btMatrix3x3DoubleData m_invInertiaTensorWorld
Definition: btRigidBody.h:593
btRigidBodyDoubleData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btRigidBody.h:590
btRigidBody::setFlags
void setFlags(int flags)
Definition: btRigidBody.h:528
btRigidBody::addConstraintRef
void addConstraintRef(btTypedConstraint *c)
Definition: btRigidBody.cpp:433
btRigidBody::getInvMass
btScalar getInvMass() const
Definition: btRigidBody.h:273
btRigidBody::getBroadphaseProxy
const btBroadphaseProxy * getBroadphaseProxy() const
Definition: btRigidBody.h:460
btVector3::cross
btVector3 cross(const btVector3 &v) const
Return the cross product between this and another vector.
Definition: btVector3.h:389
btVector3::dot
btScalar dot(const btVector3 &v) const
Return the dot product.
Definition: btVector3.h:235
btCollisionObject::CO_RIGID_BODY
Definition: btCollisionObject.h:149
btRigidBody::getCollisionShape
btCollisionShape * getCollisionShape()
Definition: btRigidBody.h:258
btRigidBodyFloatData::m_additionalAngularDampingFactor
float m_additionalAngularDampingFactor
Definition: btRigidBody.h:583
btRigidBodyFlags
btRigidBodyFlags
Definition: btRigidBody.h:41
btRigidBody::m_optionalMotionState
btMotionState * m_optionalMotionState
Definition: btRigidBody.h:91
btRigidBody::btRigidBodyConstructionInfo::m_restitution
btScalar m_restitution
best simulation results using zero restitution.
Definition: btRigidBody.h:141
btCollisionObject
btCollisionObject can be used to manage collision detection objects.
Definition: btCollisionObject.h:49
btRigidBody::m_linearSleepingThreshold
btScalar m_linearSleepingThreshold
Definition: btRigidBody.h:87
btRigidBody::setLinearVelocity
void setLinearVelocity(const btVector3 &lin_vel)
Definition: btRigidBody.h:370
btBroadphaseProxy.h
btRigidBody
The btRigidBody is the main class for rigid body objects.
Definition: btRigidBody.h:62
btRigidBody::getLinearSleepingThreshold
btScalar getLinearSleepingThreshold() const
Definition: btRigidBody.h:242
btRigidBody::getFlags
int getFlags() const
Definition: btRigidBody.h:533
btRigidBody::m_angularFactor
btVector3 m_angularFactor
Definition: btRigidBody.h:105
btRigidBody::clearForces
void clearForces()
Definition: btRigidBody.h:346
btRigidBodyDoubleData::m_invInertiaLocal
btVector3DoubleData m_invInertiaLocal
Definition: btRigidBody.h:600
btRigidBody::btRigidBodyConstructionInfo
The btRigidBodyConstructionInfo structure provides information to create a rigid body.
Definition: btRigidBody.h:119
btRigidBodyFloatData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btRigidBody.h:564
btRigidBody::m_angularVelocity
btVector3 m_angularVelocity
Definition: btRigidBody.h:67
btRigidBodyDoubleData::m_angularFactor
btVector3DoubleData m_angularFactor
Definition: btRigidBody.h:596
btRigidBody::proceedToTransform
void proceedToTransform(const btTransform &newTrans)
Definition: btRigidBody.cpp:227
btRigidBody::m_additionalDampingFactor
btScalar m_additionalDampingFactor
Definition: btRigidBody.h:81
btCollisionObject::m_updateRevision
int m_updateRevision
internal update revision number. It will be increased when the object changes. This allows some subsy...
Definition: btCollisionObject.h:123
btRigidBody::m_linearDamping
btScalar m_linearDamping
Definition: btRigidBody.h:77
btRigidBody::btRigidBodyConstructionInfo::m_additionalAngularDampingFactor
btScalar m_additionalAngularDampingFactor
Definition: btRigidBody.h:152
btBroadphaseProxy
The btBroadphaseProxy is the main class that can be used with the Bullet broadphases.
Definition: btBroadphaseProxy.h:85
btRigidBody::btRigidBodyConstructionInfo::btRigidBodyConstructionInfo
btRigidBodyConstructionInfo(btScalar mass, btMotionState *motionState, btCollisionShape *collisionShape, const btVector3 &localInertia=btVector3(0, 0, 0))
Definition: btRigidBody.h:154
btRigidBody::m_linearFactor
btVector3 m_linearFactor
Definition: btRigidBody.h:69
btRigidBody::btRigidBodyConstructionInfo::m_startWorldTransform
btTransform m_startWorldTransform
Definition: btRigidBody.h:126
btRigidBody::m_linearVelocity
btVector3 m_linearVelocity
Definition: btRigidBody.h:66
btVector3
btVector3 can be used to represent 3D points and vectors.
Definition: btVector3.h:83
ATTRIBUTE_ALIGNED16
#define ATTRIBUTE_ALIGNED16(a)
Definition: btScalar.h:82
btRigidBodyDoubleData::m_angularVelocity
btVector3DoubleData m_angularVelocity
Definition: btRigidBody.h:595
btRigidBody::setAngularFactor
void setAngularFactor(btScalar angFac)
Definition: btRigidBody.h:499
btRigidBody::applyForce
void applyForce(const btVector3 &force, const btVector3 &rel_pos)
Definition: btRigidBody.h:318
btRigidBodyFloatData::m_inverseMass
float m_inverseMass
Definition: btRigidBody.h:577
btAlignedObjectArray::size
int size() const
return the number of elements in the array
Definition: btAlignedObjectArray.h:155
btRigidBody::m_debugBodyId
int m_debugBodyId
Definition: btRigidBody.h:98
btRigidBodyFloatData::m_totalTorque
btVector3FloatData m_totalTorque
Definition: btRigidBody.h:576
btRigidBodyFloatData::m_invInertiaTensorWorld
btMatrix3x3FloatData m_invInertiaTensorWorld
Definition: btRigidBody.h:567
btRigidBody::getVelocityInLocalPoint
btVector3 getVelocityInLocalPoint(const btVector3 &rel_pos) const
Definition: btRigidBody.h:382
btTransform
The btTransform class supports rigid transforms with only translation and rotation and no scaling/she...
Definition: btTransform.h:34
btRigidBody::btRigidBodyConstructionInfo::m_angularDamping
btScalar m_angularDamping
Definition: btRigidBody.h:131
btRigidBody::setCenterOfMassTransform
void setCenterOfMassTransform(const btTransform &xform)
Definition: btRigidBody.cpp:413
btRigidBody::getConstraintRef
btTypedConstraint * getConstraintRef(int index)
Definition: btRigidBody.h:518
btRigidBody::setMassProps
void setMassProps(btScalar mass, const btVector3 &inertia)
Definition: btRigidBody.cpp:233
btRigidBodyDoubleData::m_additionalAngularDampingThresholdSqr
double m_additionalAngularDampingThresholdSqr
Definition: btRigidBody.h:608
btRigidBody::applyDamping
void applyDamping(btScalar timeStep)
applyDamping damps the velocity, using the given m_linearDamping and m_angularDamping ...
Definition: btRigidBody.cpp:161
btRigidBody::getCenterOfMassPosition
const btVector3 & getCenterOfMassPosition() const
Definition: btRigidBody.h:354
btRigidBodyDoubleData::m_collisionObjectData
btCollisionObjectDoubleData m_collisionObjectData
Definition: btRigidBody.h:592
WANTS_DEACTIVATION
#define WANTS_DEACTIVATION
Definition: btCollisionObject.h:24
btRigidBodyDoubleData::m_linearSleepingThreshold
double m_linearSleepingThreshold
Definition: btRigidBody.h:610
btTypedConstraint
TypedConstraint is the baseclass for Bullet constraints and vehicles.
Definition: btTypedConstraint.h:78
btMotionState
The btMotionState interface class allows the dynamics world to synchronize and interpolate the update...
Definition: btMotionState.h:23
btRigidBody::saveKinematicState
void saveKinematicState(btScalar step)
Definition: btRigidBody.cpp:111
btCollisionObject::getInternalType
int getInternalType() const
reserved for Bullet internal usage
Definition: btCollisionObject.h:367
btRigidBody::setAngularVelocity
void setAngularVelocity(const btVector3 &ang_vel)
Definition: btRigidBody.h:376
btRigidBody::setInvInertiaDiagLocal
void setInvInertiaDiagLocal(const btVector3 &diagInvInertia)
Definition: btRigidBody.h:302
btRigidBodyDoubleData::m_gravity_acceleration
btVector3DoubleData m_gravity_acceleration
Definition: btRigidBody.h:599
BT_ENABLE_GYROSCOPIC_FORCE_IMPLICIT_WORLD
Definition: btRigidBody.h:48
btRigidBody::setMotionState
void setMotionState(btMotionState *motionState)
Definition: btRigidBody.h:482
btRigidBodyFloatData::m_linearVelocity
btVector3FloatData m_linearVelocity
Definition: btRigidBody.h:568
btCollisionObject.h
btRigidBody::btRigidBodyConstructionInfo::m_linearSleepingThreshold
btScalar m_linearSleepingThreshold
Definition: btRigidBody.h:143
btRigidBody::btRigidBodyConstructionInfo::m_additionalAngularDampingThresholdSqr
btScalar m_additionalAngularDampingThresholdSqr
Definition: btRigidBody.h:151
DISABLE_DEACTIVATION
#define DISABLE_DEACTIVATION
Definition: btCollisionObject.h:25
btRigidBody::applyCentralImpulse
void applyCentralImpulse(const btVector3 &impulse)
Definition: btRigidBody.h:324
btRigidBodyDoubleData::m_additionalDamping
int m_additionalDamping
Definition: btRigidBody.h:612
btAlignedObjectArray.h
btRigidBody::getGravity
const btVector3 & getGravity() const
Definition: btRigidBody.h:225
btRigidBody::btRigidBodyConstructionInfo::m_spinningFriction
btScalar m_spinningFriction
Definition: btRigidBody.h:138
btRigidBody::m_additionalAngularDampingThresholdSqr
btScalar m_additionalAngularDampingThresholdSqr
Definition: btRigidBody.h:83
btMatrix3x3
The btMatrix3x3 class implements a 3x3 rotation matrix, to perform linear algebra in combination with...
Definition: btMatrix3x3.h:48
btRigidBody::getMotionState
btMotionState * getMotionState()
Definition: btRigidBody.h:474
btVector3FloatData
Definition: btVector3.h:1312
btRigidBody::getTotalForce
const btVector3 & getTotalForce() const
Definition: btRigidBody.h:287
btRigidBody::m_gravity_acceleration
btVector3 m_gravity_acceleration
Definition: btRigidBody.h:72
BT_ENABLE_GYROSCOPIC_FORCE_IMPLICIT_BODY
Definition: btRigidBody.h:49
btRigidBody::m_additionalAngularDampingFactor
btScalar m_additionalAngularDampingFactor
Definition: btRigidBody.h:84
btRigidBody::applyImpulse
void applyImpulse(const btVector3 &impulse, const btVector3 &rel_pos)
Definition: btRigidBody.h:334
btMatrix3x3DoubleData
for serialization
Definition: btMatrix3x3.h:1308
btRigidBody::getInvInertiaTensorWorld
const btMatrix3x3 & getInvInertiaTensorWorld() const
Definition: btRigidBody.h:274
btCollisionObject::m_broadphaseHandle
btBroadphaseProxy * m_broadphaseHandle
Definition: btCollisionObject.h:68
btQuaternion
The btQuaternion implements quaternion to perform linear algebra rotations in combination with btMatr...
Definition: btQuaternion.h:55
btRigidBody::setNewBroadphaseProxy
void setNewBroadphaseProxy(btBroadphaseProxy *broadphaseProxy)
Definition: btRigidBody.h:468
btRigidBodyFloatData::m_invInertiaLocal
btVector3FloatData m_invInertiaLocal
Definition: btRigidBody.h:574
btRigidBodyDoubleData::m_totalTorque
btVector3DoubleData m_totalTorque
Definition: btRigidBody.h:602
btRigidBodyFloatData::m_angularSleepingThreshold
float m_angularSleepingThreshold
Definition: btRigidBody.h:585
btRigidBody::btRigidBodyConstructionInfo::m_collisionShape
btCollisionShape * m_collisionShape
Definition: btRigidBody.h:128
btRigidBody::~btRigidBody
virtual ~btRigidBody()
Definition: btRigidBody.h:185
btRigidBody::m_constraintRefs
btAlignedObjectArray< btTypedConstraint * > m_constraintRefs
Definition: btRigidBody.h:94
btRigidBodyDoubleData::m_angularSleepingThreshold
double m_angularSleepingThreshold
Definition: btRigidBody.h:611
btRigidBody::m_frictionSolverType
int m_frictionSolverType
Definition: btRigidBody.h:491
btRigidBody::removeConstraintRef
void removeConstraintRef(btTypedConstraint *c)
Definition: btRigidBody.cpp:456
btRigidBody::m_deltaAngularVelocity
btVector3 m_deltaAngularVelocity
Definition: btRigidBody.h:104
btRigidBodyDoubleData::m_additionalLinearDampingThresholdSqr
double m_additionalLinearDampingThresholdSqr
Definition: btRigidBody.h:607
btRigidBody::setAngularFactor
void setAngularFactor(const btVector3 &angFac)
Definition: btRigidBody.h:493
btRigidBody::upcast
static btRigidBody * upcast(btCollisionObject *colObj)
Definition: btRigidBody.h:209
BT_ENABLE_GYROPSCOPIC_FORCE
Definition: btRigidBody.h:50
btRigidBody::btRigidBodyConstructionInfo::m_additionalDamping
bool m_additionalDamping
Definition: btRigidBody.h:148
btRigidBodyFloatData::m_gravity_acceleration
btVector3FloatData m_gravity_acceleration
Definition: btRigidBody.h:573
btRigidBody::btRigidBodyConstructionInfo::m_motionState
btMotionState * m_motionState
When a motionState is provided, the rigid body will initialize its world transform from the motion st...
Definition: btRigidBody.h:125
btRigidBody::btRigidBodyConstructionInfo::m_linearDamping
btScalar m_linearDamping
Definition: btRigidBody.h:130
btCollisionObject::setActivationState
void setActivationState(int newState) const
Definition: btCollisionObject.cpp:60
btRigidBody::btRigidBodyConstructionInfo::m_friction
btScalar m_friction
best simulation results when friction is non-zero
Definition: btRigidBody.h:134
btRigidBody::computeGyroscopicImpulseImplicit_Body
btVector3 computeGyroscopicImpulseImplicit_Body(btScalar step) const
perform implicit force computation in body space (inertial frame)
Definition: btRigidBody.cpp:309
btRigidBody::serialize
virtual const char * serialize(void *dataBuffer, class btSerializer *serializer) const
fills the dataBuffer and returns the struct name (and 0 on failure)
Definition: btRigidBody.cpp:483
btRigidBody::m_invMass
btVector3 m_invMass
Definition: btRigidBody.h:106
btRigidBody::serializeSingleObject
virtual void serializeSingleObject(class btSerializer *serializer) const
Definition: btRigidBody.cpp:520
btRigidBody::getLocalInertia
btVector3 getLocalInertia() const
Definition: btRigidBody.cpp:263
btMotionState::getWorldTransform
virtual void getWorldTransform(btTransform &worldTrans) const =0
btScalar
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition: btScalar.h:292
btVector3DoubleData
Definition: btVector3.h:1317
btRigidBody::getAngularDamping
btScalar getAngularDamping() const
Definition: btRigidBody.h:237
btRigidBodyFloatData::m_linearFactor
btVector3FloatData m_linearFactor
Definition: btRigidBody.h:571
btRigidBody::m_invInertiaTensorWorld
btMatrix3x3 m_invInertiaTensorWorld
Definition: btRigidBody.h:65
btRigidBody::setGravity
void setGravity(const btVector3 &acceleration)
Definition: btRigidBody.cpp:137
btRigidBody::isInWorld
bool isInWorld() const
Definition: btRigidBody.h:510
btRigidBody::getNumConstraintRefs
int getNumConstraintRefs() const
Definition: btRigidBody.h:523