Bullet Collision Detection & Physics Library
btDefaultMotionState.h
Go to the documentation of this file.
1 #ifndef BT_DEFAULT_MOTION_STATE_H
2 #define BT_DEFAULT_MOTION_STATE_H
3 
4 #include "btMotionState.h"
5 
8 {
13 
15 
17  : m_graphicsWorldTrans(startTrans),
18  m_centerOfMassOffset(centerOfMassOffset),
19  m_startWorldTrans(startTrans),
20  m_userPointer(0)
21 
22  {
23  }
24 
26  virtual void getWorldTransform(btTransform& centerOfMassWorldTrans ) const
27  {
28  centerOfMassWorldTrans = m_graphicsWorldTrans * m_centerOfMassOffset.inverse() ;
29  }
30 
33  virtual void setWorldTransform(const btTransform& centerOfMassWorldTrans)
34  {
35  m_graphicsWorldTrans = centerOfMassWorldTrans * m_centerOfMassOffset;
36  }
37 
38 
39 
40 };
41 
42 #endif //BT_DEFAULT_MOTION_STATE_H
virtual void getWorldTransform(btTransform &centerOfMassWorldTrans) const
synchronizes world transform from user to physics
virtual void setWorldTransform(const btTransform &centerOfMassWorldTrans)
synchronizes world transform from physics to user Bullet only calls the update of worldtransform for ...
btTransform m_graphicsWorldTrans
The btDefaultMotionState provides a common implementation to synchronize world transforms with offset...
btTransform inverse() const
Return the inverse of this transform.
Definition: btTransform.h:188
btDefaultMotionState(const btTransform &startTrans=btTransform::getIdentity(), const btTransform &centerOfMassOffset=btTransform::getIdentity())
#define ATTRIBUTE_ALIGNED16(a)
Definition: btScalar.h:82
The btTransform class supports rigid transforms with only translation and rotation and no scaling/she...
Definition: btTransform.h:34
static const btTransform & getIdentity()
Return an identity transform.
Definition: btTransform.h:203
The btMotionState interface class allows the dynamics world to synchronize and interpolate the update...
Definition: btMotionState.h:23
#define BT_DECLARE_ALIGNED_ALLOCATOR()
Definition: btScalar.h:403