History

sync

Seth Alves committed 11 years ago

Commit fea8d841 parent ad858372 files · +19 −12Browse files

Showing the changes to libraries/physics/src/EntityMotionState.cpp (1 of 2 files). Show all

Unified · Split

libraries/physics/src/EntityMotionState.cpp+11−6
@@ -195,16 +195,17 @@ float EntityMotionState::computeMass(const ShapeInfo& shapeInfo) const { · 194 unmodified lines
195195 }
196196
197197 bool EntityMotionState::shouldSendUpdate(uint32_t simulationFrame) {
198− if (getShouldClaimSimulationOwnership()) {
199− return true;
200− }
201−
202198 bool baseResult = this->ObjectMotionState::shouldSendUpdate(simulationFrame);
203199
204200 if (!baseResult) {
205201 return false;
206202 }
207203
204+ if (getShouldClaimSimulationOwnership()) {
205+ qDebug() << "shouldSendUpdate due to claiming ownership";
206+ return true;
207+ }
208+
208209 auto nodeList = DependencyManager::get<NodeList>();
209210 const QUuid& myNodeID = nodeList->getSessionUUID();
210211 const QUuid& simulatorID = _entity->getSimulatorID();
@@ -303,7 +304,11 @@ void EntityMotionState::sendUpdate(OctreeEditPacketSender* packetSender, uint32_ · 92 unmodified lines
303304 setShouldClaimSimulationOwnership(false);
304305 } else if (simulatorID == myNodeID && zeroSpeed && zeroSpin) {
305306 // 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());
307312 properties.setSimulatorID(QUuid());
308313 }
309314
@@ -340,7 +345,7 @@ void EntityMotionState::sendUpdate(OctreeEditPacketSender* packetSender, uint32_ · 30 unmodified lines
340345 qCDebug(physics) << "EntityMotionState::sendUpdate()... calling queueEditEntityMessage()...";
341346 #endif
342347
343− qDebug() << "sending";
348+ qDebug() << "sending" << _body->isActive() << (_entity->getSimulatorID() == myNodeID);
344349 entityPacketSender->queueEditEntityMessage(PacketTypeEntityAddOrEdit, id, properties);
345350 } else {
346351 #ifdef WANT_DEBUG

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t