diff --git a/source/RobotAPI/components/InteractiveMemoryEditor/Editor.cpp b/source/RobotAPI/components/InteractiveMemoryEditor/Editor.cpp index 3528d145594f013b95b98255722a7b4ab0d8febe..13dc8abce401f284580dbb7759ea60e27ab69674 100644 --- a/source/RobotAPI/components/InteractiveMemoryEditor/Editor.cpp +++ b/source/RobotAPI/components/InteractiveMemoryEditor/Editor.cpp @@ -282,7 +282,7 @@ namespace armarx auto& [name, change] = *iterator; description.options.emplace_back("Reset"); - description.resetIndex = currentIndex++; + description.resetIndex = currentIndex; // ++ description.transform = change.transform; @@ -315,9 +315,19 @@ namespace armarx objpose::ObjectPose& newPose = newPoses.emplace_back(object); newPose.objectID = object.objectID.withInstanceName(object.objectID.instanceName() + suffix); + const float minOffset = 100; + float offset = minOffset; + if (object.localOOBB.has_value()) + { + Eigen::Vector3f size = object.localOOBB.value().corner_max() - object.localOOBB.value().corner_min(); + float objectOffset = size.maxCoeff() / 2; + + offset = std::max(minOffset, objectOffset); + } + Change& clonedChange = changed[newPose.objectID.str()]; clonedChange.kind = CREATE; - clonedChange.transform = Eigen::Affine3f(Eigen::Translation3f(1000, 1000, 1000)).matrix(); + clonedChange.transform = Eigen::Affine3f(Eigen::Translation3f(offset, offset, offset)).matrix(); clonedChange.iterator = std::prev(newPoses.end()); auto iterator = changed.find(object.objectID.str());