diff options
| author | Rémi Verschelde | 2017-11-05 09:25:33 +0100 |
|---|---|---|
| committer | GitHub | 2017-11-05 09:25:33 +0100 |
| commit | a89fa34c21103430b1d140ee04c3ae6a433d77ce (patch) | |
| tree | 9ecfb36702c2044937c2063f4ef09da62bd7ca1f /thirdparty/bullet/src/LinearMath/btDefaultMotionState.h | |
| parent | f7a41c1e309226bd0deb6381e71a5ce005cbe4ef (diff) | |
| parent | fb4871c919571d719d27738cc4d7db496a575b57 (diff) | |
| download | godot-a89fa34c21103430b1d140ee04c3ae6a433d77ce.tar.gz godot-a89fa34c21103430b1d140ee04c3ae6a433d77ce.tar.zst godot-a89fa34c21103430b1d140ee04c3ae6a433d77ce.zip | |
Diffstat (limited to 'thirdparty/bullet/src/LinearMath/btDefaultMotionState.h')
| -rw-r--r-- | thirdparty/bullet/src/LinearMath/btDefaultMotionState.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/thirdparty/bullet/src/LinearMath/btDefaultMotionState.h b/thirdparty/bullet/src/LinearMath/btDefaultMotionState.h new file mode 100644 index 000000000..01c5f8d93 --- /dev/null +++ b/thirdparty/bullet/src/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 |
