Last change
on this file since 7221 was
5781,
checked in by rgrieder, 15 years ago
|
Reverted trunk again. We might want to find a way to delete these revisions again (x3n's changes are still available as diff in the commit mails).
|
-
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 | ///The btDefaultMotionState provides a common implementation to synchronize world transforms with offsets. |
---|
5 | struct btDefaultMotionState : public btMotionState |
---|
6 | { |
---|
7 | btTransform m_graphicsWorldTrans; |
---|
8 | btTransform m_centerOfMassOffset; |
---|
9 | btTransform m_startWorldTrans; |
---|
10 | void* m_userPointer; |
---|
11 | |
---|
12 | btDefaultMotionState(const btTransform& startTrans = btTransform::getIdentity(),const btTransform& centerOfMassOffset = btTransform::getIdentity()) |
---|
13 | : m_graphicsWorldTrans(startTrans), |
---|
14 | m_centerOfMassOffset(centerOfMassOffset), |
---|
15 | m_startWorldTrans(startTrans), |
---|
16 | m_userPointer(0) |
---|
17 | |
---|
18 | { |
---|
19 | } |
---|
20 | |
---|
21 | ///synchronizes world transform from user to physics |
---|
22 | virtual void getWorldTransform(btTransform& centerOfMassWorldTrans ) const |
---|
23 | { |
---|
24 | centerOfMassWorldTrans = m_centerOfMassOffset.inverse() * m_graphicsWorldTrans ; |
---|
25 | } |
---|
26 | |
---|
27 | ///synchronizes world transform from physics to user |
---|
28 | ///Bullet only calls the update of worldtransform for active objects |
---|
29 | virtual void setWorldTransform(const btTransform& centerOfMassWorldTrans) |
---|
30 | { |
---|
31 | m_graphicsWorldTrans = centerOfMassWorldTrans * m_centerOfMassOffset ; |
---|
32 | } |
---|
33 | |
---|
34 | |
---|
35 | |
---|
36 | }; |
---|
37 | |
---|
38 | #endif //DEFAULT_MOTION_STATE_H |
---|
Note: See
TracBrowser
for help on using the repository browser.