Fixed rotation of volumes contained in rotated instances

This commit is contained in:
Enrico Turri 2018-12-10 16:09:20 +01:00
parent 92ace1c97a
commit 0420d76037

View File

@ -1531,7 +1531,8 @@ void GLCanvas3D::Selection::rotate(const Vec3d& rotation, bool local)
#if ENABLE_WORLD_ROTATIONS #if ENABLE_WORLD_ROTATIONS
{ {
Transform3d m = Geometry::assemble_transform(Vec3d::Zero(), rotation); Transform3d m = Geometry::assemble_transform(Vec3d::Zero(), rotation);
Vec3d new_rotation = Geometry::extract_euler_angles(m * m_cache.volumes_data[i].get_volume_rotation_matrix()); const Transform3d& inst_m = m_cache.volumes_data[i].get_instance_rotation_matrix();
Vec3d new_rotation = Geometry::extract_euler_angles(inst_m.inverse() * m * inst_m * m_cache.volumes_data[i].get_volume_rotation_matrix());
(*m_volumes)[i]->set_volume_rotation(new_rotation); (*m_volumes)[i]->set_volume_rotation(new_rotation);
} }
#else #else