trying to get child collision hulls to be in the right place after import

This commit is contained in:
Seth Alves 2017-05-19 10:59:59 -07:00
parent 7220fe0ad8
commit 735e4b7d05
2 changed files with 8 additions and 4 deletions

View file

@ -1639,14 +1639,14 @@ void EntityItem::updateParentID(const QUuid& value) {
// children are forced to be kinematic // children are forced to be kinematic
// may need to not collide with own avatar // may need to not collide with own avatar
markDirtyFlags(Simulation::DIRTY_MOTION_TYPE | Simulation::DIRTY_COLLISION_GROUP | Simulation::DIRTY_POSITION); markDirtyFlags(Simulation::DIRTY_MOTION_TYPE | Simulation::DIRTY_COLLISION_GROUP | Simulation::DIRTY_TRANSFORM);
tree->entityChanged(getThisPointer()); tree->entityChanged(getThisPointer());
forEachDescendant([&](SpatiallyNestablePointer object) { forEachDescendant([&](SpatiallyNestablePointer object) {
if (object->getNestableType() == NestableType::Entity) { if (object->getNestableType() == NestableType::Entity) {
EntityItemPointer entity = std::static_pointer_cast<EntityItem>(object); EntityItemPointer entity = std::static_pointer_cast<EntityItem>(object);
entity->markDirtyFlags(Simulation::DIRTY_MOTION_TYPE | entity->markDirtyFlags(Simulation::DIRTY_MOTION_TYPE |
Simulation::DIRTY_COLLISION_GROUP | Simulation::DIRTY_COLLISION_GROUP |
Simulation::DIRTY_POSITION); Simulation::DIRTY_TRANSFORM);
tree->entityChanged(entity); tree->entityChanged(entity);
} }
}); });

View file

@ -1253,14 +1253,14 @@ void EntityTree::fixupMissingParents() {
// need to be moved. // need to be moved.
entity->markDirtyFlags(Simulation::DIRTY_MOTION_TYPE | entity->markDirtyFlags(Simulation::DIRTY_MOTION_TYPE |
Simulation::DIRTY_COLLISION_GROUP | Simulation::DIRTY_COLLISION_GROUP |
Simulation::DIRTY_POSITION); Simulation::DIRTY_TRANSFORM);
entityChanged(entity); entityChanged(entity);
entity->forEachDescendant([&](SpatiallyNestablePointer object) { entity->forEachDescendant([&](SpatiallyNestablePointer object) {
if (object->getNestableType() == NestableType::Entity) { if (object->getNestableType() == NestableType::Entity) {
EntityItemPointer descendantEntity = std::static_pointer_cast<EntityItem>(object); EntityItemPointer descendantEntity = std::static_pointer_cast<EntityItem>(object);
descendantEntity->markDirtyFlags(Simulation::DIRTY_MOTION_TYPE | descendantEntity->markDirtyFlags(Simulation::DIRTY_MOTION_TYPE |
Simulation::DIRTY_COLLISION_GROUP | Simulation::DIRTY_COLLISION_GROUP |
Simulation::DIRTY_POSITION); Simulation::DIRTY_TRANSFORM);
entityChanged(descendantEntity); entityChanged(descendantEntity);
} }
}); });
@ -1620,6 +1620,10 @@ QVector<EntityItemID> EntityTree::sendEntities(EntityEditPacketSender* packetSen
EntityItemID newID = i.value(); EntityItemID newID = i.value();
EntityItemPointer entity = localTree->findEntityByEntityItemID(newID); EntityItemPointer entity = localTree->findEntityByEntityItemID(newID);
if (entity) { if (entity) {
if (!entity->getParentID().isNull()) {
QWriteLocker locker(&_missingParentLock);
_missingParent.append(entity);
}
entity->forceQueryAACubeUpdate(); entity->forceQueryAACubeUpdate();
moveOperator.addEntityToMoveList(entity, entity->getQueryAACube()); moveOperator.addEntityToMoveList(entity, entity->getQueryAACube());
i++; i++;