From d6f03a2f52fcd952976dd540b424afa5f480627f Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Thu, 25 Jul 2019 11:34:42 +0200 Subject: [PATCH] Bed model placed into the scene so that its origin goes into shape center --- src/slic3r/GUI/3DBed.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/3DBed.cpp b/src/slic3r/GUI/3DBed.cpp index ca48f7c376..a402fa82d4 100644 --- a/src/slic3r/GUI/3DBed.cpp +++ b/src/slic3r/GUI/3DBed.cpp @@ -558,8 +558,10 @@ void Bed3D::render_model(const std::string& filename) const if ((m_model.get_filename() != filename) && m_model.init_from_file(filename)) { - // move the model a bit down to avoid z-fighting with the texture quad - m_model.set_offset(-0.03 * Vec3d::UnitZ()); + // move the model so that its origin (0.0, 0.0, 0.0) goes into the bed shape center and a bit down to avoid z-fighting with the texture quad + Vec3d shift = m_bounding_box.center(); + shift(2) = -0.03; + m_model.set_offset(shift); // update extended bounding box calc_bounding_boxes();