Selaa lähdekoodia

Add DefaultRotation to DragPointGeneral

Currently props (dogu) set the default rotation. Others default to the
identity quaternion.
habeebweeb 4 vuotta sitten
vanhempi
commit
86bf809db0

+ 2 - 1
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/DragPoint/DragPointGeneral.cs

@@ -12,6 +12,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         private float currentScale;
         private bool scaling;
         private Quaternion currentRotation;
+        public Quaternion DefaultRotation { get; set; } = Quaternion.identity;
         public float ScaleFactor { get; set; } = 1f;
         public bool ConstantScale { get; set; }
         public static readonly Color moveColour = new Color(0.2f, 0.5f, 0.95f, defaultAlpha);
@@ -117,7 +118,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
             if (CurrentDragType == DragType.RotLocalY || CurrentDragType == DragType.RotLocalXZ)
             {
-                MyObject.rotation = Quaternion.identity;
+                MyObject.rotation = DefaultRotation;
                 OnRotate();
             }
         }

+ 1 - 0
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/DragPoint/DragPointOther.cs

@@ -64,6 +64,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         public override void Set(Transform myObject)
         {
             base.Set(myObject);
+            DefaultRotation = MyObject.rotation;
             meshRenderers = new List<Renderer>(MyObject.GetComponentsInChildren<SkinnedMeshRenderer>());
             meshRenderers.AddRange(MyObject.GetComponentsInChildren<MeshRenderer>());
         }