stubbery for BoxEntityImtem::createMotionState()

This commit is contained in:
Andrew Meadows 2014-11-11 10:56:52 -08:00
parent 82d7b70ec9
commit 1ffb22e2de
3 changed files with 23 additions and 6 deletions

View file

@ -14,9 +14,10 @@
#include <ByteCountCoding.h>
#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());
}
}
#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

View file

@ -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;
};

View file

@ -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);