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