Bullet Collision Detection & Physics Library: btDefaultMotionState.h Source File

Bullet Collision Detection & Physics Library

btDefaultMotionState.h
Go to the documentation of this file.
1#ifndef BT_DEFAULT_MOTION_STATE_H
2#define BT_DEFAULT_MOTION_STATE_H
3
4#include "btMotionState.h"
5
7 ATTRIBUTE_ALIGNED16(struct)
8 btDefaultMotionState : public btMotionState
9{
10 btTransform m_graphicsWorldTrans;
11 btTransform m_centerOfMassOffset;
12 btTransform m_startWorldTrans;
13 void* m_userPointer;
14
15 BT_DECLARE_ALIGNED_ALLOCATOR();
16
17 btDefaultMotionState(const btTransform& startTrans = btTransform::getIdentity(), const btTransform& centerOfMassOffset = btTransform::getIdentity())
18 : m_graphicsWorldTrans(startTrans),
19 m_centerOfMassOffset(centerOfMassOffset),
20 m_startWorldTrans(startTrans),
21 m_userPointer(0)
22
23 {
24 }
25
27 virtual void getWorldTransform(btTransform & centerOfMassWorldTrans) const
28 {
29 centerOfMassWorldTrans = m_graphicsWorldTrans * m_centerOfMassOffset.inverse();
30 }
31
34 virtual void setWorldTransform(const btTransform& centerOfMassWorldTrans)
35 {
36 m_graphicsWorldTrans = centerOfMassWorldTrans * m_centerOfMassOffset;
37 }
38};
39
40#endif //BT_DEFAULT_MOTION_STATE_H
btMotionState.h
ATTRIBUTE_ALIGNED16
#define ATTRIBUTE_ALIGNED16(a)
Definition btScalar.h:99
btMotionState
The btMotionState interface class allows the dynamics world to synchronize and interpolate the update...
Definition btMotionState.h:24
btTransform
The btTransform class supports rigid transforms with only translation and rotation and no scaling/she...
Definition btTransform.h:30
btTransform::getIdentity
static const btTransform & getIdentity()
Return an identity transform.
Definition btTransform.h:198
btDefaultMotionState::m_centerOfMassOffset
btTransform m_centerOfMassOffset
Definition btDefaultMotionState.h:11
btDefaultMotionState::setWorldTransform
virtual void setWorldTransform(const btTransform &centerOfMassWorldTrans)
synchronizes world transform from physics to user Bullet only calls the update of worldtransform for ...
Definition btDefaultMotionState.h:34
btDefaultMotionState::m_startWorldTrans
btTransform m_startWorldTrans
Definition btDefaultMotionState.h:12
btDefaultMotionState::getWorldTransform
virtual void getWorldTransform(btTransform &centerOfMassWorldTrans) const
synchronizes world transform from user to physics
Definition btDefaultMotionState.h:27
btDefaultMotionState::m_graphicsWorldTrans
btTransform m_graphicsWorldTrans
Definition btDefaultMotionState.h:10
btDefaultMotionState::btDefaultMotionState
btDefaultMotionState(const btTransform &startTrans=btTransform::getIdentity(), const btTransform &centerOfMassOffset=btTransform::getIdentity())
Definition btDefaultMotionState.h:17
btDefaultMotionState::BT_DECLARE_ALIGNED_ALLOCATOR
BT_DECLARE_ALIGNED_ALLOCATOR()
btDefaultMotionState::m_userPointer
void * m_userPointer
Definition btDefaultMotionState.h:13