Logo Search packages:      
Sourcecode: blender version File versions

btDefaultMotionState.h

#ifndef DEFAULT_MOTION_STATE_H
#define DEFAULT_MOTION_STATE_H

///btDefaultMotionState provides a common implementation to synchronize world transforms with offsets
00005 struct      btDefaultMotionState : public btMotionState
{
      btTransform m_graphicsWorldTrans;
      btTransform m_centerOfMassOffset;
      btTransform m_startWorldTrans;
      void*       m_userPointer;

      btDefaultMotionState(const btTransform& startTrans = btTransform::getIdentity(),const btTransform& centerOfMassOffset = btTransform::getIdentity())
            : m_graphicsWorldTrans(startTrans),
            m_centerOfMassOffset(centerOfMassOffset),
            m_startWorldTrans(startTrans),
            m_userPointer(0)

      {
      }

      ///synchronizes world transform from user to physics
00022       virtual void      getWorldTransform(btTransform& centerOfMassWorldTrans ) const 
      {
                  centerOfMassWorldTrans =      m_centerOfMassOffset.inverse() * m_graphicsWorldTrans ;
      }

      ///synchronizes world transform from physics to user
      ///Bullet only calls the update of worldtransform for active objects
00029       virtual void      setWorldTransform(const btTransform& centerOfMassWorldTrans)
      {
                  m_graphicsWorldTrans = centerOfMassWorldTrans * m_centerOfMassOffset ;
      }

      ///Bullet gives a callback for objects that are about to be deactivated (put asleep)
      /// You can intercept this callback for your own bookkeeping. 
      ///Also you can return false to disable deactivation for this object this frame.
00037       virtual bool deactivationCallback(void*   userPointer) {
            return true;
      }

};

#endif //DEFAULT_MOTION_STATE_H

Generated by  Doxygen 1.6.0   Back to index