only send a queryAACube for entities to entity-server

This commit is contained in:
Seth Alves 2015-12-18 16:28:11 -08:00
parent 7689453ba2
commit 701f99d28e
3 changed files with 25 additions and 15 deletions

View file

@ -278,18 +278,22 @@ QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties&
properties.setQueryAACube(entity->getQueryAACube()); properties.setQueryAACube(entity->getQueryAACube());
} }
entity->setLastBroadcast(usecTimestampNow()); entity->setLastBroadcast(usecTimestampNow());
}
// if we've moved an entity with children, check/update the queryAACube of all descendents and tell the server // if we've moved an entity with children, check/update the queryAACube of all descendents and tell the server
// if they've changed. // if they've changed.
// TODO -- ancestors of this entity may also need to expand their queryAACubes. // TODO -- ancestors of this entity may also need to expand their queryAACubes.
entity->forEachDescendant([&](SpatiallyNestablePointer descendant) { entity->forEachDescendant([&](SpatiallyNestablePointer descendant) {
if (descendant->getNestableType() == NestableType::Entity) {
EntityItemPointer entityDescendant = std::static_pointer_cast<EntityItem>(descendant);
if (descendant->setPuffedQueryAACube()) { if (descendant->setPuffedQueryAACube()) {
EntityItemProperties newQueryCubeProperties; EntityItemProperties newQueryCubeProperties;
newQueryCubeProperties.setQueryAACube(descendant->getQueryAACube()); newQueryCubeProperties.setQueryAACube(descendant->getQueryAACube());
queueEntityMessage(PacketType::EntityEdit, descendant->getID(), newQueryCubeProperties); queueEntityMessage(PacketType::EntityEdit, descendant->getID(), newQueryCubeProperties);
entityDescendant->setLastBroadcast(usecTimestampNow());
}
} }
}); });
}
}); });
queueEntityMessage(PacketType::EntityEdit, entityID, properties); queueEntityMessage(PacketType::EntityEdit, entityID, properties);
return id; return id;

View file

@ -515,10 +515,14 @@ void EntityMotionState::sendUpdate(OctreeEditPacketSender* packetSender, const Q
// if they've changed. // if they've changed.
// TODO -- ancestors of this entity may also need to expand their queryAACubes. // TODO -- ancestors of this entity may also need to expand their queryAACubes.
_entity->forEachDescendant([&](SpatiallyNestablePointer descendant) { _entity->forEachDescendant([&](SpatiallyNestablePointer descendant) {
if (descendant->getNestableType() == NestableType::Entity) {
EntityItemPointer entityDescendant = std::static_pointer_cast<EntityItem>(descendant);
if (descendant->setPuffedQueryAACube()) { if (descendant->setPuffedQueryAACube()) {
EntityItemProperties newQueryCubeProperties; EntityItemProperties newQueryCubeProperties;
newQueryCubeProperties.setQueryAACube(descendant->getQueryAACube()); newQueryCubeProperties.setQueryAACube(descendant->getQueryAACube());
entityPacketSender->queueEditEntityMessage(PacketType::EntityEdit, descendant->getID(), newQueryCubeProperties); entityPacketSender->queueEditEntityMessage(PacketType::EntityEdit, descendant->getID(), newQueryCubeProperties);
entityDescendant->setLastBroadcast(usecTimestampNow());
}
} }
}); });

View file

@ -296,6 +296,8 @@ void SpatiallyNestable::setPosition(const glm::vec3& position, bool& success) {
}); });
if (success) { if (success) {
locationChanged(); locationChanged();
} else {
qDebug() << "setPosition failed for" << getID();
} }
} }