aboutsummaryrefslogtreecommitdiff
path: root/tests/bullet/src/LinearMath/btDefaultMotionState.h
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-04-21 17:55:35 -0700
committerAlon Zakai <alonzakai@gmail.com>2011-04-21 17:55:35 -0700
commit887ce3dde89410d012a708c3ec454f679b2e5b1e (patch)
treedaeadbc86bf721a5d4fff109a1d87a4c69215905 /tests/bullet/src/LinearMath/btDefaultMotionState.h
parentb3f4022e35b34002f44aacde554cc8b3ea927500 (diff)
update bullet test to compile from source
Diffstat (limited to 'tests/bullet/src/LinearMath/btDefaultMotionState.h')
-rw-r--r--tests/bullet/src/LinearMath/btDefaultMotionState.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/bullet/src/LinearMath/btDefaultMotionState.h b/tests/bullet/src/LinearMath/btDefaultMotionState.h
new file mode 100644
index 00000000..a6b7ef15
--- /dev/null
+++ b/tests/bullet/src/LinearMath/btDefaultMotionState.h
@@ -0,0 +1,40 @@
+#ifndef BT_DEFAULT_MOTION_STATE_H
+#define BT_DEFAULT_MOTION_STATE_H
+
+#include "btMotionState.h"
+
+///The btDefaultMotionState provides a common implementation to synchronize world transforms with offsets.
+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
+ 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
+ virtual void setWorldTransform(const btTransform& centerOfMassWorldTrans)
+ {
+ m_graphicsWorldTrans = centerOfMassWorldTrans * m_centerOfMassOffset ;
+ }
+
+
+
+};
+
+#endif //BT_DEFAULT_MOTION_STATE_H