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

Bullet Collision Detection & Physics Library

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

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;
139 btScalar m_restitution;
140
141 btScalar m_linearSleepingThreshold;
142 btScalar m_angularSleepingThreshold;
143
144 //Additional damping can help avoiding lowpass jitter motion, help stability for ragdolls etc.
145 //Such damping is undesirable, so once the overall simulation quality of the rigid body dynamics system has improved, this should become obsolete
146 bool m_additionalDamping;
147 btScalar m_additionalDampingFactor;
148 btScalar m_additionalLinearDampingThresholdSqr;
149 btScalar m_additionalAngularDampingThresholdSqr;
150 btScalar m_additionalAngularDampingFactor;
151
152 btRigidBodyConstructionInfo( btScalar mass, btMotionState* motionState, btCollisionShape* collisionShape, const btVector3& localInertia=btVector3(0,0,0)):
153 m_mass(mass),
154 m_motionState(motionState),
155 m_collisionShape(collisionShape),
156 m_localInertia(localInertia),
157 m_linearDamping(btScalar(0.)),
158 m_angularDamping(btScalar(0.)),
159 m_friction(btScalar(0.5)),
160 m_rollingFriction(btScalar(0)),
161 m_restitution(btScalar(0.)),
162 m_linearSleepingThreshold(btScalar(0.8)),
163 m_angularSleepingThreshold(btScalar(1.f)),
164 m_additionalDamping(false),
165 m_additionalDampingFactor(btScalar(0.005)),
166 m_additionalLinearDampingThresholdSqr(btScalar(0.01)),
167 m_additionalAngularDampingThresholdSqr(btScalar(0.01)),
168 m_additionalAngularDampingFactor(btScalar(0.01))
169 {
170 m_startWorldTransform.setIdentity();
171 }
172 };
173
175 btRigidBody( const btRigidBodyConstructionInfo& constructionInfo);
176
179 btRigidBody( btScalar mass, btMotionState* motionState, btCollisionShape* collisionShape, const btVector3& localInertia=btVector3(0,0,0));
180
181
182 virtual ~btRigidBody()
183 {
184 //No constraints should point to this rigidbody
185 //Remove constraints from the dynamics world before you delete the related rigidbodies.
186 btAssert(m_constraintRefs.size()==0);
187 }
188
189 protected:
190
192 void setupRigidBody(const btRigidBodyConstructionInfo& constructionInfo);
193
194 public:
195
196 void proceedToTransform(const btTransform& newTrans);
197
200 static const btRigidBody* upcast(const btCollisionObject* colObj)
201 {
202 if (colObj->getInternalType()&btCollisionObject::CO_RIGID_BODY)
203 return (const btRigidBody*)colObj;
204 return 0;
205 }
206 static btRigidBody* upcast(btCollisionObject* colObj)
207 {
208 if (colObj->getInternalType()&btCollisionObject::CO_RIGID_BODY)
209 return (btRigidBody*)colObj;
210 return 0;
211 }
212
214 void predictIntegratedTransform(btScalar step, btTransform& predictedTransform) ;
215
216 void saveKinematicState(btScalar step);
217
218 void applyGravity();
219
220 void setGravity(const btVector3& acceleration);
221
222 const btVector3& getGravity() const
223 {
224 return m_gravity_acceleration;
225 }
226
227 void setDamping(btScalar lin_damping, btScalar ang_damping);
228
229 btScalar getLinearDamping() const
230 {
231 return m_linearDamping;
232 }
233
234 btScalar getAngularDamping() const
235 {
236 return m_angularDamping;
237 }
238
239 btScalar getLinearSleepingThreshold() const
240 {
241 return m_linearSleepingThreshold;
242 }
243
244 btScalar getAngularSleepingThreshold() const
245 {
246 return m_angularSleepingThreshold;
247 }
248
249 void applyDamping(btScalar timeStep);
250
251 SIMD_FORCE_INLINE const btCollisionShape* getCollisionShape() const {
252 return m_collisionShape;
253 }
254
255 SIMD_FORCE_INLINE btCollisionShape* getCollisionShape() {
256 return m_collisionShape;
257 }
258
259 void setMassProps(btScalar mass, const btVector3& inertia);
260
261 const btVector3& getLinearFactor() const
262 {
263 return m_linearFactor;
264 }
265 void setLinearFactor(const btVector3& linearFactor)
266 {
267 m_linearFactor = linearFactor;
268 m_invMass = m_linearFactor*m_inverseMass;
269 }
270 btScalar getInvMass() const { return m_inverseMass; }
271 const btMatrix3x3& getInvInertiaTensorWorld() const {
272 return m_invInertiaTensorWorld;
273 }
274
275 void integrateVelocities(btScalar step);
276
277 void setCenterOfMassTransform(const btTransform& xform);
278
279 void applyCentralForce(const btVector3& force)
280 {
281 m_totalForce += force*m_linearFactor;
282 }
283
284 const btVector3& getTotalForce() const
285 {
286 return m_totalForce;
287 };
288
289 const btVector3& getTotalTorque() const
290 {
291 return m_totalTorque;
292 };
293
294 const btVector3& getInvInertiaDiagLocal() const
295 {
296 return m_invInertiaLocal;
297 };
298
299 void setInvInertiaDiagLocal(const btVector3& diagInvInertia)
300 {
301 m_invInertiaLocal = diagInvInertia;
302 }
303
304 void setSleepingThresholds(btScalar linear,btScalar angular)
305 {
306 m_linearSleepingThreshold = linear;
307 m_angularSleepingThreshold = angular;
308 }
309
310 void applyTorque(const btVector3& torque)
311 {
312 m_totalTorque += torque*m_angularFactor;
313 }
314
315 void applyForce(const btVector3& force, const btVector3& rel_pos)
316 {
317 applyCentralForce(force);
318 applyTorque(rel_pos.cross(force*m_linearFactor));
319 }
320
321 void applyCentralImpulse(const btVector3& impulse)
322 {
323 m_linearVelocity += impulse *m_linearFactor * m_inverseMass;
324 }
325
326 void applyTorqueImpulse(const btVector3& torque)
327 {
328 m_angularVelocity += m_invInertiaTensorWorld * torque * m_angularFactor;
329 }
330
331 void applyImpulse(const btVector3& impulse, const btVector3& rel_pos)
332 {
333 if (m_inverseMass != btScalar(0.))
334 {
335 applyCentralImpulse(impulse);
336 if (m_angularFactor)
337 {
338 applyTorqueImpulse(rel_pos.cross(impulse*m_linearFactor));
339 }
340 }
341 }
342
343 void clearForces()
344 {
345 m_totalForce.setValue(btScalar(0.0), btScalar(0.0), btScalar(0.0));
346 m_totalTorque.setValue(btScalar(0.0), btScalar(0.0), btScalar(0.0));
347 }
348
349 void updateInertiaTensor();
350
351 const btVector3& getCenterOfMassPosition() const {
352 return m_worldTransform.getOrigin();
353 }
354 btQuaternion getOrientation() const;
355
356 const btTransform& getCenterOfMassTransform() const {
357 return m_worldTransform;
358 }
359 const btVector3& getLinearVelocity() const {
360 return m_linearVelocity;
361 }
362 const btVector3& getAngularVelocity() const {
363 return m_angularVelocity;
364 }
365
366
367 inline void setLinearVelocity(const btVector3& lin_vel)
368 {
369 m_updateRevision++;
370 m_linearVelocity = lin_vel;
371 }
372
373 inline void setAngularVelocity(const btVector3& ang_vel)
374 {
375 m_updateRevision++;
376 m_angularVelocity = ang_vel;
377 }
378
379 btVector3 getVelocityInLocalPoint(const btVector3& rel_pos) const
380 {
381 //we also calculate lin/ang velocity for kinematic objects
382 return m_linearVelocity + m_angularVelocity.cross(rel_pos);
383
384 //for kinematic objects, we could also use use:
385 // return (m_worldTransform(rel_pos) - m_interpolationWorldTransform(rel_pos)) / m_kinematicTimeStep;
386 }
387
388 void translate(const btVector3& v)
389 {
390 m_worldTransform.getOrigin() += v;
391 }
392
393
394 void getAabb(btVector3& aabbMin,btVector3& aabbMax) const;
395
396
397
398
399
400 SIMD_FORCE_INLINE btScalar computeImpulseDenominator(const btVector3& pos, const btVector3& normal) const
401 {
402 btVector3 r0 = pos - getCenterOfMassPosition();
403
404 btVector3 c0 = (r0).cross(normal);
405
406 btVector3 vec = (c0 * getInvInertiaTensorWorld()).cross(r0);
407
408 return m_inverseMass + normal.dot(vec);
409
410 }
411
412 SIMD_FORCE_INLINE btScalar computeAngularImpulseDenominator(const btVector3& axis) const
413 {
414 btVector3 vec = axis * getInvInertiaTensorWorld();
415 return axis.dot(vec);
416 }
417
418 SIMD_FORCE_INLINE void updateDeactivation(btScalar timeStep)
419 {
420 if ( (getActivationState() == ISLAND_SLEEPING) || (getActivationState() == DISABLE_DEACTIVATION))
421 return;
422
423 if ((getLinearVelocity().length2() < m_linearSleepingThreshold*m_linearSleepingThreshold) &&
424 (getAngularVelocity().length2() < m_angularSleepingThreshold*m_angularSleepingThreshold))
425 {
426 m_deactivationTime += timeStep;
427 } else
428 {
429 m_deactivationTime=btScalar(0.);
430 setActivationState(0);
431 }
432
433 }
434
435 SIMD_FORCE_INLINE bool wantsSleeping()
436 {
437
438 if (getActivationState() == DISABLE_DEACTIVATION)
439 return false;
440
441 //disable deactivation
442 if (gDisableDeactivation || (gDeactivationTime == btScalar(0.)))
443 return false;
444
445 if ( (getActivationState() == ISLAND_SLEEPING) || (getActivationState() == WANTS_DEACTIVATION))
446 return true;
447
448 if (m_deactivationTime> gDeactivationTime)
449 {
450 return true;
451 }
452 return false;
453 }
454
455
456
457 const btBroadphaseProxy* getBroadphaseProxy() const
458 {
459 return m_broadphaseHandle;
460 }
461 btBroadphaseProxy* getBroadphaseProxy()
462 {
463 return m_broadphaseHandle;
464 }
465 void setNewBroadphaseProxy(btBroadphaseProxy* broadphaseProxy)
466 {
467 m_broadphaseHandle = broadphaseProxy;
468 }
469
470 //btMotionState allows to automatic synchronize the world transform for active objects
471 btMotionState* getMotionState()
472 {
473 return m_optionalMotionState;
474 }
475 const btMotionState* getMotionState() const
476 {
477 return m_optionalMotionState;
478 }
479 void setMotionState(btMotionState* motionState)
480 {
481 m_optionalMotionState = motionState;
482 if (m_optionalMotionState)
483 motionState->getWorldTransform(m_worldTransform);
484 }
485
486 //for experimental overriding of friction/contact solver func
487 int m_contactSolverType;
488 int m_frictionSolverType;
489
490 void setAngularFactor(const btVector3& angFac)
491 {
492 m_updateRevision++;
493 m_angularFactor = angFac;
494 }
495
496 void setAngularFactor(btScalar angFac)
497 {
498 m_updateRevision++;
499 m_angularFactor.setValue(angFac,angFac,angFac);
500 }
501 const btVector3& getAngularFactor() const
502 {
503 return m_angularFactor;
504 }
505
506 //is this rigidbody added to a btCollisionWorld/btDynamicsWorld/btBroadphase?
507 bool isInWorld() const
508 {
509 return (getBroadphaseProxy() != 0);
510 }
511
512 void addConstraintRef(btTypedConstraint* c);
513 void removeConstraintRef(btTypedConstraint* c);
514
515 btTypedConstraint* getConstraintRef(int index)
516 {
517 return m_constraintRefs[index];
518 }
519
520 int getNumConstraintRefs() const
521 {
522 return m_constraintRefs.size();
523 }
524
525 void setFlags(int flags)
526 {
527 m_rigidbodyFlags = flags;
528 }
529
530 int getFlags() const
531 {
532 return m_rigidbodyFlags;
533 }
534
535
536
537
539 btVector3 computeGyroscopicImpulseImplicit_World(btScalar dt) const;
540
542 btVector3 computeGyroscopicImpulseImplicit_Body(btScalar step) const;
543
545 btVector3 computeGyroscopicForceExplicit(btScalar maxGyroscopicForce) const;
546 btVector3 getLocalInertia() const;
547
549
550 virtual int calculateSerializeBufferSize() const;
551
553 virtual const char* serialize(void* dataBuffer, class btSerializer* serializer) const;
554
555 virtual void serializeSingleObject(class btSerializer* serializer) const;
556
557 };
558
559 //@todo add m_optionalMotionState and m_constraintRefs to btRigidBodyData
561 struct btRigidBodyFloatData
562 {
563 btCollisionObjectFloatData m_collisionObjectData;
564 btMatrix3x3FloatData m_invInertiaTensorWorld;
565 btVector3FloatData m_linearVelocity;
566 btVector3FloatData m_angularVelocity;
567 btVector3FloatData m_angularFactor;
568 btVector3FloatData m_linearFactor;
569 btVector3FloatData m_gravity;
570 btVector3FloatData m_gravity_acceleration;
571 btVector3FloatData m_invInertiaLocal;
572 btVector3FloatData m_totalForce;
573 btVector3FloatData m_totalTorque;
574 float m_inverseMass;
575 float m_linearDamping;
576 float m_angularDamping;
577 float m_additionalDampingFactor;
578 float m_additionalLinearDampingThresholdSqr;
579 float m_additionalAngularDampingThresholdSqr;
580 float m_additionalAngularDampingFactor;
581 float m_linearSleepingThreshold;
582 float m_angularSleepingThreshold;
583 int m_additionalDamping;
584 };
585
587 struct btRigidBodyDoubleData
588 {
589 btCollisionObjectDoubleData m_collisionObjectData;
590 btMatrix3x3DoubleData m_invInertiaTensorWorld;
591 btVector3DoubleData m_linearVelocity;
592 btVector3DoubleData m_angularVelocity;
593 btVector3DoubleData m_angularFactor;
594 btVector3DoubleData m_linearFactor;
595 btVector3DoubleData m_gravity;
596 btVector3DoubleData m_gravity_acceleration;
597 btVector3DoubleData m_invInertiaLocal;
598 btVector3DoubleData m_totalForce;
599 btVector3DoubleData m_totalTorque;
600 double m_inverseMass;
601 double m_linearDamping;
602 double m_angularDamping;
603 double m_additionalDampingFactor;
604 double m_additionalLinearDampingThresholdSqr;
605 double m_additionalAngularDampingThresholdSqr;
606 double m_additionalAngularDampingFactor;
607 double m_linearSleepingThreshold;
608 double m_angularSleepingThreshold;
609 int m_additionalDamping;
610 char m_padding[4];
611 };
612
613
614
615 #endif //BT_RIGIDBODY_H
616
btRigidBody::getInvMass
btScalar getInvMass() const
Definition: btRigidBody.h:270
btRigidBody::getCollisionShape
const btCollisionShape * getCollisionShape() const
Definition: btRigidBody.h:251
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:200
btRigidBody::btRigidBodyConstructionInfo::m_additionalDampingFactor
btScalar m_additionalDampingFactor
Definition: btRigidBody.h:147
btRigidBody::getAabb
void getAabb(btVector3 &aabbMin, btVector3 &aabbMax) const
Definition: btRigidBody.cpp:127
btRigidBodyFloatData::m_gravity
btVector3FloatData m_gravity
Definition: btRigidBody.h:569
btCollisionObjectFloatData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btCollisionObject.h:548
btMatrix3x3FloatData
for serialization
Definition: btMatrix3x3.h:1342
BT_DISABLE_WORLD_GRAVITY
Definition: btRigidBody.h:43
btRigidBody::isInWorld
bool isInWorld() const
Definition: btRigidBody.h:507
btRigidBody::translate
void translate(const btVector3 &v)
Definition: btRigidBody.h:388
btRigidBody::getMotionState
const btMotionState * getMotionState() const
Definition: btRigidBody.h:475
btRigidBody::applyGravity
void applyGravity()
Definition: btRigidBody.cpp:216
btRigidBody::m_totalTorque
btVector3 m_totalTorque
Definition: btRigidBody.h:75
btRigidBody::getTotalForce
const btVector3 & getTotalForce() const
Definition: btRigidBody.h:284
btRigidBody::btRigidBodyConstructionInfo::m_angularSleepingThreshold
btScalar m_angularSleepingThreshold
Definition: btRigidBody.h:142
btRigidBody::m_contactSolverType
int m_contactSolverType
Definition: btRigidBody.h:487
btRigidBody::computeAngularImpulseDenominator
btScalar computeAngularImpulseDenominator(const btVector3 &axis) const
Definition: btRigidBody.h:412
btVector3::setValue
void setValue(const btScalar &_x, const btScalar &_y, const btScalar &_z)
Definition: btVector3.h:640
btRigidBody::applyTorqueImpulse
void applyTorqueImpulse(const btVector3 &torque)
Definition: btRigidBody.h:326
btRigidBodyFloatData::m_angularFactor
btVector3FloatData m_angularFactor
Definition: btRigidBody.h:567
btAlignedObjectArray< btTypedConstraint * >
btRigidBody::predictIntegratedTransform
void predictIntegratedTransform(btScalar step, btTransform &predictedTransform)
continuous collision detection needs prediction
Definition: btRigidBody.cpp:104
btRigidBody::getAngularFactor
const btVector3 & getAngularFactor() const
Definition: btRigidBody.h:501
btRigidBody::updateInertiaTensor
void updateInertiaTensor()
Definition: btRigidBody.cpp:254
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:566
gDisableDeactivation
bool gDisableDeactivation
Definition: btRigidBody.cpp:26
btRigidBody::computeGyroscopicImpulseImplicit_World
btVector3 computeGyroscopicImpulseImplicit_World(btScalar dt) const
perform implicit force computation in world space
Definition: btRigidBody.cpp:348
btCollisionObject::getInternalType
int getInternalType() const
reserved for Bullet internal usage
Definition: btCollisionObject.h:322
btRigidBody::wantsSleeping
bool wantsSleeping()
Definition: btRigidBody.h:435
btRigidBodyDoubleData::m_totalForce
btVector3DoubleData m_totalForce
Definition: btRigidBody.h:598
btRigidBody::m_turnVelocity
btVector3 m_turnVelocity
Definition: btRigidBody.h:108
btRigidBody::getBroadphaseProxy
btBroadphaseProxy * getBroadphaseProxy()
Definition: btRigidBody.h:461
btTransform::setIdentity
void setIdentity()
Set this transformation to the identity.
Definition: btTransform.h:172
btAssert
#define btAssert(x)
Definition: btScalar.h:113
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:579
btRigidBody::getTotalTorque
const btVector3 & getTotalTorque() const
Definition: btRigidBody.h:289
btRigidBodyDoubleData::m_gravity
btVector3DoubleData m_gravity
Definition: btRigidBody.h:595
SIMD_FORCE_INLINE
#define SIMD_FORCE_INLINE
Definition: btScalar.h:63
btRigidBody::computeImpulseDenominator
btScalar computeImpulseDenominator(const btVector3 &pos, const btVector3 &normal) const
Definition: btRigidBody.h:400
btTransform.h
btRigidBodyDoubleData::m_linearDamping
double m_linearDamping
Definition: btRigidBody.h:601
btRigidBodyDoubleData::m_additionalDampingFactor
double m_additionalDampingFactor
Definition: btRigidBody.h:603
btRigidBody::btRigidBodyConstructionInfo::m_mass
btScalar m_mass
Definition: btRigidBody.h:121
btRigidBody::getLinearDamping
btScalar getLinearDamping() const
Definition: btRigidBody.h:229
btRigidBodyDoubleData::m_linearVelocity
btVector3DoubleData m_linearVelocity
Definition: btRigidBody.h:591
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:149
btRigidBody::m_angularSleepingThreshold
btScalar m_angularSleepingThreshold
Definition: btRigidBody.h:88
btRigidBody::setLinearFactor
void setLinearFactor(const btVector3 &linearFactor)
Definition: btRigidBody.h:265
btRigidBody::m_additionalDamping
bool m_additionalDamping
Definition: btRigidBody.h:80
btRigidBodyFloatData::m_linearSleepingThreshold
float m_linearSleepingThreshold
Definition: btRigidBody.h:581
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:304
btRigidBodyFloatData::m_additionalDampingFactor
float m_additionalDampingFactor
Definition: btRigidBody.h:577
btCollisionObject::m_worldTransform
btTransform m_worldTransform
Definition: btCollisionObject.h:54
btRigidBodyDoubleData::m_inverseMass
double m_inverseMass
Definition: btRigidBody.h:600
ISLAND_SLEEPING
#define ISLAND_SLEEPING
Definition: btCollisionObject.h:23
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:578
btRigidBodyFloatData::m_linearDamping
float m_linearDamping
Definition: btRigidBody.h:575
btVector3::dot
btScalar dot(const btVector3 &v) const
Return the dot product.
Definition: btVector3.h:235
btRigidBody::m_pushVelocity
btVector3 m_pushVelocity
Definition: btRigidBody.h:107
btRigidBodyFloatData::m_collisionObjectData
btCollisionObjectFloatData m_collisionObjectData
Definition: btRigidBody.h:563
btRigidBodyDoubleData::m_linearFactor
btVector3DoubleData m_linearFactor
Definition: btRigidBody.h:594
btSerializer
Definition: btSerializer.h:68
btRigidBodyFloatData::m_totalForce
btVector3FloatData m_totalForce
Definition: btRigidBody.h:572
btRigidBodyDoubleData::m_angularDamping
double m_angularDamping
Definition: btRigidBody.h:602
btRigidBody::btRigidBodyConstructionInfo::m_additionalLinearDampingThresholdSqr
btScalar m_additionalLinearDampingThresholdSqr
Definition: btRigidBody.h:148
btRigidBody::getVelocityInLocalPoint
btVector3 getVelocityInLocalPoint(const btVector3 &rel_pos) const
Definition: btRigidBody.h:379
btRigidBody::m_inverseMass
btScalar m_inverseMass
Definition: btRigidBody.h:68
btRigidBody::applyCentralForce
void applyCentralForce(const btVector3 &force)
Definition: btRigidBody.h:279
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:84
btRigidBody::integrateVelocities
void integrateVelocities(btScalar step)
Definition: btRigidBody.cpp:385
btRigidBody::updateDeactivation
void updateDeactivation(btScalar timeStep)
Definition: btRigidBody.h:418
btRigidBody::calculateSerializeBufferSize
virtual int calculateSerializeBufferSize() const
Definition: btRigidBody.cpp:474
btRigidBody::m_invInertiaLocal
btVector3 m_invInertiaLocal
Definition: btRigidBody.h:73
btRigidBody::getNumConstraintRefs
int getNumConstraintRefs() const
Definition: btRigidBody.h:520
btRigidBodyFloatData::m_additionalDamping
int m_additionalDamping
Definition: btRigidBody.h:583
btCollisionObjectDoubleData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btCollisionObject.h:515
btCollisionObject::setActivationState
void setActivationState(int newState) const
Definition: btCollisionObject.cpp:52
btRigidBody::computeGyroscopicForceExplicit
btVector3 computeGyroscopicForceExplicit(btScalar maxGyroscopicForce) const
explicit version is best avoided, it gains energy
Definition: btRigidBody.cpp:292
btRigidBodyDoubleData::m_additionalAngularDampingFactor
double m_additionalAngularDampingFactor
Definition: btRigidBody.h:606
btRigidBody::m_deltaLinearVelocity
btVector3 m_deltaLinearVelocity
Definition: btRigidBody.h:103
btRigidBody::applyTorque
void applyTorque(const btVector3 &torque)
Definition: btRigidBody.h:310
gDeactivationTime
btScalar gDeactivationTime
Definition: btRigidBody.cpp:25
btAlignedObjectArray::size
int size() const
return the number of elements in the array
Definition: btAlignedObjectArray.h:155
btTransform::getOrigin
btVector3 & getOrigin()
Return the origin vector translation.
Definition: btTransform.h:117
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:576
btRigidBody::getCenterOfMassTransform
const btTransform & getCenterOfMassTransform() const
Definition: btRigidBody.h:356
btRigidBody::getAngularDamping
btScalar getAngularDamping() const
Definition: btRigidBody.h:234
btRigidBodyDoubleData::m_invInertiaTensorWorld
btMatrix3x3DoubleData m_invInertiaTensorWorld
Definition: btRigidBody.h:590
btRigidBodyDoubleData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btRigidBody.h:587
btRigidBody::setFlags
void setFlags(int flags)
Definition: btRigidBody.h:525
btRigidBody::addConstraintRef
void addConstraintRef(btTypedConstraint *c)
Definition: btRigidBody.cpp:431
btRigidBody::getAngularSleepingThreshold
btScalar getAngularSleepingThreshold() const
Definition: btRigidBody.h:244
btCollisionObject::CO_RIGID_BODY
Definition: btCollisionObject.h:136
btRigidBody::getOrientation
btQuaternion getOrientation() const
Definition: btRigidBody.cpp:403
btRigidBody::getCollisionShape
btCollisionShape * getCollisionShape()
Definition: btRigidBody.h:255
btRigidBodyFloatData::m_additionalAngularDampingFactor
float m_additionalAngularDampingFactor
Definition: btRigidBody.h:580
btRigidBodyFlags
btRigidBodyFlags
Definition: btRigidBody.h:41
btRigidBody::getAngularVelocity
const btVector3 & getAngularVelocity() const
Definition: btRigidBody.h:362
btVector3::cross
btVector3 cross(const btVector3 &v) const
Return the cross product between this and another vector.
Definition: btVector3.h:377
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:139
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::serializeSingleObject
virtual void serializeSingleObject(class btSerializer *serializer) const
Definition: btRigidBody.cpp:513
btRigidBody::setLinearVelocity
void setLinearVelocity(const btVector3 &lin_vel)
Definition: btRigidBody.h:367
btBroadphaseProxy.h
btRigidBody::getCenterOfMassPosition
const btVector3 & getCenterOfMassPosition() const
Definition: btRigidBody.h:351
btRigidBody
The btRigidBody is the main class for rigid body objects.
Definition: btRigidBody.h:62
btRigidBody::m_angularFactor
btVector3 m_angularFactor
Definition: btRigidBody.h:105
btRigidBody::clearForces
void clearForces()
Definition: btRigidBody.h:343
btRigidBodyDoubleData::m_invInertiaLocal
btVector3DoubleData m_invInertiaLocal
Definition: btRigidBody.h:597
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:561
btRigidBody::m_angularVelocity
btVector3 m_angularVelocity
Definition: btRigidBody.h:67
btRigidBodyDoubleData::m_angularFactor
btVector3DoubleData m_angularFactor
Definition: btRigidBody.h:593
btRigidBody::proceedToTransform
void proceedToTransform(const btTransform &newTrans)
Definition: btRigidBody.cpp:225
btRigidBody::getLinearSleepingThreshold
btScalar getLinearSleepingThreshold() const
Definition: btRigidBody.h:239
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:115
btRigidBody::m_linearDamping
btScalar m_linearDamping
Definition: btRigidBody.h:77
btRigidBody::btRigidBodyConstructionInfo::m_additionalAngularDampingFactor
btScalar m_additionalAngularDampingFactor
Definition: btRigidBody.h:150
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:152
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:64
btRigidBody::getLocalInertia
btVector3 getLocalInertia() const
Definition: btRigidBody.cpp:261
btRigidBodyDoubleData::m_angularVelocity
btVector3DoubleData m_angularVelocity
Definition: btRigidBody.h:592
btRigidBody::setAngularFactor
void setAngularFactor(btScalar angFac)
Definition: btRigidBody.h:496
btRigidBody::applyForce
void applyForce(const btVector3 &force, const btVector3 &rel_pos)
Definition: btRigidBody.h:315
btRigidBodyFloatData::m_inverseMass
float m_inverseMass
Definition: btRigidBody.h:574
btRigidBody::m_debugBodyId
int m_debugBodyId
Definition: btRigidBody.h:98
btRigidBodyFloatData::m_totalTorque
btVector3FloatData m_totalTorque
Definition: btRigidBody.h:573
btRigidBodyFloatData::m_invInertiaTensorWorld
btMatrix3x3FloatData m_invInertiaTensorWorld
Definition: btRigidBody.h:564
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:411
btRigidBody::getConstraintRef
btTypedConstraint * getConstraintRef(int index)
Definition: btRigidBody.h:515
btRigidBody::setMassProps
void setMassProps(btScalar mass, const btVector3 &inertia)
Definition: btRigidBody.cpp:231
btRigidBodyDoubleData::m_additionalAngularDampingThresholdSqr
double m_additionalAngularDampingThresholdSqr
Definition: btRigidBody.h:605
btRigidBody::applyDamping
void applyDamping(btScalar timeStep)
applyDamping damps the velocity, using the given m_linearDamping and m_angularDamping ...
Definition: btRigidBody.cpp:159
btRigidBody::getGravity
const btVector3 & getGravity() const
Definition: btRigidBody.h:222
btRigidBodyDoubleData::m_collisionObjectData
btCollisionObjectDoubleData m_collisionObjectData
Definition: btRigidBody.h:589
WANTS_DEACTIVATION
#define WANTS_DEACTIVATION
Definition: btCollisionObject.h:24
btRigidBodyDoubleData::m_linearSleepingThreshold
double m_linearSleepingThreshold
Definition: btRigidBody.h:607
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:109
btRigidBody::setAngularVelocity
void setAngularVelocity(const btVector3 &ang_vel)
Definition: btRigidBody.h:373
btRigidBody::setInvInertiaDiagLocal
void setInvInertiaDiagLocal(const btVector3 &diagInvInertia)
Definition: btRigidBody.h:299
btRigidBodyDoubleData::m_gravity_acceleration
btVector3DoubleData m_gravity_acceleration
Definition: btRigidBody.h:596
BT_ENABLE_GYROSCOPIC_FORCE_IMPLICIT_WORLD
Definition: btRigidBody.h:48
btRigidBody::setMotionState
void setMotionState(btMotionState *motionState)
Definition: btRigidBody.h:479
btRigidBodyFloatData::m_linearVelocity
btVector3FloatData m_linearVelocity
Definition: btRigidBody.h:565
btCollisionObject.h
btRigidBody::btRigidBodyConstructionInfo::m_linearSleepingThreshold
btScalar m_linearSleepingThreshold
Definition: btRigidBody.h:141
btRigidBody::btRigidBodyConstructionInfo::m_additionalAngularDampingThresholdSqr
btScalar m_additionalAngularDampingThresholdSqr
Definition: btRigidBody.h:149
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:481
DISABLE_DEACTIVATION
#define DISABLE_DEACTIVATION
Definition: btCollisionObject.h:25
btRigidBody::getInvInertiaTensorWorld
const btMatrix3x3 & getInvInertiaTensorWorld() const
Definition: btRigidBody.h:271
btRigidBody::applyCentralImpulse
void applyCentralImpulse(const btVector3 &impulse)
Definition: btRigidBody.h:321
btRigidBody::getBroadphaseProxy
const btBroadphaseProxy * getBroadphaseProxy() const
Definition: btRigidBody.h:457
btRigidBodyDoubleData::m_additionalDamping
int m_additionalDamping
Definition: btRigidBody.h:609
btAlignedObjectArray.h
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::getInvInertiaDiagLocal
const btVector3 & getInvInertiaDiagLocal() const
Definition: btRigidBody.h:294
btRigidBody::getMotionState
btMotionState * getMotionState()
Definition: btRigidBody.h:471
btVector3FloatData
Definition: btVector3.h:1301
btRigidBody::getLinearVelocity
const btVector3 & getLinearVelocity() const
Definition: btRigidBody.h:359
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:331
btMatrix3x3DoubleData
for serialization
Definition: btMatrix3x3.h:1348
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:465
btRigidBodyFloatData::m_invInertiaLocal
btVector3FloatData m_invInertiaLocal
Definition: btRigidBody.h:571
btRigidBodyDoubleData::m_totalTorque
btVector3DoubleData m_totalTorque
Definition: btRigidBody.h:599
btRigidBodyFloatData::m_angularSleepingThreshold
float m_angularSleepingThreshold
Definition: btRigidBody.h:582
btRigidBody::btRigidBodyConstructionInfo::m_collisionShape
btCollisionShape * m_collisionShape
Definition: btRigidBody.h:128
btRigidBody::~btRigidBody
virtual ~btRigidBody()
Definition: btRigidBody.h:182
btRigidBody::computeGyroscopicImpulseImplicit_Body
btVector3 computeGyroscopicImpulseImplicit_Body(btScalar step) const
perform implicit force computation in body space (inertial frame)
Definition: btRigidBody.cpp:307
btRigidBody::m_constraintRefs
btAlignedObjectArray< btTypedConstraint * > m_constraintRefs
Definition: btRigidBody.h:94
btRigidBodyDoubleData::m_angularSleepingThreshold
double m_angularSleepingThreshold
Definition: btRigidBody.h:608
btRigidBody::m_frictionSolverType
int m_frictionSolverType
Definition: btRigidBody.h:488
btRigidBody::removeConstraintRef
void removeConstraintRef(btTypedConstraint *c)
Definition: btRigidBody.cpp:454
btRigidBody::getLinearFactor
const btVector3 & getLinearFactor() const
Definition: btRigidBody.h:261
btRigidBody::m_deltaAngularVelocity
btVector3 m_deltaAngularVelocity
Definition: btRigidBody.h:104
btRigidBodyDoubleData::m_additionalLinearDampingThresholdSqr
double m_additionalLinearDampingThresholdSqr
Definition: btRigidBody.h:604
btRigidBody::setAngularFactor
void setAngularFactor(const btVector3 &angFac)
Definition: btRigidBody.h:490
btRigidBody::upcast
static btRigidBody * upcast(btCollisionObject *colObj)
Definition: btRigidBody.h:206
btCollisionObject::getActivationState
int getActivationState() const
Definition: btCollisionObject.h:269
BT_ENABLE_GYROPSCOPIC_FORCE
Definition: btRigidBody.h:50
btRigidBody::btRigidBodyConstructionInfo::m_additionalDamping
bool m_additionalDamping
Definition: btRigidBody.h:146
btRigidBodyFloatData::m_gravity_acceleration
btVector3FloatData m_gravity_acceleration
Definition: btRigidBody.h:570
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
btRigidBody::btRigidBodyConstructionInfo::m_friction
btScalar m_friction
best simulation results when friction is non-zero
Definition: btRigidBody.h:134
btRigidBody::m_invMass
btVector3 m_invMass
Definition: btRigidBody.h:106
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:278
btVector3DoubleData
Definition: btVector3.h:1306
btRigidBody::getFlags
int getFlags() const
Definition: btRigidBody.h:530
btRigidBodyFloatData::m_linearFactor
btVector3FloatData m_linearFactor
Definition: btRigidBody.h:568
btRigidBody::m_invInertiaTensorWorld
btMatrix3x3 m_invInertiaTensorWorld
Definition: btRigidBody.h:65
btRigidBody::setGravity
void setGravity(const btVector3 &acceleration)
Definition: btRigidBody.cpp:135