Last change
on this file since 8529 was
8284,
checked in by rgrieder, 14 years ago
|
Merged revisions 7978 - 8096 from kicklib to kicklib2.
|
-
Property svn:eol-style set to
native
|
File size:
1.2 KB
|
Line | |
---|
1 | #ifndef DEFAULT_MOTION_STATE_H |
---|
2 | #define DEFAULT_MOTION_STATE_H |
---|
3 | |
---|
4 | #include "btMotionState.h" |
---|
5 | |
---|
6 | ///The btDefaultMotionState provides a common implementation to synchronize world transforms with offsets. |
---|
7 | struct 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 //DEFAULT_MOTION_STATE_H |
---|
Note: See
TracBrowser
for help on using the repository browser.