when breaking a parenting loop, make an effort to keep the object near where it was when the loop was created

This commit is contained in:
Seth Alves 2016-02-29 11:07:02 -08:00
parent 3abc7d854a
commit bb9d1556c6

View file

@ -519,7 +519,13 @@ const Transform SpatiallyNestable::getTransform(int jointIndex, bool& success, i
success = false;
// someone created a loop. break it...
qDebug() << "Parenting loop detected.";
getThisPointer()->setParentID(QUuid());
SpatiallyNestablePointer _this = getThisPointer();
_this->setParentID(QUuid());
bool setPositionSuccess;
AACube aaCube = getQueryAACube(setPositionSuccess);
if (setPositionSuccess) {
_this->setPosition(aaCube.calcCenter());
}
return jointInWorldFrame;
}