Bed model placed into the scene so that its origin goes into shape center

This commit is contained in:
Enrico Turri 2019-07-25 11:34:42 +02:00
parent bc680b8376
commit d6f03a2f52

View File

@ -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)) 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 // 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
m_model.set_offset(-0.03 * Vec3d::UnitZ()); Vec3d shift = m_bounding_box.center();
shift(2) = -0.03;
m_model.set_offset(shift);
// update extended bounding box // update extended bounding box
calc_bounding_boxes(); calc_bounding_boxes();