cause changes to _simulatorID to be broadcast

This commit is contained in:
Seth Alves 2015-04-13 12:39:40 -07:00
parent eace91e833
commit f42a43e180
3 changed files with 9 additions and 2 deletions

View file

@ -1194,3 +1194,9 @@ void EntityItem::updateLifetime(float value) {
}
}
void EntityItem::updateSimulatorID(QString value) {
if (_simulatorID != value) {
_simulatorID = value;
_dirtyFlags |= EntityItem::DIRTY_UPDATEABLE;
}
}

View file

@ -294,6 +294,7 @@ public:
void updateCollisionsWillMove(bool value);
void updateLifetime(float value);
virtual void updateShapeType(ShapeType type) { /* do nothing */ }
void updateSimulatorID(QString value);
uint32_t getDirtyFlags() const { return _dirtyFlags; }
void clearDirtyFlags(uint32_t mask = 0xffff) { _dirtyFlags &= ~mask; }

View file

@ -193,11 +193,11 @@ bool EntityMotionState::shouldSendUpdate(uint32_t simulationFrame) {
if (simulatorID.isEmpty() && _body->isActive()) {
// The object is moving and nobody thinks they own the motion. set this Node as the simulator
_entity->setSimulatorID(myNodeID);
_entity->updateSimulatorID(myNodeID);
simulatorID = myNodeID;
} else if (simulatorID == myNodeID && !_body->isActive()) {
// we are the simulator and the object has stopped. give up "simulator" status
_entity->setSimulatorID("");
_entity->updateSimulatorID("");
simulatorID = "";
}