mirror of
https://github.com/overte-org/overte.git
synced 2025-04-23 15:13:41 +02:00
make sure that NO_BOOTSTRAPPING is disbaled correctly if parent is changed
This commit is contained in:
parent
a1bf54ff00
commit
486cdf14d2
1 changed files with 19 additions and 0 deletions
|
@ -1605,6 +1605,25 @@ void EntityItem::setParentID(const QUuid& value) {
|
|||
if (tree && !oldParentID.isNull()) {
|
||||
tree->removeFromChildrenOfAvatars(getThisPointer());
|
||||
}
|
||||
|
||||
bool enableNoBootStrapping = false;
|
||||
if (!value.isNull() && tree) {
|
||||
EntityItemPointer entity = tree->findEntityByEntityItemID(value);
|
||||
if (entity) {
|
||||
enableNoBootStrapping = (bool)(entity->getDirtyFlags() & Simulation::NO_BOOTSTRAPPING);
|
||||
}
|
||||
}
|
||||
|
||||
enableNoBootStrapping ? markDirtyFlags(Simulation::NO_BOOTSTRAPPING) : clearDirtyFlags(Simulation::NO_BOOTSTRAPPING);
|
||||
forEachDescendant([&](SpatiallyNestablePointer object) {
|
||||
if (object->getNestableType() == NestableType::Entity) {
|
||||
EntityItemPointer entity = std::static_pointer_cast<EntityItem>(object);
|
||||
entity->markDirtyFlags(Simulation::DIRTY_COLLISION_GROUP);
|
||||
enableNoBootStrapping ? entity->markDirtyFlags(Simulation::NO_BOOTSTRAPPING) :
|
||||
entity->clearDirtyFlags(Simulation::NO_BOOTSTRAPPING);
|
||||
}
|
||||
});
|
||||
|
||||
SpatiallyNestable::setParentID(value);
|
||||
// children are forced to be kinematic
|
||||
// may need to not collide with own avatar
|
||||
|
|
Loading…
Reference in a new issue