mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 05:37:17 +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()) {
|
if (tree && !oldParentID.isNull()) {
|
||||||
tree->removeFromChildrenOfAvatars(getThisPointer());
|
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);
|
SpatiallyNestable::setParentID(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
|
||||||
|
|
Loading…
Reference in a new issue