diff --git a/libraries/entities/src/BoxEntityItem.cpp b/libraries/entities/src/BoxEntityItem.cpp index 83d6d7eff9..1aaa440481 100644 --- a/libraries/entities/src/BoxEntityItem.cpp +++ b/libraries/entities/src/BoxEntityItem.cpp @@ -14,9 +14,10 @@ #include +#include "BoxEntityItem.h" +#include "EntityMotionState.h" #include "EntityTree.h" #include "EntityTreeElement.h" -#include "BoxEntityItem.h" EntityItem* BoxEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) { @@ -94,4 +95,16 @@ void BoxEntityItem::appendSubclassData(OctreePacketData* packetData, EncodeBitst bool successPropertyFits = true; APPEND_ENTITY_PROPERTY(PROP_COLOR, appendColor, getColor()); -} \ No newline at end of file +} + +#ifdef USE_BULLET_PHYSICS +// BOOKMARK: move EntityMotionState implementation to Entities +// also define interface for it (dunno what to call it) +EntityMotionState* BoxEntityItem::createMotionState() { + if (!_motionState) { + _motionState = new EntityMotionState(this); + } + return _motionState; +} +#endif // USE_BULLET_PHYSICS + diff --git a/libraries/entities/src/BoxEntityItem.h b/libraries/entities/src/BoxEntityItem.h index b5f4521f96..faae308b43 100644 --- a/libraries/entities/src/BoxEntityItem.h +++ b/libraries/entities/src/BoxEntityItem.h @@ -46,11 +46,15 @@ public: void setColor(const rgbColor& value) { memcpy(_color, value, sizeof(_color)); } void setColor(const xColor& value) { - _color[RED_INDEX] = value.red; - _color[GREEN_INDEX] = value.green; - _color[BLUE_INDEX] = value.blue; + _color[RED_INDEX] = value.red; + _color[GREEN_INDEX] = value.green; + _color[BLUE_INDEX] = value.blue; } +#ifdef USE_BULLET_PHYSICS + EntityMotionState* createMotionState(); +#endif // USE_BULLET_PHYSICS + protected: rgbColor _color; }; diff --git a/libraries/entities/src/EntityMotionState.cpp b/libraries/entities/src/EntityMotionState.cpp index f2bfd5f333..f9ff7291d9 100644 --- a/libraries/entities/src/EntityMotionState.cpp +++ b/libraries/entities/src/EntityMotionState.cpp @@ -39,7 +39,7 @@ EntityMotionState::~EntityMotionState() { // (1) when the RigidBody is first added to the world // (irregardless of MotionType: STATIC, DYNAMIC, or KINEMATIC) // (2) at the beginning of each simulation frame for KINEMATIC RigidBody's -- -// it is an opportunity for outside code to update the position of the object +// it is an opportunity for outside code to update the object's simulation position void EntityMotionState::getWorldTransform (btTransform &worldTrans) const { btVector3 pos; glmToBullet(_entity->getPosition() - _cachedWorldOffset, pos);