Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/tutorial4/src/external/bullet/LinearMath/btDefaultMotionState.h @ 10422

Last change on this file since 10422 was 8393, checked in by rgrieder, 14 years ago

Updated Bullet from v2.77 to v2.78.
(I'm not going to make a branch for that since the update from 2.74 to 2.77 hasn't been tested that much either).

You will HAVE to do a complete RECOMPILE! I tested with MSVC and MinGW and they both threw linker errors at me.

  • Property svn:eol-style set to native
File size: 1.2 KB
Line 
1#ifndef BT_DEFAULT_MOTION_STATE_H
2#define BT_DEFAULT_MOTION_STATE_H
3
4#include "btMotionState.h"
5
6///The btDefaultMotionState provides a common implementation to synchronize world transforms with offsets.
7struct  btDefaultMotionState : public btMotionState
8{
9        btTransform m_graphicsWorldTrans;
10        btTransform     m_centerOfMassOffset;
11        btTransform m_startWorldTrans;
12        void*           m_userPointer;
13
14        btDefaultMotionState(const btTransform& startTrans = btTransform::getIdentity(),const btTransform& centerOfMassOffset = btTransform::getIdentity())
15                : m_graphicsWorldTrans(startTrans),
16                m_centerOfMassOffset(centerOfMassOffset),
17                m_startWorldTrans(startTrans),
18                m_userPointer(0)
19
20        {
21        }
22
23        ///synchronizes world transform from user to physics
24        virtual void    getWorldTransform(btTransform& centerOfMassWorldTrans ) const 
25        {
26                        centerOfMassWorldTrans =        m_centerOfMassOffset.inverse() * m_graphicsWorldTrans ;
27        }
28
29        ///synchronizes world transform from physics to user
30        ///Bullet only calls the update of worldtransform for active objects
31        virtual void    setWorldTransform(const btTransform& centerOfMassWorldTrans)
32        {
33                        m_graphicsWorldTrans = centerOfMassWorldTrans * m_centerOfMassOffset ;
34        }
35
36       
37
38};
39
40#endif //BT_DEFAULT_MOTION_STATE_H
Note: See TracBrowser for help on using the repository browser.