diff --git a/Assets/Plugins/RootMotion/PuppetMaster/Scripts/PuppetMasterValidation.cs b/Assets/Plugins/RootMotion/PuppetMaster/Scripts/PuppetMasterValidation.cs index 10faeaf..3cd58ea 100644 --- a/Assets/Plugins/RootMotion/PuppetMaster/Scripts/PuppetMasterValidation.cs +++ b/Assets/Plugins/RootMotion/PuppetMaster/Scripts/PuppetMasterValidation.cs @@ -74,8 +74,9 @@ namespace RootMotion.Dynamics { for (int i = 0; i < muscles.Length; i++) { if (Vector3.SqrMagnitude(muscles[i].joint.transform.position - muscles[i].target.position) > 0.001f) { - if (log) Debug.LogError("The position of each muscle needs to match with the position of it's target. Muscle '" + muscles[i].joint.name + "' position does not match with it's target. Right-click on the PuppetMaster component's header and select 'Fix Muscle Positions' from the context menu.", muscles[i].joint.transform); - return false; + + if (log) Debug.LogWarning("The position of each muscle needs to match with the position of it's target. Muscle '" + muscles[i].joint.name + "' position does not match with it's target. Right-click on the PuppetMaster component's header and select 'Fix Muscle Positions' from the context menu.", muscles[i].joint.transform); + //return false; } } diff --git a/Assets/Plugins/RootMotion/RagdollManager/Scripts/BipedRagdollReferences.cs b/Assets/Plugins/RootMotion/RagdollManager/Scripts/BipedRagdollReferences.cs index 86434e8..460b9a4 100644 --- a/Assets/Plugins/RootMotion/RagdollManager/Scripts/BipedRagdollReferences.cs +++ b/Assets/Plugins/RootMotion/RagdollManager/Scripts/BipedRagdollReferences.cs @@ -212,29 +212,31 @@ namespace RootMotion.Dynamics { BipedRagdollReferences r = new BipedRagdollReferences(); if (!animator.isHuman) { - - r.root = GameObject.Find("Position").transform; + List list = new List(animator.gameObject.GetComponentsInChildren()); + list.Find(t => t.name.Equals("Position")); - r.hips = GameObject.Find("Hip").transform; - r.spine = GameObject.Find("Spine").transform; - r.chest = GameObject.Find("Chest").transform; - r.head = GameObject.Find("Head").transform; + r.root = list.Find(t => t.name.Equals("Position")); - r.leftUpperArm = GameObject.Find("Arm_L").transform; - r.leftLowerArm = GameObject.Find("Elbow_L").transform; - r.leftHand = GameObject.Find("Wrist_L").transform; + r.hips = list.Find(t => t.name.Equals("Hip")); + r.spine = list.Find(t => t.name.Equals("Spine")); + r.chest = list.Find(t => t.name.Equals("Chest")); + r.head = list.Find(t => t.name.Equals("Head")); - r.rightUpperArm = GameObject.Find("Arm_R").transform; - r.rightLowerArm = GameObject.Find("Elbow_R").transform; - r.rightHand = GameObject.Find("Wrist_R").transform; + r.leftUpperArm = list.Find(t => t.name.Equals("Arm_L")); + r.leftLowerArm = list.Find(t => t.name.Equals("Elbow_L")); + r.leftHand = list.Find(t => t.name.Equals("Wrist_L")); - r.leftUpperLeg = GameObject.Find("Thigh_L").transform; - r.leftLowerLeg = GameObject.Find("Knee_L").transform; - r.leftFoot = GameObject.Find("Ankle_L").transform; + r.rightUpperArm = list.Find(t => t.name.Equals("Arm_R")); + r.rightLowerArm = list.Find(t => t.name.Equals("Elbow_R")); + r.rightHand = list.Find(t => t.name.Equals("Wrist_R")); - r.rightUpperLeg = GameObject.Find("Thigh_R").transform; - r.rightLowerLeg = GameObject.Find("Knee_R").transform; - r.rightFoot = GameObject.Find("Ankle_R").transform; + r.leftUpperLeg = list.Find(t => t.name.Equals("Thigh_L")); + r.leftLowerLeg = list.Find(t => t.name.Equals("Knee_L")); + r.leftFoot = list.Find(t => t.name.Equals("Ankle_L")); + + r.rightUpperLeg = list.Find(t => t.name.Equals("Thigh_R")); + r.rightLowerLeg = list.Find(t => t.name.Equals("Knee_R")); + r.rightFoot = list.Find(t => t.name.Equals("Ankle_R")); return r; } diff --git a/Assets/Resources/UI/d_stepok@2x.png b/Assets/Resources/UI/d_stepok@2x.png new file mode 100644 index 0000000..6172eb0 Binary files /dev/null and b/Assets/Resources/UI/d_stepok@2x.png differ diff --git a/Assets/Resources/UI/d_stepok@2x.png.meta b/Assets/Resources/UI/d_stepok@2x.png.meta new file mode 100644 index 0000000..025a884 --- /dev/null +++ b/Assets/Resources/UI/d_stepok@2x.png.meta @@ -0,0 +1,88 @@ +fileFormatVersion: 2 +guid: 3494dc956dfd7174abc07060940a2848 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 914a29fa17201064fb558eba2fdc6047 + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/UI/refresh.png b/Assets/Resources/UI/refresh.png new file mode 100644 index 0000000..22751b5 Binary files /dev/null and b/Assets/Resources/UI/refresh.png differ diff --git a/Assets/Resources/UI/refresh.png.meta b/Assets/Resources/UI/refresh.png.meta new file mode 100644 index 0000000..e3d10c1 --- /dev/null +++ b/Assets/Resources/UI/refresh.png.meta @@ -0,0 +1,92 @@ +fileFormatVersion: 2 +guid: 6f6a4c6bd7cdc654d9d91f7de72afcb6 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + applyGammaDecoding: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/Version2.unity b/Assets/Scenes/Version2.unity index a3287f2..c6df694 100644 --- a/Assets/Scenes/Version2.unity +++ b/Assets/Scenes/Version2.unity @@ -2166,7 +2166,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 0, y: -45.000305} + m_AnchoredPosition: {x: 0, y: -45.000183} m_SizeDelta: {x: 255, y: -90} m_Pivot: {x: 0, y: 0.5} --- !u!114 &92965282 @@ -2775,7 +2775,7 @@ GameObject: - component: {fileID: 115881384} - component: {fileID: 115881383} m_Layer: 0 - m_Name: Cube + m_Name: Ground m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -2801,7 +2801,7 @@ MeshRenderer: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 115881382} - m_Enabled: 1 + m_Enabled: 0 m_CastShadows: 1 m_ReceiveShadows: 1 m_DynamicOccludee: 1 @@ -2855,7 +2855,7 @@ Transform: m_LocalScale: {x: 50, y: 0.2, z: 50} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 11 + m_RootOrder: 10 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &116348344 GameObject: @@ -3061,7 +3061,6 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 1648089198} - - {fileID: 1876060884} m_Father: {fileID: 733646225} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -6678,7 +6677,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 255, y: -45.000305} + m_AnchoredPosition: {x: 255, y: -45.000183} m_SizeDelta: {x: 270, y: -90} m_Pivot: {x: 0, y: 0.5} --- !u!114 &270183827 @@ -24580,12 +24579,12 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 859153089} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -960, y: -631.1724, z: 0} + m_LocalScale: {x: 2.2068965, y: 2.2068965, z: 2.2068965} m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 10 + m_Father: {fileID: 2005720242} + m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &859804981 GameObject: @@ -26405,7 +26404,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 380, y: -45.000305} + m_AnchoredPosition: {x: 380, y: -45.000183} m_SizeDelta: {x: 255, y: -90} m_Pivot: {x: 0, y: 0.5} --- !u!114 &931406427 @@ -26639,7 +26638,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 255, y: -45.000305} + m_AnchoredPosition: {x: 255, y: -45.000183} m_SizeDelta: {x: 270, y: -90} m_Pivot: {x: 0, y: 0.5} --- !u!114 &952551665 @@ -29014,7 +29013,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 0, y: -45.000305} + m_AnchoredPosition: {x: 0, y: -45.000183} m_SizeDelta: {x: 255, y: -90} m_Pivot: {x: 0, y: 0.5} --- !u!114 &1040294592 @@ -32201,8 +32200,8 @@ MonoBehaviour: m_TargetGraphic: {fileID: 1882365343} m_HandleRect: {fileID: 1882365342} m_Direction: 2 - m_Value: 1 - m_Size: 0.98819953 + m_Value: 0.99999 + m_Size: 0.9881995 m_NumberOfSteps: 0 m_OnValueChanged: m_PersistentCalls: @@ -39644,7 +39643,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 1, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: -30.000061} + m_AnchoredPosition: {x: 0, y: -29.999878} m_SizeDelta: {x: 300, y: -60.000233} m_Pivot: {x: 1, y: 0.5} --- !u!114 &1453791885 @@ -40204,85 +40203,6 @@ RectTransform: m_AnchoredPosition: {x: 270, y: -15} m_SizeDelta: {x: 112.5, y: 30} m_Pivot: {x: 0, y: 0.5} ---- !u!1 &1502942741 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1502942742} - - component: {fileID: 1502942744} - - component: {fileID: 1502942743} - m_Layer: 5 - m_Name: Text - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &1502942742 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1502942741} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 1876060884} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!114 &1502942743 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1502942741} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Material: {fileID: 0} - m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} - m_RaycastTarget: 1 - m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} - m_Maskable: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_FontData: - m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} - m_FontSize: 14 - m_FontStyle: 0 - m_BestFit: 0 - m_MinSize: 10 - m_MaxSize: 40 - m_Alignment: 4 - m_AlignByGeometry: 0 - m_RichText: 1 - m_HorizontalOverflow: 0 - m_VerticalOverflow: 0 - m_LineSpacing: 1 - m_Text: Button ---- !u!222 &1502942744 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1502942741} - m_CullTransparentMesh: 1 --- !u!1 &1503272426 GameObject: m_ObjectHideFlags: 0 @@ -41059,7 +40979,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 0, y: -45.000305} + m_AnchoredPosition: {x: 0, y: -45.000183} m_SizeDelta: {x: 380, y: -90} m_Pivot: {x: 0, y: 0.5} --- !u!224 &1525688469 stripped @@ -41769,7 +41689,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 0, y: -45.000305} + m_AnchoredPosition: {x: 0, y: -45.000183} m_SizeDelta: {x: 255, y: -90} m_Pivot: {x: 0, y: 0.5} --- !u!114 &1558324558 @@ -45241,7 +45161,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 0, y: -45.000305} + m_AnchoredPosition: {x: 0, y: -45.000183} m_SizeDelta: {x: 380, y: -90} m_Pivot: {x: 0, y: 0.5} --- !u!114 &1678768231 @@ -45575,7 +45495,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 0, y: -45.000305} + m_AnchoredPosition: {x: 0, y: -45.000183} m_SizeDelta: {x: 380, y: -90} m_Pivot: {x: 0, y: 0.5} --- !u!222 &1684693616 @@ -45945,7 +45865,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 0, y: -45.000305} + m_AnchoredPosition: {x: 0, y: -45.000183} m_SizeDelta: {x: 380, y: -90} m_Pivot: {x: 0, y: 0.5} --- !u!114 &1699478760 @@ -47862,7 +47782,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 255, y: -45.000305} + m_AnchoredPosition: {x: 255, y: -45.000183} m_SizeDelta: {x: 270, y: -90} m_Pivot: {x: 0, y: 0.5} --- !u!114 &1765749874 @@ -50581,139 +50501,6 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1871345304} m_CullTransparentMesh: 1 ---- !u!1 &1876060883 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1876060884} - - component: {fileID: 1876060887} - - component: {fileID: 1876060886} - - component: {fileID: 1876060885} - m_Layer: 5 - m_Name: Debug - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &1876060884 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1876060883} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: - - {fileID: 1502942742} - m_Father: {fileID: 127647252} - m_RootOrder: 1 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: -0.000091552734, y: 0} - m_SizeDelta: {x: 160, y: 30} - m_Pivot: {x: 0, y: 0} ---- !u!114 &1876060885 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1876060883} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Navigation: - m_Mode: 3 - m_WrapAround: 0 - m_SelectOnUp: {fileID: 0} - m_SelectOnDown: {fileID: 0} - m_SelectOnLeft: {fileID: 0} - m_SelectOnRight: {fileID: 0} - m_Transition: 1 - m_Colors: - m_NormalColor: {r: 1, g: 1, b: 1, a: 1} - m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} - m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} - m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} - m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} - m_ColorMultiplier: 1 - m_FadeDuration: 0.1 - m_SpriteState: - m_HighlightedSprite: {fileID: 0} - m_PressedSprite: {fileID: 0} - m_SelectedSprite: {fileID: 0} - m_DisabledSprite: {fileID: 0} - m_AnimationTriggers: - m_NormalTrigger: Normal - m_HighlightedTrigger: Highlighted - m_PressedTrigger: Pressed - m_SelectedTrigger: Selected - m_DisabledTrigger: Disabled - m_Interactable: 1 - m_TargetGraphic: {fileID: 1876060886} - m_OnClick: - m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 1564959567} - m_TargetAssemblyTypeName: UmaViewerUI, umamusume - m_MethodName: Debug - m_Mode: 1 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 ---- !u!114 &1876060886 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1876060883} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Material: {fileID: 0} - m_Color: {r: 1, g: 1, b: 1, a: 1} - m_RaycastTarget: 1 - m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} - m_Maskable: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} - m_Type: 1 - m_PreserveAspect: 0 - m_FillCenter: 1 - m_FillMethod: 4 - m_FillAmount: 1 - m_FillClockwise: 1 - m_FillOrigin: 0 - m_UseSpriteMesh: 0 - m_PixelsPerUnitMultiplier: 1 ---- !u!222 &1876060887 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1876060883} - m_CullTransparentMesh: 1 --- !u!1 &1878249917 GameObject: m_ObjectHideFlags: 0 @@ -52418,7 +52205,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 0, y: -45.000305} + m_AnchoredPosition: {x: 0, y: -45.000183} m_SizeDelta: {x: 400, y: -90} m_Pivot: {x: 0, y: 0.5} --- !u!114 &1970310175 @@ -53946,6 +53733,7 @@ RectTransform: m_Children: - {fileID: 1300114664} - {fileID: 1210994110} + - {fileID: 859153092} m_Father: {fileID: 0} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -57536,7 +57324,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 0, y: -45.000305} + m_AnchoredPosition: {x: 0, y: -45.000183} m_SizeDelta: {x: 400, y: -90} m_Pivot: {x: 0, y: 0.5} --- !u!114 &2129326814 @@ -58657,7 +58445,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 0, y: -45.000305} + m_AnchoredPosition: {x: 0, y: -45.000183} m_SizeDelta: {x: 255, y: -90} m_Pivot: {x: 0, y: 0.5} --- !u!114 &2146564492 diff --git a/Assets/Scripts/UmaContainer.cs b/Assets/Scripts/UmaContainer.cs index 55e06de..3fd80d1 100644 --- a/Assets/Scripts/UmaContainer.cs +++ b/Assets/Scripts/UmaContainer.cs @@ -1,4 +1,6 @@ using Gallop; +using RootMotion.Dynamics; +using RootMotion.FinalIK; using System; using System.Collections; using System.Collections.Generic; @@ -33,7 +35,7 @@ public class UmaContainer : MonoBehaviour public FaceEmotionKeyTarget FaceEmotionKeyTarget; public FaceOverrideData FaceOverrideData; public GameObject HeadBone; - public GameObject TrackTarget; + public Transform TrackTarget; public float EyeHeight; public bool EnableEyeTracking = true; public Material FaceMaterial; @@ -79,13 +81,18 @@ public class UmaContainer : MonoBehaviour public void Initialize(bool smile) { - TrackTarget = Camera.main.gameObject; + TrackTarget = new GameObject("TrackTarget").transform; + TrackTarget.SetParent(transform); + TrackTarget.position = HeadBone.transform.TransformPoint(0, 0, 10); + UpBodyPosition = UpBodyBone.transform.localPosition; UpBodyRotation = UpBodyBone.transform.localRotation; //Models must be merged before handling extra morphs if (FaceDrivenKeyTarget && smile) FaceDrivenKeyTarget.ChangeMorphWeight(FaceDrivenKeyTarget.MouthMorphs[3], 1); + + CreateIK(); } public void MergeModel() @@ -274,12 +281,23 @@ public class UmaContainer : MonoBehaviour } } + Collider dragCollider; + float dragdistance; + Vector3 dragStartPos; private void FixedUpdate() { if (!IsMini) { if (TrackTarget && EnableEyeTracking && !isAnimatorControl) { + if (!IK.enabled) + { + IK.enabled = true; + if(PuppetMaster.mode != PuppetMaster.Mode.Active) + { + PuppetMaster.mode = PuppetMaster.Mode.Active; + } + } var targetPosotion = TrackTarget.transform.position - HeadBone.transform.up * EyeHeight; var deltaPos = HeadBone.transform.InverseTransformPoint(targetPosotion); var deltaRotation = Quaternion.LookRotation(deltaPos.normalized, HeadBone.transform.up).eulerAngles; @@ -288,6 +306,51 @@ public class UmaContainer : MonoBehaviour var finalRotation = new Vector2(Mathf.Clamp(deltaRotation.y / 35, -1, 1), Mathf.Clamp(-deltaRotation.x / 25, -1, 1));//Limited to the angle of view FaceDrivenKeyTarget.SetEyeRange(finalRotation.x, finalRotation.y, finalRotation.x, -finalRotation.y); + var cam = Camera.main; + var distance = Mathf.Clamp(cam.transform.InverseTransformPoint(HeadBone.transform.position).magnitude - 0.1f, 0, 2); + var mousePos = new Vector3(Input.mousePosition.x, Input.mousePosition.y, distance); + var worldPos = cam.ScreenToWorldPoint(mousePos); + + //Hold D key to Drag Body + if (Input.GetKey(KeyCode.D)) + { + if (dragCollider && dragCollider.attachedRigidbody) + { + dragCollider.attachedRigidbody.isKinematic = true; + dragCollider.transform.position = Vector3.Lerp(dragCollider.transform.position, cam.ScreenToWorldPoint(new Vector3(mousePos.x, mousePos.y, dragdistance)) - dragStartPos, Time.fixedDeltaTime * 4); + //LookAt Mouse when Dragging + TrackTarget.position = Vector3.Lerp(TrackTarget.position, worldPos, Time.fixedDeltaTime * 3); + } + else + { + if (Physics.Raycast(cam.ScreenPointToRay(mousePos), out RaycastHit hit)) + { + dragCollider = hit.collider; + dragStartPos = (hit.point - hit.collider.transform.position); + dragdistance = cam.transform.InverseTransformPoint(hit.point).magnitude; + } + //LookAt Camera + TrackTarget.position = Vector3.Lerp(TrackTarget.position, cam.transform.position, Time.fixedDeltaTime * 3); + } + } + else + { + //LookAt Camera + TrackTarget.position = Vector3.Lerp(TrackTarget.position, cam.transform.position, Time.fixedDeltaTime * 3); + if (dragCollider && dragCollider.attachedRigidbody) dragCollider.attachedRigidbody.isKinematic = false; + dragCollider = null; + } + } + else + { + if (IK.enabled) + { + IK.enabled = false; + if (PuppetMaster.mode != PuppetMaster.Mode.Kinematic) + { + PuppetMaster.mode = PuppetMaster.Mode.Kinematic; + } + } } if (isAnimatorControl) @@ -339,6 +402,49 @@ public class UmaContainer : MonoBehaviour } } + BipedIK IK; + PuppetMaster PuppetMaster; + public void CreateIK() + { + if (IsMini) return; + var container = this; + var animator = container.GetComponent(); + BipedRagdollReferences r = BipedRagdollReferences.FromAvatar(animator); + BipedRagdollCreator.Options options = BipedRagdollCreator.AutodetectOptions(r); + + var ik = container.gameObject.AddComponent(); + ik.references.root = container.transform; + ik.references.pelvis = r.hips; + ik.references.spine = new Transform[] { r.spine, r.chest }; + ik.references.leftThigh = r.leftUpperLeg; + ik.references.leftCalf = r.leftLowerLeg; + ik.references.leftFoot = r.leftFoot; + ik.references.rightThigh = r.rightUpperLeg; + ik.references.rightCalf = r.rightLowerLeg; + ik.references.rightFoot = r.rightFoot; + ik.references.leftUpperArm = r.leftUpperArm; + ik.references.leftForearm = r.leftLowerArm; + ik.references.leftHand = r.leftHand; + ik.references.rightUpperArm = r.rightUpperArm; + ik.references.rightForearm = r.rightLowerArm; + ik.references.rightHand = r.rightHand; + ik.references.head = r.head; + + new List(ik.solvers.ikSolvers).ForEach(i => i.IKPositionWeight = 0); + new List(ik.solvers.limbs).ForEach(i => i.IKRotationWeight = 0); + ik.solvers.lookAt.IKPositionWeight = 1; + ik.solvers.lookAt.headWeight = 0.8f; + ik.solvers.lookAt.bodyWeight = 0.2f; + ik.solvers.lookAt.target = TrackTarget.transform; + IK = ik; + + BipedRagdollCreator.Create(r, options); + PuppetMaster = PuppetMaster.SetUp(container.transform, 8, 9); + PuppetMaster.FlattenHierarchy(); + PuppetMaster.pinWeight = 0.8f; + PuppetMaster.muscleWeight = 0.3f; + } + class MaterialHelper { public Material Mat; diff --git a/Assets/Scripts/UmaViewerBuilder.cs b/Assets/Scripts/UmaViewerBuilder.cs index 018146f..45a61ed 100644 --- a/Assets/Scripts/UmaViewerBuilder.cs +++ b/Assets/Scripts/UmaViewerBuilder.cs @@ -1849,7 +1849,15 @@ public class UmaViewerBuilder : MonoBehaviour { Destroy(t.gameObject); } - Destroy(CurrentUMAContainer.gameObject); + + if(CurrentUMAContainer.transform.parent && CurrentUMAContainer.transform.parent.name.Contains("Root")) + { + Destroy(CurrentUMAContainer.transform.parent.gameObject); + } + else + { + Destroy(CurrentUMAContainer.gameObject); + } } } diff --git a/Assets/Scripts/UmaViewerUI.cs b/Assets/Scripts/UmaViewerUI.cs index aa9da78..d217e8f 100644 --- a/Assets/Scripts/UmaViewerUI.cs +++ b/Assets/Scripts/UmaViewerUI.cs @@ -1323,41 +1323,4 @@ public class UmaViewerUI : MonoBehaviour TextureExporter.exportAllTexture(Builder.CurrentUMAContainer.gameObject); } } - - public void Debug() - { - var container = Builder.CurrentUMAContainer; - if (!container) return; - var animator = container.GetComponent(); - BipedRagdollReferences r = BipedRagdollReferences.FromAvatar(animator); - BipedRagdollCreator.Options options = BipedRagdollCreator.AutodetectOptions(r); - - var ik = container.gameObject.AddComponent(); - ik.references.root = container.transform; - ik.references.pelvis = r.hips; - ik.references.spine = new Transform[] { r.spine, r.chest }; - ik.references.leftThigh = r.leftUpperLeg; - ik.references.leftCalf = r.leftLowerLeg; - ik.references.leftFoot = r.leftFoot; - ik.references.rightThigh = r.rightUpperLeg; - ik.references.rightCalf = r.rightLowerLeg; - ik.references.rightFoot = r.rightFoot; - ik.references.leftUpperArm = r.leftUpperArm; - ik.references.leftForearm = r.leftLowerArm; - ik.references.leftHand = r.leftHand; - ik.references.rightUpperArm = r.rightUpperArm; - ik.references.rightForearm = r.rightLowerArm; - ik.references.rightHand = r.rightHand; - ik.references.head = r.head; - - new List(ik.solvers.ikSolvers).ForEach(i => i.IKPositionWeight = 0); - new List(ik.solvers.limbs).ForEach(i => i.IKRotationWeight = 0); - ik.solvers.lookAt.IKPositionWeight = 1; - ik.solvers.lookAt.headWeight = 0.8f; - ik.solvers.lookAt.bodyWeight = 0.2f; - ik.solvers.lookAt.target = Camera.main.transform; - //BipedRagdollCreator.Create(r, options); - //var master = PuppetMaster.SetUp(container.transform, 8, 9); - //master.FlattenHierarchy(); - } } diff --git a/Assets/Scripts/umamusume/Gallop/FaceDrivenKeyTarget.cs b/Assets/Scripts/umamusume/Gallop/FaceDrivenKeyTarget.cs index e833a7e..2a15558 100644 --- a/Assets/Scripts/umamusume/Gallop/FaceDrivenKeyTarget.cs +++ b/Assets/Scripts/umamusume/Gallop/FaceDrivenKeyTarget.cs @@ -361,6 +361,16 @@ namespace Gallop ApplyRotation(); } + public void ChangeMorphEye() + { + FacialResetEye(); + ProcessMorph(LeftEyeXrange); + ProcessMorph(LeftEyeYrange); + ProcessMorph(RightEyeXrange); + ProcessMorph(RightEyeYrange); + ApplyRotationEye(); + } + public void ClearMorph() { EarMorphs.ForEach(morph => morph.weight = 0); @@ -453,7 +463,7 @@ namespace Gallop public void FacialResetAll() { - if (Container.FaceOverrideData&& Container.FaceOverrideData.Enable) + if (Container.FaceOverrideData && Container.FaceOverrideData.Enable) { OverrideFace(Container.FaceOverrideData); } @@ -467,6 +477,17 @@ namespace Gallop ApplyRotation(); } + public void FacialResetEye() + { + if (Container.FaceOverrideData && Container.FaceOverrideData.Enable) + { + OverrideFace(Container.FaceOverrideData); + } + FacialReset(BaseLEyeMorph.trsArray); + FacialReset(BaseREyeMorph.trsArray); + ApplyRotationEye(); + } + public void FacialReset(List trsArrays) { foreach (TrsArray trs in trsArrays) @@ -500,6 +521,20 @@ namespace Gallop } } + public void ApplyRotationEye() + { + Action> applyRotation = delegate (List trsArray) + { + foreach (TrsArray trs in trsArray) + { + if(trs.transform) + trs.transform.localRotation = RotationConvert.fromMaya(RotationRecorder[trs.transform]); + } + }; + applyRotation.Invoke(BaseLEyeMorph.trsArray); + applyRotation.Invoke(BaseREyeMorph.trsArray); + } + public void ChangeMorphWeight(FacialMorph morph, float val) { Container.isAnimatorControl = false; @@ -520,7 +555,14 @@ namespace Gallop LeftEyeYrange.weight = ly; RightEyeXrange.weight = rx; RightEyeYrange.weight = ry; - ChangeMorph(); + if (Container.FaceOverrideData && Container.FaceOverrideData.Enable) + { + ChangeMorph(); + } + else + { + ChangeMorphEye(); + } } public void ProcessLocator() @@ -618,9 +660,9 @@ namespace Gallop changed = true; } - if (new List(arr.DstArray).Find(f=>f.Index == src) == null) - { - srcmorph.weight = 0; + if (new List(arr.DstArray).Find(f => f.Index == src) == null) + { + srcmorph.weight = 0; } } targetMorph.ForEach(a => a.Invoke()); diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index 4e31a63..638badd 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -74,15 +74,6 @@ }, "url": "https://packages.unity.com" }, - "com.unity.services.core": { - "version": "1.0.1", - "depth": 1, - "source": "registry", - "dependencies": { - "com.unity.modules.unitywebrequest": "1.0.0" - }, - "url": "https://packages.unity.com" - }, "com.unity.test-framework": { "version": "1.1.31", "depth": 0, diff --git a/ProjectSettings/ProjectVersion.txt b/ProjectSettings/ProjectVersion.txt index 495468b..3598ae5 100644 --- a/ProjectSettings/ProjectVersion.txt +++ b/ProjectSettings/ProjectVersion.txt @@ -1,2 +1,2 @@ -m_EditorVersion: 2020.3.24f1 -m_EditorVersionWithRevision: 2020.3.24f1 (79c78de19888) +m_EditorVersion: 2020.3.28f1 +m_EditorVersionWithRevision: 2020.3.28f1 (f5400f52e03f)