瀏覽代碼

Fix maid position when deserializing MM scene

Need to apply the hip position 3 times for some reason.
habeebweeb 4 年之前
父節點
當前提交
7a2c9ee4ad
共有 1 個文件被更改,包括 15 次插入1 次删除
  1. 15 1
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Meido/MeidoDragPointManager.cs

+ 15 - 1
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Meido/MeidoDragPointManager.cs

@@ -159,7 +159,21 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 if (i > localRotationIndex) BoneTransform[bone].localRotation = rotation;
                 else BoneTransform[bone].rotation = rotation;
             }
-            BoneTransform[Bone.Hip].position = binaryReader.ReadVector3();
+            // WHY????
+            GameMain.Instance.StartCoroutine(ApplyHipPosition(binaryReader.ReadVector3()));
+        }
+
+        /* 
+            Somebody smarter than me please help me find a way to do this better T_T
+            inb4 for loop.
+         */
+        private System.Collections.IEnumerator ApplyHipPosition(Vector3 hipPosition)
+        {
+            BoneTransform[Bone.Hip].position = hipPosition;
+            yield return new WaitForEndOfFrame();
+            BoneTransform[Bone.Hip].position = hipPosition;
+            yield return new WaitForEndOfFrame();
+            BoneTransform[Bone.Hip].position = hipPosition;
         }
 
         public Transform GetAttachPointTransform(AttachPoint point)