diff --git a/libraries/entities/src/EntityEditPacketSender.cpp b/libraries/entities/src/EntityEditPacketSender.cpp index 6f58a5a626..5f77d1e782 100644 --- a/libraries/entities/src/EntityEditPacketSender.cpp +++ b/libraries/entities/src/EntityEditPacketSender.cpp @@ -41,7 +41,7 @@ void EntityEditPacketSender::queueEditEntityMessage(PacketType type, EntityItemI auto nodeList = DependencyManager::get(); QUuid myNodeID = nodeList->getSessionUUID(); QString x = properties.getSimulatorID() == myNodeID ? "me" : properties.getSimulatorID().toString(); - qDebug() << "sending update:" << properties.simulatorIDChanged() << properties.getSimulatorID(); + qDebug() << "sending update:" << properties.simulatorIDChanged() << x; //// XXX diff --git a/libraries/physics/src/EntityMotionState.cpp b/libraries/physics/src/EntityMotionState.cpp index 02d2ed896b..9af97d20ad 100644 --- a/libraries/physics/src/EntityMotionState.cpp +++ b/libraries/physics/src/EntityMotionState.cpp @@ -251,14 +251,20 @@ void EntityMotionState::sendUpdate(OctreeEditPacketSender* packetSender, uint32_ auto nodeList = DependencyManager::get(); QUuid myNodeID = nodeList->getSessionUUID(); QUuid simulatorID = _entity->getSimulatorID(); + + // qDebug() << "XXX me =" << (simulatorID == myNodeID) + // << "_numNonMovingUpdates =" << _numNonMovingUpdates + // << "stopped =" << (zeroSpin && zeroSpeed) + // << "active =" << _body->isActive(); + if (simulatorID.isNull() && !(zeroSpeed && zeroSpin)) { // The object is moving and nobody thinks they own the motion. set this Node as the simulator _entity->setSimulatorID(myNodeID); properties.setSimulatorID(myNodeID); - } else if (simulatorID == myNodeID && _numNonMovingUpdates >= MAX_NUM_NON_MOVING_UPDATES - 2) { + } else if (simulatorID == myNodeID && zeroSpeed && zeroSpin) { // we are the simulator and the object has stopped. give up "simulator" status - _entity->setSimulatorID(""); - properties.setSimulatorID(""); + _entity->setSimulatorID(QUuid()); + properties.setSimulatorID(QUuid()); } // RELIABLE_SEND_HACK: count number of updates for entities at rest so we can stop sending them after some limit.