Pārlūkot izejas kodu

Rotation handle about center works

Marko Pintera 10 gadi atpakaļ
vecāks
revīzija
89a692fc5f
1 mainītis faili ar 4 papildinājumiem un 2 dzēšanām
  1. 4 2
      MBansheeEditor/Scene/DefaultHandleManager.cs

+ 4 - 2
MBansheeEditor/Scene/DefaultHandleManager.cs

@@ -26,8 +26,9 @@ namespace BansheeEditor
 
 
         private HandledObject[] activeSelection;
         private HandledObject[] activeSelection;
         private bool isDragged;
         private bool isDragged;
+        private Vector3 initialHandlePosition;
         private Quaternion initialHandleRotation;
         private Quaternion initialHandleRotation;
-
+       
         protected override void PreInput()
         protected override void PreInput()
         {
         {
             SceneObject[] selectedSceneObjects = Selection.sceneObjects;
             SceneObject[] selectedSceneObjects = Selection.sceneObjects;
@@ -110,6 +111,7 @@ namespace BansheeEditor
                         for (int i = 0; i < selectedSceneObjects.Length; i++)
                         for (int i = 0; i < selectedSceneObjects.Length; i++)
                             activeSelection[i] = new HandledObject(selectedSceneObjects[0]);
                             activeSelection[i] = new HandledObject(selectedSceneObjects[0]);
 
 
+                        initialHandlePosition = activeHandle.Position;
                         initialHandleRotation = activeHandle.Rotation;
                         initialHandleRotation = activeHandle.Rotation;
                     }
                     }
                 }
                 }
@@ -138,7 +140,7 @@ namespace BansheeEditor
 
 
                             // Make sure we transform relative to the handle position
                             // Make sure we transform relative to the handle position
                             SceneObject temporarySO = new SceneObject("Temp");
                             SceneObject temporarySO = new SceneObject("Temp");
-                            temporarySO.Position = activeHandle.Position;
+                            temporarySO.Position = initialHandlePosition;
                             temporarySO.LocalRotation = initialHandleRotation;
                             temporarySO.LocalRotation = initialHandleRotation;
 
 
                             SceneObject[] originalParents = new SceneObject[activeSelection.Length];
                             SceneObject[] originalParents = new SceneObject[activeSelection.Length];