Merge pull request #13290 from AndrewMeadows/update-queryAACube

update server-side bounding box more correctly for grabbed things
This commit is contained in:
Sam Gateau 2018-06-06 11:46:09 -07:00 committed by GitHub
commit a1899e80c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 10 deletions

View file

@ -654,8 +654,8 @@ void MyAvatar::simulate(float deltaTime) {
if (success) {
moveOperator.addEntityToMoveList(entity, newCube);
}
// send an edit packet to update the entity-server about the queryAABox. If it's an
// avatar-entity, don't.
// send an edit packet to update the entity-server about the queryAABox
// unless it is client-only
if (packetSender && !entity->getClientOnly()) {
EntityItemProperties properties = entity->getProperties();
properties.setQueryAACubeDirty();
@ -663,6 +663,17 @@ void MyAvatar::simulate(float deltaTime) {
packetSender->queueEditEntityMessage(PacketType::EntityEdit, entityTree, entity->getID(), properties);
entity->setLastBroadcast(usecTimestampNow());
entity->forEachDescendant([&](SpatiallyNestablePointer descendant) {
EntityItemPointer entityDescendant = std::static_pointer_cast<EntityItem>(descendant);
if (!entityDescendant->getClientOnly() && descendant->updateQueryAACube()) {
EntityItemProperties descendantProperties;
descendantProperties.setQueryAACube(descendant->getQueryAACube());
descendantProperties.setLastEdited(now);
packetSender->queueEditEntityMessage(PacketType::EntityEdit, entityTree, entityDescendant->getID(), descendantProperties);
entityDescendant->setLastBroadcast(now); // for debug/physics status icons
}
});
}
}
});

View file

@ -446,17 +446,13 @@ bool EntityMotionState::shouldSendUpdate(uint32_t simulationStep) {
// this case is prevented by setting _ownershipState to UNOWNABLE in EntityMotionState::ctor
assert(!(_entity->getClientOnly() && _entity->getOwningAvatarID() != Physics::getSessionUUID()));
// shouldSendUpdate() sould NOT be triggering updates to maintain the queryAACube of dynamic entities.
// The server is supposed to predict the transform of such moving things. The client performs a "double prediction"
// where it predicts what the the server is doing, and only sends updates whent the entity's true transform
// differs significantly. That is what the remoteSimulationOutOfSync() logic is all about.
if (_entity->dynamicDataNeedsTransmit() ||
(!_entity->getDynamic() && _entity->queryAACubeNeedsUpdate())) {
if (_entity->dynamicDataNeedsTransmit()) {
return true;
}
if (_entity->shouldSuppressLocationEdits()) {
return false;
// "shouldSuppressLocationEdits" really means: "the entity has a 'Hold' action therefore
// we don't need send an update unless the entity is not contained by its queryAACube"
return _entity->queryAACubeNeedsUpdate();
}
return remoteSimulationOutOfSync(simulationStep);