12 #ifndef hifi_DetailedMotionState_h
13 #define hifi_DetailedMotionState_h
17 #include <ObjectMotionState.h>
18 #include <BulletUtil.h>
20 #include "OtherAvatar.h"
22 class DetailedMotionState :
public ObjectMotionState {
24 DetailedMotionState(AvatarPointer avatar,
const btCollisionShape* shape,
int jointIndex);
26 void handleEasyChanges(uint32_t& flags)
override;
28 PhysicsMotionType getMotionType()
const override {
return _motionType; }
30 uint32_t getIncomingDirtyFlags()
const override;
31 void clearIncomingDirtyFlags(uint32_t mask = DIRTY_PHYSICS_FLAGS)
override;
33 PhysicsMotionType computePhysicsMotionType()
const override;
35 bool isMoving()
const override;
38 void getWorldTransform(btTransform& worldTrans)
const override;
41 void setWorldTransform(
const btTransform& worldTrans)
override;
48 float getObjectRestitution()
const override;
49 float getObjectFriction()
const override;
50 float getObjectLinearDamping()
const override;
51 float getObjectAngularDamping()
const override;
53 glm::vec3 getObjectPosition()
const override;
54 glm::quat getObjectRotation()
const override;
55 glm::vec3 getObjectLinearVelocity()
const override;
56 glm::vec3 getObjectAngularVelocity()
const override;
57 glm::vec3 getObjectGravity()
const override;
59 const QUuid getObjectID()
const override;
61 QString getName()
const override;
62 ShapeType getShapeType()
const override {
return SHAPE_TYPE_HULL; }
63 QUuid getSimulatorID()
const override;
65 void addDirtyFlags(uint32_t flags) { _dirtyFlags |= flags; }
67 void computeCollisionGroupAndMask(int32_t& group, int32_t& mask)
const override;
69 float getMass()
const override;
71 QUuid getAvatarID()
const {
return _avatar->getID(); }
72 int32_t getJointIndex()
const {
return _jointIndex; }
73 void setIsBound(
bool isBound,
const std::vector<int32_t>& boundJoints) { _isBound = isBound; _boundJoints = boundJoints; }
74 bool getIsBound(std::vector<int32_t>& boundJoints)
const { boundJoints = _boundJoints;
return _isBound; }
76 friend class AvatarManager;
80 void setRigidBody(btRigidBody* body)
override;
81 void setShape(
const btCollisionShape* shape)
override;
85 ~DetailedMotionState();
87 AvatarPointer _avatar;
88 float _diameter { 0.0f };
91 int32_t _jointIndex { -1 };
92 OtherAvatarPointer _otherAvatar {
nullptr };
93 bool _isBound {
false };
94 std::vector<int32_t> _boundJoints;