mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 07:19:05 +02:00
Fix objects snapping back when selected
This commit is contained in:
parent
67c605c10a
commit
c039d20304
2 changed files with 7 additions and 9 deletions
|
@ -347,7 +347,7 @@ bool EntityMotionState::remoteSimulationOutOfSync(uint32_t simulationStep) {
|
||||||
|
|
||||||
if (_numInactiveUpdates > 0) {
|
if (_numInactiveUpdates > 0) {
|
||||||
const uint8_t MAX_NUM_INACTIVE_UPDATES = 20;
|
const uint8_t MAX_NUM_INACTIVE_UPDATES = 20;
|
||||||
if (_numInactiveUpdates > MAX_NUM_INACTIVE_UPDATES || isServerlessMode()) {
|
if (_numInactiveUpdates > MAX_NUM_INACTIVE_UPDATES) {
|
||||||
// clear local ownership (stop sending updates) and let the server clear itself
|
// clear local ownership (stop sending updates) and let the server clear itself
|
||||||
_entity->clearSimulationOwnership();
|
_entity->clearSimulationOwnership();
|
||||||
return false;
|
return false;
|
||||||
|
@ -829,9 +829,3 @@ void EntityMotionState::clearObjectVelocities() const {
|
||||||
}
|
}
|
||||||
_entity->setAcceleration(glm::vec3(0.0f));
|
_entity->setAcceleration(glm::vec3(0.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EntityMotionState::isServerlessMode() {
|
|
||||||
EntityTreeElementPointer element = _entity->getElement();
|
|
||||||
EntityTreePointer tree = element ? element->getTree() : nullptr;
|
|
||||||
return tree ? tree->isServerlessMode() : false;
|
|
||||||
}
|
|
||||||
|
|
|
@ -277,12 +277,15 @@ void PhysicalEntitySimulation::getObjectsToChange(VectorOfMotionStates& result)
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhysicalEntitySimulation::handleDeactivatedMotionStates(const VectorOfMotionStates& motionStates) {
|
void PhysicalEntitySimulation::handleDeactivatedMotionStates(const VectorOfMotionStates& motionStates) {
|
||||||
|
boolean serverlessMode = getEntityTree()->isServerlessMode();
|
||||||
for (auto stateItr : motionStates) {
|
for (auto stateItr : motionStates) {
|
||||||
ObjectMotionState* state = &(*stateItr);
|
ObjectMotionState* state = &(*stateItr);
|
||||||
assert(state);
|
assert(state);
|
||||||
if (state->getType() == MOTIONSTATE_TYPE_ENTITY) {
|
if (state->getType() == MOTIONSTATE_TYPE_ENTITY) {
|
||||||
EntityMotionState* entityState = static_cast<EntityMotionState*>(state);
|
EntityMotionState* entityState = static_cast<EntityMotionState*>(state);
|
||||||
entityState->handleDeactivation();
|
if (!serverlessMode) {
|
||||||
|
entityState->handleDeactivation();
|
||||||
|
}
|
||||||
EntityItemPointer entity = entityState->getEntity();
|
EntityItemPointer entity = entityState->getEntity();
|
||||||
_entitiesToSort.insert(entity);
|
_entitiesToSort.insert(entity);
|
||||||
}
|
}
|
||||||
|
@ -379,6 +382,7 @@ void PhysicalEntitySimulation::sendOwnershipBids(uint32_t numSubsteps) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhysicalEntitySimulation::sendOwnedUpdates(uint32_t numSubsteps) {
|
void PhysicalEntitySimulation::sendOwnedUpdates(uint32_t numSubsteps) {
|
||||||
|
boolean serverlessMode = getEntityTree()->isServerlessMode();
|
||||||
PROFILE_RANGE_EX(simulation_physics, "Update", 0x00000000, (uint64_t)_owned.size());
|
PROFILE_RANGE_EX(simulation_physics, "Update", 0x00000000, (uint64_t)_owned.size());
|
||||||
uint32_t i = 0;
|
uint32_t i = 0;
|
||||||
while (i < _owned.size()) {
|
while (i < _owned.size()) {
|
||||||
|
@ -390,7 +394,7 @@ void PhysicalEntitySimulation::sendOwnedUpdates(uint32_t numSubsteps) {
|
||||||
}
|
}
|
||||||
_owned.remove(i);
|
_owned.remove(i);
|
||||||
} else {
|
} else {
|
||||||
if (_owned[i]->shouldSendUpdate(numSubsteps)) {
|
if (!serverlessMode && _owned[i]->shouldSendUpdate(numSubsteps)) {
|
||||||
_owned[i]->sendUpdate(_entityPacketSender, numSubsteps);
|
_owned[i]->sendUpdate(_entityPacketSender, numSubsteps);
|
||||||
}
|
}
|
||||||
++i;
|
++i;
|
||||||
|
|
Loading…
Reference in a new issue