Showing the changes to libraries/physics/src/EntityMotionState.cpp (1 of 12 files). Show all
Unified · Split
| @@ -22,7 +22,8 @@ · 21 unmodified lines | ||
| 22 | 22 | #ifdef WANT_DEBUG_ENTITY_TREE_LOCKS |
| 23 | 23 | #include "EntityTree.h" |
| 24 | 24 | #endif |
| 25 | −const char* plankyBlock = "PlankyBlock46"; // adebug | |
| 25 | +//const char* plankyBlock = "PlankyBlock46"; // adebug | |
| 26 | +const char* plankyBlock = "magenta"; // adebug | |
| 26 | 27 | |
| 27 | 28 | static const float ACCELERATION_EQUIVALENT_EPSILON_RATIO = 0.1f; |
| 28 | 29 | static const quint8 STEPS_TO_DECIDE_BALLISTIC = 4; |
| @@ -97,17 +98,17 @@ void EntityMotionState::updateServerPhysicsVariables() { · 68 unmodified lines | ||
| 97 | 98 | // virtual |
| 98 | 99 | void EntityMotionState::handleEasyChanges(uint32_t flags, PhysicsEngine* engine) { |
| 99 | 100 | assert(entityTreeIsLocked()); |
| 100 | − if (_entity && _entity->getName() == plankyBlock) { | |
| 101 | − quint64 dt = (usecTimestampNow() - _activationTime) / 1000; // adebug | |
| 102 | − std::cout << "adebug handleEasyChanges flags = 0x" << std::hex << flags << std::dec << " dt = " << dt << std::endl; // adebug | |
| 103 | − } | |
| 101 | +// if (_entity && _entity->getName() == plankyBlock) { | |
| 102 | +// quint64 dt = (usecTimestampNow() - _activationTime) / 1000; // adebug | |
| 103 | +// std::cout << "adebug handleEasyChanges flags = 0x" << std::hex << flags << std::dec << " dt = " << dt << std::endl; // adebug | |
| 104 | +// } | |
| 104 | 105 | updateServerPhysicsVariables(); |
| 105 | 106 | ObjectMotionState::handleEasyChanges(flags, engine); |
| 106 | 107 | |
| 107 | 108 | if (flags & EntityItem::DIRTY_SIMULATOR_ID) { |
| 108 | − if (_entity && _entity->getName() == plankyBlock) { | |
| 109 | − std::cout << "adebug handleEasyChanges() '" << _entity->getName().toStdString() << "' found DIRTY_SIMULATOR_ID flag" << std::endl; // adebug | |
| 110 | − } | |
| 109 | +// if (_entity && _entity->getName() == plankyBlock) { | |
| 110 | +// std::cout << "adebug handleEasyChanges() '" << _entity->getName().toStdString() << "' found DIRTY_SIMULATOR_ID flag" << std::endl; // adebug | |
| 111 | +// } | |
| 111 | 112 | _loopsWithoutOwner = 0; |
| 112 | 113 | if (_entity->getSimulatorID().isNull()) { |
| 113 | 114 | // simulation ownership is being removed |
| @@ -116,9 +117,9 @@ void EntityMotionState::handleEasyChanges(uint32_t flags, PhysicsEngine* engine) · 2 unmodified lines | ||
| 116 | 117 | flags &= ~EntityItem::DIRTY_PHYSICS_ACTIVATION; |
| 117 | 118 | // hint to Bullet that the object is deactivating |
| 118 | 119 | _body->setActivationState(WANTS_DEACTIVATION); |
| 119 | − if (_entity && _entity->getName() == plankyBlock) { | |
| 120 | − std::cout << "adebug handleEasyChanges() '" << _entity->getName().toStdString() << "' clearing ownership so _candidatePriority goes to 0" << std::endl; // adebug | |
| 121 | − } | |
| 120 | +// if (_entity && _entity->getName() == plankyBlock) { | |
| 121 | +// std::cout << "adebug handleEasyChanges() '" << _entity->getName().toStdString() << "' clearing ownership so _candidatePriority goes to 0" << std::endl; // adebug | |
| 122 | +// } | |
| 122 | 123 | _candidatePriority = 0; |
| 123 | 124 | if (_expectedOwnership != -1) { |
| 124 | 125 | std::cout << "adebug unexpected loss of ownership '" << _entity->getName().toStdString() << "' expected -1 but got " << _expectedOwnership << std::endl; // adebug |
| @@ -128,9 +129,9 @@ void EntityMotionState::handleEasyChanges(uint32_t flags, PhysicsEngine* engine) · 3 unmodified lines | ||
| 128 | 129 | _nextOwnershipBid = usecTimestampNow() + USECS_BETWEEN_OWNERSHIP_BIDS; |
| 129 | 130 | if (engine->getSessionID() == _entity->getSimulatorID() || _entity->getSimulatorPriority() > _candidatePriority) { |
| 130 | 131 | // we own the simulation or our priority looses to remote |
| 131 | − if (_entity && _entity->getName() == plankyBlock) { | |
| 132 | − std::cout << "adebug handleEasyChanges() '" << _entity->getName().toStdString() << "' we own it so _candidatePriority goes to 0" << std::endl; // adebug | |
| 133 | − } | |
| 132 | +// if (_entity && _entity->getName() == plankyBlock) { | |
| 133 | +// std::cout << "adebug handleEasyChanges() '" << _entity->getName().toStdString() << "' we own it so _candidatePriority goes to 0" << std::endl; // adebug | |
| 134 | +// } | |
| 134 | 135 | if (_expectedOwnership != 1) { |
| 135 | 136 | std::cout << "adebug unexpected gain of ownership '" << _entity->getName().toStdString() << "' expected 1 but got " << _expectedOwnership << " _candidatePriority = " << int(_candidatePriority) << std::endl; // adebug |
| 136 | 137 | } |
| @@ -478,14 +479,14 @@ void EntityMotionState::sendUpdate(OctreeEditPacketSender* packetSender, const Q · 341 unmodified lines | ||
| 478 | 479 | // we own the simulation but the entity has stopped, so we tell the server that we're clearing simulatorID |
| 479 | 480 | // but we remember that we do still own it... and rely on the server to tell us that we don't |
| 480 | 481 | std::cout << "adebug releasing ownership of '" << _entity->getName().toStdString() << "' for inactivity" << std::endl; // adebug |
| 481 | − properties.clearSimulatorOwnership(); | |
| 482 | + properties.clearSimulationOwner(); | |
| 482 | 483 | if (_entity && _entity->getName() == plankyBlock) { |
| 483 | 484 | std::cout << "adebug sendUpdate() send clear ownership for '" << _entity->getName().toStdString() << "'" << std::endl; // adebug |
| 484 | 485 | } |
| 485 | 486 | _expectedOwnership = -1; |
| 486 | 487 | } else { |
| 487 | 488 | // re-assert the simulation info |
| 488 | − properties.setSimulatorOwnership(sessionID, _entity->getSimulatorPriority()); | |
| 489 | + properties.setSimulationOwner(sessionID, _entity->getSimulatorPriority()); | |
| 489 | 490 | _expectedOwnership = 0; |
| 490 | 491 | } |
| 491 | 492 | } else { |
| @@ -495,7 +496,7 @@ void EntityMotionState::sendUpdate(OctreeEditPacketSender* packetSender, const Q · 3 unmodified lines | ||
| 495 | 496 | if (_entity && _entity->getName() == plankyBlock) { |
| 496 | 497 | std::cout << "adebug sendUpdate() bid for ownership of '" << _entity->getName().toStdString() << "' dt = " << dt << " with priority " << int(bidPriority) << std::endl; // adebug |
| 497 | 498 | } |
| 498 | − properties.setSimulatorOwnership(sessionID, glm::max<uint8_t>(_candidatePriority, VOLUNTEER_SIMULATOR_PRIORITY)); | |
| 499 | + properties.setSimulationOwner(sessionID, glm::max<uint8_t>(_candidatePriority, VOLUNTEER_SIMULATOR_PRIORITY)); | |
| 499 | 500 | _nextOwnershipBid = now + USECS_BETWEEN_OWNERSHIP_BIDS; |
| 500 | 501 | _expectedOwnership = 1; |
| 501 | 502 | //_candidatePriority = 0; // TODO: it would be nice to not have to clear this until we get a message back that ownership has changed |