diff --git a/Assets/Scripts/UmaContainer.cs b/Assets/Scripts/UmaContainer.cs index 062d3d2..c0916c7 100644 --- a/Assets/Scripts/UmaContainer.cs +++ b/Assets/Scripts/UmaContainer.cs @@ -39,16 +39,14 @@ public class UmaContainer : MonoBehaviour public bool IsMini = false; public List MiniHeadTextures = new List(); - private void Start() - { - HeadBone = (GameObject)Body.GetComponent()._assetTable.list.FindLast(a => a.Key == "head").Value; - EyeHeight = 0.1f; - TrackTarget = Camera.main.gameObject; - } - public void MergeModel() { if (!Body) return; + + HeadBone = (GameObject)Body.GetComponent()._assetTable.list.FindLast(a => a.Key == "head").Value; + EyeHeight = 0.1f; + TrackTarget = Camera.main.gameObject; + List bodybones = new List(Body.GetComponentInChildren().bones); List emptyBones = new List(); emptyBones.Add(Body.GetComponentInChildren().rootBone.Find("Tail_Ctrl")); @@ -141,12 +139,12 @@ public class UmaContainer : MonoBehaviour private void FixedUpdate() { - if (TrackTarget) + if (TrackTarget&&!isAnimatorControl) { - var targetPosotion = TrackTarget.transform.position - new Vector3(0, EyeHeight, 0); + var targetPosotion = TrackTarget.transform.position - HeadBone.transform.up*EyeHeight; var deltaPos = HeadBone.transform.InverseTransformPoint(targetPosotion); var deltaRotation = HeadBone.transform.InverseTransformDirection(deltaPos.normalized); - var finalRotation = new Vector2(Mathf.Clamp(deltaRotation.x / 0.86f,-1,1), Mathf.Clamp(deltaRotation.y / 0.86f, -1, 1));//Limited to the angle of view + var finalRotation = new Vector2(Mathf.Clamp(deltaRotation.x / 0.86f,-1,1), Mathf.Clamp(deltaRotation.y / 0.66f, -1, 1));//Limited to the angle of view FaceDrivenKeyTarget.SetEyeRange(finalRotation.x, finalRotation.y, finalRotation.x, -finalRotation.y); } diff --git a/Assets/Scripts/UmaViewerUI.cs b/Assets/Scripts/UmaViewerUI.cs index 6ea1d22..fc6ff14 100644 --- a/Assets/Scripts/UmaViewerUI.cs +++ b/Assets/Scripts/UmaViewerUI.cs @@ -229,7 +229,7 @@ public class UmaViewerUI : MonoBehaviour container.Slider.value = morph.weight; container.Slider.maxValue = 1; container.Slider.minValue = 0; - container.Slider.onValueChanged.AddListener((a) => { target.ChangeMorphWeight(morph, a); }); + container.Slider.onValueChanged.AddListener((a) => {target.ChangeMorphWeight(morph, a);}); } } @@ -258,7 +258,7 @@ public class UmaViewerUI : MonoBehaviour container.Slider.value = emotion.Weight; container.Slider.maxValue = 1; container.Slider.minValue = 0; - container.Slider.onValueChanged.AddListener((a) => { emotion.Weight = a; }); + container.Slider.onValueChanged.AddListener((a) => { target.ChangeEmotionWeight(emotion, a); }); } } diff --git a/Assets/Scripts/umamusume/Gallop/CySpringDataContainer.cs b/Assets/Scripts/umamusume/Gallop/CySpringDataContainer.cs index 8640a7c..4fcec23 100644 --- a/Assets/Scripts/umamusume/Gallop/CySpringDataContainer.cs +++ b/Assets/Scripts/umamusume/Gallop/CySpringDataContainer.cs @@ -89,14 +89,26 @@ namespace Gallop var bone = gameObjects.Find(a => { return a.name == spring._boneName; }); if (bone) { + bool isTail = gameObject.name.Contains("tail");//The tail needs less traction var dynamic = gameObject.AddComponent(); dynamic.m_Root = bone; dynamic.m_UpdateMode = DynamicBone.UpdateMode.Normal; - dynamic.m_Gravity = new Vector3(0, Mathf.Clamp01(-spring._gravity / 80000), 0); - dynamic.m_Damping = 0.2f; - dynamic.m_Stiffness = Mathf.Clamp01(spring._stiffnessForce / 900); - dynamic.m_Elasticity = Mathf.Clamp01(spring._dragForce / 4000); + dynamic.m_Gravity = new Vector3(0, Mathf.Clamp01(-30 / spring._gravity), 0); + if (isTail) + { + dynamic.m_Damping = 0.1f; + dynamic.m_Stiffness = Mathf.Clamp01(10 / spring._stiffnessForce); + dynamic.m_Elasticity = Mathf.Clamp01(10 / spring._dragForce); + } + else + { + dynamic.m_Damping = 0.2f; + dynamic.m_Stiffness = Mathf.Clamp01(40 / spring._stiffnessForce); + dynamic.m_Elasticity = Mathf.Clamp01(40 / spring._dragForce); + + } dynamic.m_Radius = spring._collisionRadius; + dynamic.SetupParticles(); DynamicBones.Add(dynamic); @@ -114,8 +126,18 @@ namespace Gallop if (tempParticle != null) { tempParticle.m_Damping = 0.2f; - tempParticle.m_Stiffness = Mathf.Clamp01(Childcollision._stiffnessForce / 900); - tempParticle.m_Elasticity = Mathf.Clamp01(Childcollision._dragForce / 4000); + if (isTail) + { + tempParticle.m_Damping = 0.1f; + tempParticle.m_Stiffness = Mathf.Clamp01(10 / spring._stiffnessForce); + tempParticle.m_Elasticity = Mathf.Clamp01(10 / spring._dragForce); + } + else + { + tempParticle.m_Damping = 0.2f; + tempParticle.m_Stiffness = Mathf.Clamp01(40 / spring._stiffnessForce); + tempParticle.m_Elasticity = Mathf.Clamp01(40 / spring._dragForce); + } tempParticle.m_Radius = Childcollision._collisionRadius; foreach (string collisionName in Childcollision._collisionNameList) { diff --git a/Assets/Scripts/umamusume/Gallop/FaceDrivenKeyTarget.cs b/Assets/Scripts/umamusume/Gallop/FaceDrivenKeyTarget.cs index 9d8d6c0..d38b65b 100644 --- a/Assets/Scripts/umamusume/Gallop/FaceDrivenKeyTarget.cs +++ b/Assets/Scripts/umamusume/Gallop/FaceDrivenKeyTarget.cs @@ -241,6 +241,7 @@ namespace Gallop public void ChangeMorphWeight(FacialMorph morph,float val) { + Container.isAnimatorControl = false; morph.weight = val; ChangeMorph(); } diff --git a/Assets/Scripts/umamusume/Gallop/FaceEmotionKeyTarget.cs b/Assets/Scripts/umamusume/Gallop/FaceEmotionKeyTarget.cs index d019e75..8d56347 100644 --- a/Assets/Scripts/umamusume/Gallop/FaceEmotionKeyTarget.cs +++ b/Assets/Scripts/umamusume/Gallop/FaceEmotionKeyTarget.cs @@ -67,6 +67,12 @@ public class FaceEmotionKeyTarget : ScriptableObject } } + public void ChangeEmotionWeight(FaceTypeData emotion, float val) + { + FaceDrivenKeyTarget.Container.isAnimatorControl = false; + emotion.Weight = val; + } + public void UpdateAllFacialKeyTargets() { if (FaceDrivenKeyTarget == null) return;