From 15404a82d9f6d6a741e2fcca7a7447524521654c Mon Sep 17 00:00:00 2001 From: Relintai Date: Fri, 28 Jan 2022 13:14:24 +0100 Subject: [PATCH] Now pivot points work for rotation. --- .../mesh_data_resource_editor/MIDGizmo.gd | 28 ++----------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/game/addons/mesh_data_resource_editor/MIDGizmo.gd b/game/addons/mesh_data_resource_editor/MIDGizmo.gd index 5d90f34b..b37dfb63 100644 --- a/game/addons/mesh_data_resource_editor/MIDGizmo.gd +++ b/game/addons/mesh_data_resource_editor/MIDGizmo.gd @@ -162,36 +162,12 @@ func set_handle(index: int, camera: Camera, point: Vector2): _drag_op_accumulator_quat *= xrot _drag_op_accumulator_quat = _drag_op_accumulator_quat.normalized() - # Works in world and local -# var b : Basis = Basis(_drag_op_accumulator_quat) -# var t : Transform = Transform(b, Vector3()) -# t *= Transform(Basis(), _drag_op_pivot) -# -# # Rotate around pivot -# mul_all_selected_with_transform(t) -# # Bring verts back to local space -# mul_all_selected_with_transform_acc(Transform(Basis(), _drag_op_pivot).inverse()) -# - var b : Basis = Basis(_drag_op_accumulator_quat) - #var t : Transform = Transform(b, _drag_op_pivot) - #t *= Transform(Basis(), _drag_op_pivot) - - var t : Transform = Transform(Basis(), _drag_op_pivot).inverse() + var t : Transform = Transform(Basis(), _drag_op_pivot) t *= Transform(b, Vector3()) - t *= Transform(Basis(), _drag_op_pivot) + t *= Transform(Basis(), _drag_op_pivot).inverse() - # Rotate around pivot mul_all_selected_with_transform(t) - # Bring verts back to local space - #mul_all_selected_with_transform_acc(Transform(Basis(), _drag_op_pivot).inverse()) - - - #old - #var b : Basis = Basis(_drag_op_accumulator_quat) - #var t : Transform = Transform(b, _drag_op_pivot) - - #mul_all_selected_with_transform(t) apply() redraw()