| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- #ifndef PHYSICSMOTIONSTATE_H_
- #define PHYSICSMOTIONSTATE_H_
- #include "Vector3.h"
- namespace gameplay
- {
- class Node;
- /**
- * Interface between GamePlay and Bullet to keep object transforms synchronized properly.
- *
- * @see btMotionState
- */
- class PhysicsMotionState : public btMotionState
- {
- friend class PhysicsCollisionObject;
- friend class PhysicsRigidBody;
- friend class PhysicsGhostObject;
- friend class PhysicsCharacter;
- friend class PhysicsConstraint;
- protected:
- /**
- * Creates a physics motion state for a rigid body.
- *
- * @param node The node that owns the rigid body that the motion state is being created for.
- * @param centerOfMassOffset The translation offset to the center of mass of the rigid body.
- */
- PhysicsMotionState(Node* node, const Vector3* centerOfMassOffset = NULL);
- /**
- * Destructor.
- */
- virtual ~PhysicsMotionState();
- /**
- * @see btMotionState#getWorldTransform
- */
- virtual void getWorldTransform(btTransform &transform) const;
- /**
- * @see btMotionState#setWorldTransform
- */
- virtual void setWorldTransform(const btTransform &transform);
- private:
- // Updates the motion state's world transform from the GamePlay Node object's world transform.
- void updateTransformFromNode() const;
- Node* _node;
- btTransform _centerOfMassOffset;
- mutable btTransform _worldTransform;
- };
- }
- #endif
|