From a924bd4eb07f0c67ce0389c9db0ed854450c22e7 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Thu, 29 Mar 2018 13:59:42 -0700 Subject: [PATCH] set correct _bidPriority on first ownership update --- libraries/physics/src/EntityMotionState.cpp | 4 ++++ libraries/physics/src/EntityMotionState.h | 4 ++++ libraries/physics/src/PhysicalEntitySimulation.cpp | 1 + 3 files changed, 9 insertions(+) diff --git a/libraries/physics/src/EntityMotionState.cpp b/libraries/physics/src/EntityMotionState.cpp index 9e891806f2..5285ec9a2e 100644 --- a/libraries/physics/src/EntityMotionState.cpp +++ b/libraries/physics/src/EntityMotionState.cpp @@ -710,6 +710,10 @@ uint8_t EntityMotionState::getSimulationPriority() const { return _entity->getSimulationPriority(); } +void EntityMotionState::slaveBidPriority() { + upgradeBidPriority(_entity->getSimulationPriority()); +} + // virtual QUuid EntityMotionState::getSimulatorID() const { assert(entityTreeIsLocked()); diff --git a/libraries/physics/src/EntityMotionState.h b/libraries/physics/src/EntityMotionState.h index b37fa9df68..978bafd539 100644 --- a/libraries/physics/src/EntityMotionState.h +++ b/libraries/physics/src/EntityMotionState.h @@ -101,6 +101,10 @@ protected: // changes _bidPriority only if priority is larger void upgradeBidPriority(uint8_t priority); + + // upgradeBidPriority to value stored in _entity + void slaveBidPriority(); + void clearObjectVelocities() const; #ifdef WANT_DEBUG_ENTITY_TREE_LOCKS diff --git a/libraries/physics/src/PhysicalEntitySimulation.cpp b/libraries/physics/src/PhysicalEntitySimulation.cpp index 9129e29671..ddfd079362 100644 --- a/libraries/physics/src/PhysicalEntitySimulation.cpp +++ b/libraries/physics/src/PhysicalEntitySimulation.cpp @@ -358,6 +358,7 @@ void PhysicalEntitySimulation::sendOwnershipBids(uint32_t numSubsteps) { // in the EntityMotionState::_serverFoo variables (please see comments in EntityMotionState.h) // therefore we need to immediately send an update so that the values stored are what we're // "telling" the server rather than what we've been "hearing" from the server. + _bids[i]->slaveBidPriority(); _bids[i]->sendUpdate(_entityPacketSender, numSubsteps); addOwnership(_bids[i]);