aboutsummaryrefslogtreecommitdiff
path: root/thirdparty/bullet/LinearMath/btDefaultMotionState.h
diff options
context:
space:
mode:
authorRémi Verschelde2018-01-13 14:01:53 +0100
committerRémi Verschelde2018-01-13 14:08:45 +0100
commite12c89e8c9896b2e5cdd70dbd2d2acb449ff4b94 (patch)
treeaf68e434545e20c538f896e28b73f2db7d626edd /thirdparty/bullet/LinearMath/btDefaultMotionState.h
parent53c65ae7619ac9e80c89a321c70de64f3745e2aa (diff)
downloadgodot-e12c89e8c9896b2e5cdd70dbd2d2acb449ff4b94.tar.gz
godot-e12c89e8c9896b2e5cdd70dbd2d2acb449ff4b94.tar.zst
godot-e12c89e8c9896b2e5cdd70dbd2d2acb449ff4b94.zip
Diffstat (limited to 'thirdparty/bullet/LinearMath/btDefaultMotionState.h')
-rw-r--r--thirdparty/bullet/LinearMath/btDefaultMotionState.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/thirdparty/bullet/LinearMath/btDefaultMotionState.h b/thirdparty/bullet/LinearMath/btDefaultMotionState.h
new file mode 100644
index 000000000..01c5f8d93
--- /dev/null
+++ b/thirdparty/bullet/LinearMath/btDefaultMotionState.h
@@ -0,0 +1,42 @@
+#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.
+ATTRIBUTE_ALIGNED16(struct) btDefaultMotionState : public btMotionState
+{
+ btTransform m_graphicsWorldTrans;
+ btTransform m_centerOfMassOffset;
+ btTransform m_startWorldTrans;
+ void* m_userPointer;
+
+ BT_DECLARE_ALIGNED_ALLOCATOR();
+
+ 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_graphicsWorldTrans * m_centerOfMassOffset.inverse() ;
+ }
+
+ ///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