From 464c30cae1161fed4f66270e62cfbb232bfa2f65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B7=A6=E5=8F=B3=E7=9C=8B?= <1918891542@qq.com> Date: Mon, 19 Sep 2022 02:59:59 +0800 Subject: [PATCH] fix emotion rotation --- .../umamusume/Gallop/FaceDrivenKeyTarget.cs | 45 ++++++++++++++----- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/Assets/Scripts/umamusume/Gallop/FaceDrivenKeyTarget.cs b/Assets/Scripts/umamusume/Gallop/FaceDrivenKeyTarget.cs index 28fc0cb..91623ab 100644 --- a/Assets/Scripts/umamusume/Gallop/FaceDrivenKeyTarget.cs +++ b/Assets/Scripts/umamusume/Gallop/FaceDrivenKeyTarget.cs @@ -20,6 +20,8 @@ namespace Gallop public List EyeMorphs = new List(); public List MouthMorphs = new List(); + Dictionary RotationRecorder = new Dictionary(); + public FaceLoadCallBack callBack; public void Initialize(List objs) { @@ -37,6 +39,10 @@ namespace Gallop foreach (TrsArray trs in morph.trsArray) { trs.transform = Objs.Find(ani => ani.name.Equals(trs._path)); + if (i == 0 && trs.transform) + { + RotationRecorder[trs.transform] = trs._rotation; + } } if (i == 0) { @@ -62,6 +68,10 @@ namespace Gallop foreach (TrsArray trs in morph.trsArray) { trs.transform = Objs.Find(ani => ani.name.Equals(trs._path)); + if(i == 0 && trs.transform) + { + RotationRecorder[trs.transform] = trs._rotation; + } } if (i == 0) { @@ -87,6 +97,10 @@ namespace Gallop foreach (TrsArray trs in morph.trsArray) { trs.transform = Objs.Find(ani => ani.name.Equals(trs._path)); + if (i == 0 && trs.transform) + { + RotationRecorder[trs.transform] = trs._rotation; + } } if (i == 0) { @@ -121,6 +135,8 @@ namespace Gallop { ProcessMorph(morph); } + + applyRotation(); } private void ProcessMorph(FacialMorph morph) { @@ -130,7 +146,7 @@ namespace Gallop { trs.transform.localScale += trs._scale * morph.Weight; trs.transform.localPosition += trs._position * morph.Weight; - trs.transform.localEulerAngles += RotationConvert.fromMaya(trs._rotation) * morph.Weight; + RotationRecorder[trs.transform] += trs._rotation * morph.Weight; }; } } @@ -144,7 +160,7 @@ namespace Gallop trs.transform.localPosition = trs._position; trs.transform.localScale = trs._scale; - trs.transform.localEulerAngles = RotationConvert.fromMaya(trs._rotation); + RotationRecorder[trs.transform] = trs._rotation; }; } @@ -152,10 +168,9 @@ namespace Gallop { if (trs.transform) { - trs.transform.localPosition = trs._position; trs.transform.localScale = trs._scale; - trs.transform.localEulerAngles = RotationConvert.fromMaya(trs._rotation); + RotationRecorder[trs.transform] = trs._rotation; }; } @@ -163,10 +178,9 @@ namespace Gallop { if (trs.transform) { - trs.transform.localPosition = trs._position; trs.transform.localScale = trs._scale; - trs.transform.localEulerAngles = RotationConvert.fromMaya(trs._rotation); + RotationRecorder[trs.transform] = trs._rotation; }; } @@ -174,10 +188,9 @@ namespace Gallop { if (trs.transform) { - trs.transform.localPosition = trs._position; trs.transform.localScale = trs._scale; - trs.transform.localEulerAngles = RotationConvert.fromMaya(trs._rotation); + RotationRecorder[trs.transform] = trs._rotation; }; } @@ -188,13 +201,25 @@ namespace Gallop trs.transform.localPosition = trs._position; trs.transform.localScale = trs._scale; - trs.transform.localEulerAngles = RotationConvert.fromMaya(trs._rotation); + RotationRecorder[trs.transform] = trs._rotation; }; } + + applyRotation(); } + //trs.transform.localEulerAngles - } + public void applyRotation(){ + foreach (var trs in RotationRecorder) + { + trs.Key.localEulerAngles = RotationConvert.fromMaya(trs.Value); + } + } + + + +}