Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/SuperOrxoBros_HS18/src/external/bullet/LinearMath/btDefaultMotionState.h @ 12177

Last change on this file since 12177 was 12177, checked in by siramesh, 5 years ago

Super Orxo Bros Final (Sidharth Ramesh, Nisa Balta, Jeff Ren)

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.