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
195}195}
196 196
197bool EntityMotionState::shouldSendUpdate(uint32_t simulationFrame) {197bool EntityMotionState::shouldSendUpdate(uint32_t simulationFrame) {
198 if (getShouldClaimSimulationOwnership()) {
199 return true;
200 }
201
202 bool baseResult = this->ObjectMotionState::shouldSendUpdate(simulationFrame);198 bool baseResult = this->ObjectMotionState::shouldSendUpdate(simulationFrame);
203 199
204 if (!baseResult) {200 if (!baseResult) {
205 return false;201 return false;
206 }202 }
207 203
204 if (getShouldClaimSimulationOwnership()) {
205 qDebug() << "shouldSendUpdate due to claiming ownership";
206 return true;
207 }
208
208 auto nodeList = DependencyManager::get<NodeList>();209 auto nodeList = DependencyManager::get<NodeList>();
209 const QUuid& myNodeID = nodeList->getSessionUUID();210 const QUuid& myNodeID = nodeList->getSessionUUID();
210 const QUuid& simulatorID = _entity->getSimulatorID();211 const QUuid& simulatorID = _entity->getSimulatorID();
@@ -303,7 +304,11 @@ void EntityMotionState::sendUpdate(OctreeEditPacketSender* packetSender, uint32_ · 92 unmodified lines
303 setShouldClaimSimulationOwnership(false);304 setShouldClaimSimulationOwnership(false);
304 } else if (simulatorID == myNodeID && zeroSpeed && zeroSpin) {305 } else if (simulatorID == myNodeID && zeroSpeed && zeroSpin) {
305 // we are the simulator and the entity has stopped. give up "simulator" status306 // 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 properties.setSimulatorID(QUuid());312 properties.setSimulatorID(QUuid());
308 }313 }
309 314
@@ -340,7 +345,7 @@ void EntityMotionState::sendUpdate(OctreeEditPacketSender* packetSender, uint32_ · 30 unmodified lines
340 qCDebug(physics) << "EntityMotionState::sendUpdate()... calling queueEditEntityMessage()...";345 qCDebug(physics) << "EntityMotionState::sendUpdate()... calling queueEditEntityMessage()...";
341 #endif346 #endif
342 347
343 qDebug() << "sending";348 qDebug() << "sending" << _body->isActive() << (_entity->getSimulatorID() == myNodeID);
344 entityPacketSender->queueEditEntityMessage(PacketTypeEntityAddOrEdit, id, properties);349 entityPacketSender->queueEditEntityMessage(PacketTypeEntityAddOrEdit, id, properties);
345 } else {350 } else {
346 #ifdef WANT_DEBUG351 #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