Showing the changes to libraries/physics/src/EntityMotionState.cpp (1 of 2 files). Show all
Unified · Split
| @@ -195,16 +195,17 @@ float EntityMotionState::computeMass(const ShapeInfo& shapeInfo) const { · 194 unmodified lines | ||
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | bool EntityMotionState::shouldSendUpdate(uint32_t simulationFrame) { |
| 198 | − if (getShouldClaimSimulationOwnership()) { | |
| 199 | − return true; | |
| 200 | − } | |
| 201 | − | |
| 202 | 198 | bool baseResult = this->ObjectMotionState::shouldSendUpdate(simulationFrame); |
| 203 | 199 | |
| 204 | 200 | if (!baseResult) { |
| 205 | 201 | return false; |
| 206 | 202 | } |
| 207 | 203 | |
| 204 | + if (getShouldClaimSimulationOwnership()) { | |
| 205 | + qDebug() << "shouldSendUpdate due to claiming ownership"; | |
| 206 | + return true; | |
| 207 | + } | |
| 208 | + | |
| 208 | 209 | auto nodeList = DependencyManager::get<NodeList>(); |
| 209 | 210 | const QUuid& myNodeID = nodeList->getSessionUUID(); |
| 210 | 211 | const QUuid& simulatorID = _entity->getSimulatorID(); |
| @@ -303,7 +304,11 @@ void EntityMotionState::sendUpdate(OctreeEditPacketSender* packetSender, uint32_ · 92 unmodified lines | ||
| 303 | 304 | setShouldClaimSimulationOwnership(false); |
| 304 | 305 | } else if (simulatorID == myNodeID && zeroSpeed && zeroSpin) { |
| 305 | 306 | // we are the simulator and the entity has stopped. give up "simulator" status |
| 306 | − // _entity->setSimulatorID(QUuid()); | |
| 307 | + _entity->setSimulatorID(QUuid()); | |
| 308 | + properties.setSimulatorID(QUuid()); | |
| 309 | + } else if (simulatorID == myNodeID && !_body->isActive()) { | |
| 310 | + // it's not active. don't keep simulation ownership. | |
| 311 | + _entity->setSimulatorID(QUuid()); | |
| 307 | 312 | properties.setSimulatorID(QUuid()); |
| 308 | 313 | } |
| 309 | 314 | |
| @@ -340,7 +345,7 @@ void EntityMotionState::sendUpdate(OctreeEditPacketSender* packetSender, uint32_ · 30 unmodified lines | ||
| 340 | 345 | qCDebug(physics) << "EntityMotionState::sendUpdate()... calling queueEditEntityMessage()..."; |
| 341 | 346 | #endif |
| 342 | 347 | |
| 343 | − qDebug() << "sending"; | |
| 348 | + qDebug() << "sending" << _body->isActive() << (_entity->getSimulatorID() == myNodeID); | |
| 344 | 349 | entityPacketSender->queueEditEntityMessage(PacketTypeEntityAddOrEdit, id, properties); |
| 345 | 350 | } else { |
| 346 | 351 | #ifdef WANT_DEBUG |