Tech ENABLE_WORLD_COORDINATE - Fixed translation in local coordinate for single instance selection
This commit is contained in:
parent
8cf66f52f6
commit
90874c1953
2 changed files with 8 additions and 4 deletions
|
@ -76,13 +76,17 @@ void GLGizmoMove3D::on_start_dragging()
|
|||
#if ENABLE_WORLD_COORDINATE
|
||||
const BoundingBoxf3 box = get_selection_box();
|
||||
Vec3d center;
|
||||
if (wxGetApp().obj_manipul()->get_world_coordinates())
|
||||
if (wxGetApp().obj_manipul()->get_world_coordinates()) {
|
||||
center = box.center();
|
||||
m_starting_drag_position = center + m_grabbers[m_hover_id].center;
|
||||
}
|
||||
else {
|
||||
const Selection& selection = m_parent.get_selection();
|
||||
center = selection.get_volume(*selection.get_volume_idxs().begin())->get_instance_transformation().get_matrix() * box.center();
|
||||
const GLVolume& v = *selection.get_volume(*selection.get_volume_idxs().begin());
|
||||
const Transform3d trafo = Geometry::assemble_transform(Vec3d::Zero(), v.get_instance_rotation());
|
||||
center = v.get_instance_offset() + trafo * box.center();
|
||||
m_starting_drag_position = center + trafo * m_grabbers[m_hover_id].center;
|
||||
}
|
||||
m_starting_drag_position = center + m_grabbers[m_hover_id].center;
|
||||
m_starting_box_center = center;
|
||||
m_starting_box_bottom_center = center;
|
||||
m_starting_box_bottom_center.z() = box.min.z();
|
||||
|
|
|
@ -728,7 +728,7 @@ void Selection::translate(const Vec3d& displacement, bool local)
|
|||
if (is_from_fully_selected_instance(i)) {
|
||||
if (local) {
|
||||
const VolumeCache& volume_data = m_cache.volumes_data[i];
|
||||
const Vec3d world_displacement = (volume_data.get_instance_rotation_matrix() * volume_data.get_instance_scale_matrix() * volume_data.get_instance_mirror_matrix()) * displacement;
|
||||
const Vec3d world_displacement = (volume_data.get_instance_rotation_matrix() * volume_data.get_instance_mirror_matrix()) * displacement;
|
||||
v.set_instance_offset(volume_data.get_instance_position() + world_displacement);
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue