mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 12:28:02 +02:00
Merge pull request #13290 from AndrewMeadows/update-queryAACube
update server-side bounding box more correctly for grabbed things
This commit is contained in:
commit
a1899e80c0
2 changed files with 17 additions and 10 deletions
|
@ -654,8 +654,8 @@ void MyAvatar::simulate(float deltaTime) {
|
||||||
if (success) {
|
if (success) {
|
||||||
moveOperator.addEntityToMoveList(entity, newCube);
|
moveOperator.addEntityToMoveList(entity, newCube);
|
||||||
}
|
}
|
||||||
// send an edit packet to update the entity-server about the queryAABox. If it's an
|
// send an edit packet to update the entity-server about the queryAABox
|
||||||
// avatar-entity, don't.
|
// unless it is client-only
|
||||||
if (packetSender && !entity->getClientOnly()) {
|
if (packetSender && !entity->getClientOnly()) {
|
||||||
EntityItemProperties properties = entity->getProperties();
|
EntityItemProperties properties = entity->getProperties();
|
||||||
properties.setQueryAACubeDirty();
|
properties.setQueryAACubeDirty();
|
||||||
|
@ -663,6 +663,17 @@ void MyAvatar::simulate(float deltaTime) {
|
||||||
|
|
||||||
packetSender->queueEditEntityMessage(PacketType::EntityEdit, entityTree, entity->getID(), properties);
|
packetSender->queueEditEntityMessage(PacketType::EntityEdit, entityTree, entity->getID(), properties);
|
||||||
entity->setLastBroadcast(usecTimestampNow());
|
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
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -446,17 +446,13 @@ bool EntityMotionState::shouldSendUpdate(uint32_t simulationStep) {
|
||||||
// this case is prevented by setting _ownershipState to UNOWNABLE in EntityMotionState::ctor
|
// this case is prevented by setting _ownershipState to UNOWNABLE in EntityMotionState::ctor
|
||||||
assert(!(_entity->getClientOnly() && _entity->getOwningAvatarID() != Physics::getSessionUUID()));
|
assert(!(_entity->getClientOnly() && _entity->getOwningAvatarID() != Physics::getSessionUUID()));
|
||||||
|
|
||||||
// shouldSendUpdate() sould NOT be triggering updates to maintain the queryAACube of dynamic entities.
|
if (_entity->dynamicDataNeedsTransmit()) {
|
||||||
// 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())) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_entity->shouldSuppressLocationEdits()) {
|
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);
|
return remoteSimulationOutOfSync(simulationStep);
|
||||||
|
|
Loading…
Reference in a new issue