From 7fbb2f3bac75bcafd79ba99c16cfd920f0cea3ae Mon Sep 17 00:00:00 2001 From: "Willem-Jan L. van Rootselaar" Date: Tue, 12 Nov 2024 10:17:47 +0100 Subject: [PATCH 001/113] Fix AnimationClipUtility to use empty string for curve path instead of null --- .../Runtime/UniHumanoid/AnimationClipUtility.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Assets/UniGLTF/Runtime/UniHumanoid/AnimationClipUtility.cs b/Assets/UniGLTF/Runtime/UniHumanoid/AnimationClipUtility.cs index 5d06e5f6d..1589b96e8 100644 --- a/Assets/UniGLTF/Runtime/UniHumanoid/AnimationClipUtility.cs +++ b/Assets/UniGLTF/Runtime/UniHumanoid/AnimationClipUtility.cs @@ -61,7 +61,7 @@ namespace UniHumanoid new Keyframe(0, pose.bodyPosition.x), }); var muscle = "RootT.x"; - clip.SetCurve(null, typeof(Animator), muscle, curve); + clip.SetCurve(string.Empty, typeof(Animator), muscle, curve); } { var curve = new AnimationCurve(new Keyframe[] @@ -69,7 +69,7 @@ namespace UniHumanoid new Keyframe(0, pose.bodyPosition.y), }); var muscle = "RootT.y"; - clip.SetCurve(null, typeof(Animator), muscle, curve); + clip.SetCurve(string.Empty, typeof(Animator), muscle, curve); } { var curve = new AnimationCurve(new Keyframe[] @@ -77,7 +77,7 @@ namespace UniHumanoid new Keyframe(0, pose.bodyPosition.z), }); var muscle = "RootT.z"; - clip.SetCurve(null, typeof(Animator), muscle, curve); + clip.SetCurve(string.Empty, typeof(Animator), muscle, curve); } // rot @@ -87,7 +87,7 @@ namespace UniHumanoid new Keyframe(0, pose.bodyRotation.x), }); var muscle = "RootQ.x"; - clip.SetCurve(null, typeof(Animator), muscle, curve); + clip.SetCurve(string.Empty, typeof(Animator), muscle, curve); } { var curve = new AnimationCurve(new Keyframe[] @@ -95,7 +95,7 @@ namespace UniHumanoid new Keyframe(0, pose.bodyRotation.y), }); var muscle = "RootQ.y"; - clip.SetCurve(null, typeof(Animator), muscle, curve); + clip.SetCurve(string.Empty, typeof(Animator), muscle, curve); } { var curve = new AnimationCurve(new Keyframe[] @@ -103,7 +103,7 @@ namespace UniHumanoid new Keyframe(0, pose.bodyRotation.z), }); var muscle = "RootQ.z"; - clip.SetCurve(null, typeof(Animator), muscle, curve); + clip.SetCurve(string.Empty, typeof(Animator), muscle, curve); } { var curve = new AnimationCurve(new Keyframe[] @@ -111,7 +111,7 @@ namespace UniHumanoid new Keyframe(0, pose.bodyRotation.w), }); var muscle = "RootQ.w"; - clip.SetCurve(null, typeof(Animator), muscle, curve); + clip.SetCurve(string.Empty, typeof(Animator), muscle, curve); } // muscles @@ -126,7 +126,7 @@ namespace UniHumanoid { muscle = TraitPropMap[muscle]; } - clip.SetCurve(null, typeof(Animator), muscle, curve); + clip.SetCurve(string.Empty, typeof(Animator), muscle, curve); } return clip; } From 6c1ca756746518617b04d85cd7494ac405b5211d Mon Sep 17 00:00:00 2001 From: Noeri Huisman <8823461+mrxz@users.noreply.github.com> Date: Tue, 12 Nov 2024 21:05:51 +0100 Subject: [PATCH 002/113] Don't log warning when `alphaMode` property is not set on glTFMaterial --- .../Import/Materials/BuiltInVrm10MToonMaterialImporter.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Assets/VRM10/Runtime/IO/Material/BuiltInRP/Import/Materials/BuiltInVrm10MToonMaterialImporter.cs b/Assets/VRM10/Runtime/IO/Material/BuiltInRP/Import/Materials/BuiltInVrm10MToonMaterialImporter.cs index 7e682c69d..2f07ad27b 100644 --- a/Assets/VRM10/Runtime/IO/Material/BuiltInRP/Import/Materials/BuiltInVrm10MToonMaterialImporter.cs +++ b/Assets/VRM10/Runtime/IO/Material/BuiltInRP/Import/Materials/BuiltInVrm10MToonMaterialImporter.cs @@ -244,6 +244,7 @@ namespace UniVRM10 { switch (material?.alphaMode) { + case null: case "OPAQUE": return MToon10AlphaMode.Opaque; case "MASK": From 270fbae1ac5896fe44f79f654e844f5933443a24 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Mon, 18 Nov 2024 14:05:28 +0900 Subject: [PATCH 003/113] avoid runtime exception. editor warning --- .../Editor/SpringBone/VRMSpringBoneEditor.cs | 60 +++++++++++++++++-- .../SpringBone/Logic/SpringBoneSystem.cs | 5 +- .../VRM/Runtime/SpringBone/VRMSpringBone.cs | 2 +- 3 files changed, 59 insertions(+), 8 deletions(-) diff --git a/Assets/VRM/Editor/SpringBone/VRMSpringBoneEditor.cs b/Assets/VRM/Editor/SpringBone/VRMSpringBoneEditor.cs index 68e2027fc..c591ee672 100644 --- a/Assets/VRM/Editor/SpringBone/VRMSpringBoneEditor.cs +++ b/Assets/VRM/Editor/SpringBone/VRMSpringBoneEditor.cs @@ -1,3 +1,6 @@ +using System.Collections.Generic; +using System.Linq; +using UniGLTF; using UnityEditor; using UnityEngine; @@ -9,6 +12,7 @@ namespace VRM { private VRMSpringBone m_target; + private SerializedProperty m_script; private SerializedProperty m_commentProp; private SerializedProperty m_gizmoColorProp; private SerializedProperty m_stiffnessForceProp; @@ -21,6 +25,39 @@ namespace VRM private SerializedProperty m_colliderGroupsProp; private SerializedProperty m_updateTypeProp; + void OnValidate() + { + if (Validate().Any()) + { + m_target.m_gizmoColor = Color.magenta; + } + } + + Dictionary m_rootCount = new(); + + IEnumerable Validate() + { + m_rootCount.Clear(); + foreach (var root in m_target.RootBones) + { + if (m_rootCount.TryGetValue(root, out var count)) + { + m_rootCount[root] = count + 1; + } + else + { + m_rootCount.Add(root, 1); + } + } + foreach (var (k, v) in m_rootCount) + { + if (v > 1) + { + yield return Validation.Error($"Duplicate rootBone: {k} => {v}"); + } + } + } + void OnEnable() { if (target == null) @@ -29,8 +66,9 @@ namespace VRM } m_target = (VRMSpringBone)target; + m_script = serializedObject.FindProperty("m_Script"); m_commentProp = serializedObject.FindProperty(nameof(VRMSpringBone.m_comment)); - m_gizmoColorProp = serializedObject.FindProperty("m_gizmoColor"); + m_gizmoColorProp = serializedObject.FindProperty(nameof(VRMSpringBone.m_gizmoColor)); m_stiffnessForceProp = serializedObject.FindProperty(nameof(VRMSpringBone.m_stiffnessForce)); m_gravityPowerProp = serializedObject.FindProperty(nameof(VRMSpringBone.m_gravityPower)); m_gravityDirProp = serializedObject.FindProperty(nameof(VRMSpringBone.m_gravityDir)); @@ -46,28 +84,38 @@ namespace VRM { serializedObject.Update(); + // header + using (new EditorGUI.DisabledScope(true)) + { + EditorGUILayout.PropertyField(m_script); + } EditorGUILayout.PropertyField(m_commentProp); EditorGUILayout.PropertyField(m_gizmoColorProp); - EditorGUILayout.Space(); + foreach (var validation in Validate()) + { + validation.DrawGUI(); + } + // settings EditorGUILayout.LabelField("Settings", EditorStyles.boldLabel); - LimitBreakSlider(m_stiffnessForceProp, 0.0f, 4.0f, 0.0f, Mathf.Infinity); LimitBreakSlider(m_gravityPowerProp, 0.0f, 2.0f, 0.0f, Mathf.Infinity); EditorGUILayout.PropertyField(m_gravityDirProp); EditorGUILayout.PropertyField(m_dragForceProp); EditorGUILayout.PropertyField(m_centerProp); EditorGUILayout.PropertyField(m_rootBonesProp); - EditorGUILayout.Space(); + // collision EditorGUILayout.LabelField("Collision", EditorStyles.boldLabel); - LimitBreakSlider(m_hitRadiusProp, 0.0f, 0.5f, 0.0f, Mathf.Infinity); EditorGUILayout.PropertyField(m_colliderGroupsProp); - EditorGUILayout.PropertyField(m_updateTypeProp); + EditorGUILayout.Space(); + // runtime + EditorGUILayout.LabelField("Runtime", EditorStyles.boldLabel); + EditorGUILayout.PropertyField(m_updateTypeProp); serializedObject.ApplyModifiedProperties(); } diff --git a/Assets/VRM/Runtime/SpringBone/Logic/SpringBoneSystem.cs b/Assets/VRM/Runtime/SpringBone/Logic/SpringBoneSystem.cs index a44091bf1..a30ca03f2 100644 --- a/Assets/VRM/Runtime/SpringBone/Logic/SpringBoneSystem.cs +++ b/Assets/VRM/Runtime/SpringBone/Logic/SpringBoneSystem.cs @@ -38,7 +38,10 @@ namespace VRM.SpringBone for (int i = 0; i < m_joints.Count; ++i) { - m_jointIndexMap.Add(m_joints[i].Item1, i); + if (!m_jointIndexMap.ContainsKey(m_joints[i].Item1)) + { + m_jointIndexMap.Add(m_joints[i].Item1, i); + } } } diff --git a/Assets/VRM/Runtime/SpringBone/VRMSpringBone.cs b/Assets/VRM/Runtime/SpringBone/VRMSpringBone.cs index 2d8b5f859..f173cbd32 100644 --- a/Assets/VRM/Runtime/SpringBone/VRMSpringBone.cs +++ b/Assets/VRM/Runtime/SpringBone/VRMSpringBone.cs @@ -12,7 +12,7 @@ namespace VRM public sealed class VRMSpringBone : MonoBehaviour { [SerializeField] public string m_comment; - [SerializeField] private Color m_gizmoColor = Color.yellow; + [SerializeField] public Color m_gizmoColor = Color.yellow; [SerializeField] public float m_stiffnessForce = 1.0f; [SerializeField] public float m_gravityPower; [SerializeField] public Vector3 m_gravityDir = new Vector3(0, -1.0f, 0); From ddf438edf7288b221d68daba6cd515557879262d Mon Sep 17 00:00:00 2001 From: ousttrue Date: Mon, 18 Nov 2024 14:15:22 +0900 Subject: [PATCH 004/113] RootBonesNonNullUnique --- .../Runtime/SpringBone/Logic/SpringBoneSystem.cs | 5 +---- Assets/VRM/Runtime/SpringBone/VRMSpringBone.cs | 13 ++++++++++++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Assets/VRM/Runtime/SpringBone/Logic/SpringBoneSystem.cs b/Assets/VRM/Runtime/SpringBone/Logic/SpringBoneSystem.cs index a30ca03f2..a44091bf1 100644 --- a/Assets/VRM/Runtime/SpringBone/Logic/SpringBoneSystem.cs +++ b/Assets/VRM/Runtime/SpringBone/Logic/SpringBoneSystem.cs @@ -38,10 +38,7 @@ namespace VRM.SpringBone for (int i = 0; i < m_joints.Count; ++i) { - if (!m_jointIndexMap.ContainsKey(m_joints[i].Item1)) - { - m_jointIndexMap.Add(m_joints[i].Item1, i); - } + m_jointIndexMap.Add(m_joints[i].Item1, i); } } diff --git a/Assets/VRM/Runtime/SpringBone/VRMSpringBone.cs b/Assets/VRM/Runtime/SpringBone/VRMSpringBone.cs index f173cbd32..30c74ea7a 100644 --- a/Assets/VRM/Runtime/SpringBone/VRMSpringBone.cs +++ b/Assets/VRM/Runtime/SpringBone/VRMSpringBone.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Linq; using UnityEngine; namespace VRM @@ -47,6 +48,16 @@ namespace VRM } [SerializeField] public SpringBoneUpdateType m_updateType = SpringBoneUpdateType.LateUpdate; + List m_rootBonesNonNullUnique = new(); + List RootBonesNonNullUnique + { + get + { + m_rootBonesNonNullUnique.Clear(); + m_rootBonesNonNullUnique.AddRange(RootBones.Where(x => x != null).Distinct()); + return m_rootBonesNonNullUnique; + } + } SpringBone.SpringBoneSystem m_system = new(); void Awake() @@ -55,7 +66,7 @@ namespace VRM } SpringBone.SceneInfo Scene => new( - rootBones: RootBones, + rootBones: RootBonesNonNullUnique, center: m_center, colliderGroups: ColliderGroups, externalForce: ExternalForce); From 84b64c0be28d37a189a648c2ab9a497007ef6ed4 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Mon, 18 Nov 2024 16:30:16 +0900 Subject: [PATCH 005/113] use spring.transformIndexOffset --- .../FastSpringBoneBufferCombiner.cs | 4 - .../FastSpringBoneConbinedBuffer.cs | 93 ++++++++++--------- .../InputPorts/FastSpringBoneBuffer.cs | 12 --- .../FastSpringBoneBufferFactory.cs | 3 +- 4 files changed, 49 insertions(+), 63 deletions(-) diff --git a/Assets/UniGLTF/Runtime/SpringBoneJobs/FastSpringBoneBufferCombiner.cs b/Assets/UniGLTF/Runtime/SpringBoneJobs/FastSpringBoneBufferCombiner.cs index cc4a9da2d..016cbcd96 100644 --- a/Assets/UniGLTF/Runtime/SpringBoneJobs/FastSpringBoneBufferCombiner.cs +++ b/Assets/UniGLTF/Runtime/SpringBoneJobs/FastSpringBoneBufferCombiner.cs @@ -60,10 +60,6 @@ namespace UniGLTF.SpringBoneJobs Profiler.BeginSample("FastSpringBone.ReconstructBuffers.DisposeBuffers"); if (_combinedBuffer is FastSpringBoneCombinedBuffer combined) { - Profiler.BeginSample("FastSpringBone.ReconstructBuffers.SaveToSourceBuffer"); - combined.SaveToSourceBuffer(); - Profiler.EndSample(); - // TODO: Dispose せずに再利用? combined.Dispose(); } diff --git a/Assets/UniGLTF/Runtime/SpringBoneJobs/FastSpringBoneConbinedBuffer.cs b/Assets/UniGLTF/Runtime/SpringBoneJobs/FastSpringBoneConbinedBuffer.cs index d6bd83c05..34410ece7 100644 --- a/Assets/UniGLTF/Runtime/SpringBoneJobs/FastSpringBoneConbinedBuffer.cs +++ b/Assets/UniGLTF/Runtime/SpringBoneJobs/FastSpringBoneConbinedBuffer.cs @@ -97,7 +97,7 @@ namespace UniGLTF.SpringBoneJobs springsCount += buffer.Springs.Length; collidersCount += buffer.Colliders.Length; logicsCount += buffer.Logics.Length; - transformsCount += buffer.BlittableTransforms.Length; + transformsCount += buffer.Transforms.Length; } Profiler.EndSample(); @@ -112,6 +112,23 @@ namespace UniGLTF.SpringBoneJobs private JobHandle Batching(JobHandle handle) { + // TransformAccessArrayの構築 + Profiler.BeginSample("FastSpringBone.ReconstructBuffers.LoadTransformAccessArray"); + var transforms = new Transform[_transforms.Length]; + var transformAccessArrayOffset = 0; + foreach (var buffer in _batchedBuffers) + { + Array.Copy(buffer.Transforms, 0, transforms, transformAccessArrayOffset, buffer.Transforms.Length); + transformAccessArrayOffset += buffer.Transforms.Length; + } + _transformAccessArray = new TransformAccessArray(transforms); + Profiler.EndSample(); + + handle = new PullTransformJob + { + Transforms = Transforms + }.Schedule(TransformAccessArray, handle); + Profiler.BeginSample("FastSpringBone.ReconstructBuffers.ScheduleLoadBufferJobs"); var springsOffset = 0; var collidersOffset = 0; @@ -129,14 +146,6 @@ namespace UniGLTF.SpringBoneJobs _jointMap.Add(buffer.Transforms[head], logicsOffset + j); } - // バッファの読み込みをスケジュール - handle = new LoadTransformsJob - { - SrcTransforms = buffer.BlittableTransforms, - DestTransforms = new NativeSlice(_transforms, transformOffset, - buffer.BlittableTransforms.Length) - }.Schedule(buffer.BlittableTransforms.Length, 1, handle); - handle = new LoadSpringsJob { ModelIndex = i, @@ -165,26 +174,9 @@ namespace UniGLTF.SpringBoneJobs springsOffset += buffer.Springs.Length; collidersOffset += buffer.Colliders.Length; logicsOffset += buffer.Logics.Length; - transformOffset += buffer.BlittableTransforms.Length; + transformOffset += buffer.Transforms.Length; } - handle = InitCurrentTails(handle); - - // TransformAccessArrayの構築と並行してJobを行うため、この時点で走らせておく - JobHandle.ScheduleBatchedJobs(); - Profiler.EndSample(); - - // TransformAccessArrayの構築 - Profiler.BeginSample("FastSpringBone.ReconstructBuffers.LoadTransformAccessArray"); - var transforms = new Transform[_transforms.Length]; - var transformAccessArrayOffset = 0; - foreach (var buffer in _batchedBuffers) - { - Array.Copy(buffer.Transforms, 0, transforms, transformAccessArrayOffset, buffer.Transforms.Length); - transformAccessArrayOffset += buffer.BlittableTransforms.Length; - } - - _transformAccessArray = new TransformAccessArray(transforms); Profiler.EndSample(); return handle; @@ -328,29 +320,36 @@ namespace UniGLTF.SpringBoneJobs #endif private struct InitCurrentTailsJob : IJobParallelFor { + [ReadOnly] public NativeArray Springs; + [ReadOnly] public NativeArray Logics; [ReadOnly] public NativeArray Transforms; - [WriteOnly] public NativeSlice CurrentTails; - [WriteOnly] public NativeSlice PrevTails; - [WriteOnly] public NativeSlice NextTails; + [NativeDisableParallelForRestriction] public NativeSlice CurrentTails; + [NativeDisableParallelForRestriction] public NativeSlice PrevTails; + [NativeDisableParallelForRestriction] public NativeSlice NextTails; - public void Execute(int jointIndex) + public void Execute(int springIndex) { - var tailIndex = Logics[jointIndex].tailTransformIndex; - if (tailIndex == -1) + var spring = Springs[springIndex]; + for (int jointIndex = spring.logicSpan.startIndex; jointIndex < spring.logicSpan.EndIndex; ++jointIndex) { - // tail 無い - var tail = Transforms[Logics[jointIndex].headTransformIndex]; - CurrentTails[jointIndex] = tail.position; - PrevTails[jointIndex] = tail.position; - NextTails[jointIndex] = tail.position; - } - else - { - var tail = Transforms[tailIndex]; - CurrentTails[jointIndex] = tail.position; - PrevTails[jointIndex] = tail.position; - NextTails[jointIndex] = tail.position; + var tailIndex = Logics[jointIndex].tailTransformIndex; + if (tailIndex == -1) + { + // tail 無い + var index = springIndex + Logics[jointIndex].headTransformIndex; + var tail = Transforms[index]; + CurrentTails[jointIndex] = tail.position; + PrevTails[jointIndex] = tail.position; + NextTails[jointIndex] = tail.position; + } + else + { + var tail = Transforms[spring.transformIndexOffset + tailIndex]; + CurrentTails[jointIndex] = tail.position; + PrevTails[jointIndex] = tail.position; + NextTails[jointIndex] = tail.position; + } } } } @@ -365,12 +364,14 @@ namespace UniGLTF.SpringBoneJobs { return new InitCurrentTailsJob { + Springs = Springs, + Logics = Logics, Transforms = Transforms, CurrentTails = CurrentTails, PrevTails = PrevTails, NextTails = NextTails, - }.Schedule(Logics.Length, 1, handle); + }.Schedule(Springs.Length, 1, handle); } public void InitializeJointsLocalRotation(FastSpringBoneBuffer buffer) diff --git a/Assets/UniGLTF/Runtime/SpringBoneJobs/InputPorts/FastSpringBoneBuffer.cs b/Assets/UniGLTF/Runtime/SpringBoneJobs/InputPorts/FastSpringBoneBuffer.cs index 9e9887176..07c0de741 100644 --- a/Assets/UniGLTF/Runtime/SpringBoneJobs/InputPorts/FastSpringBoneBuffer.cs +++ b/Assets/UniGLTF/Runtime/SpringBoneJobs/InputPorts/FastSpringBoneBuffer.cs @@ -22,7 +22,6 @@ namespace UniGLTF.SpringBoneJobs.InputPorts public NativeArray Joints { get; } public NativeArray Colliders { get; } public NativeArray Logics { get; } - public NativeArray BlittableTransforms { get; } public Transform[] Transforms { get; } public bool IsDisposed { get; private set; } @@ -103,16 +102,6 @@ namespace UniGLTF.SpringBoneJobs.InputPorts Joints = new NativeArray(blittableJoints.ToArray(), Allocator.Persistent); Colliders = new NativeArray(blittableColliders.ToArray(), Allocator.Persistent); Logics = new NativeArray(blittableLogics.ToArray(), Allocator.Persistent); - BlittableTransforms = new NativeArray(Transforms.Select(transform => new BlittableTransform - { - position = transform.position, - rotation = transform.rotation, - localPosition = transform.localPosition, - localRotation = transform.localRotation, - localScale = transform.localScale, - localToWorldMatrix = transform.localToWorldMatrix, - worldToLocalMatrix = transform.worldToLocalMatrix - }).ToArray(), Allocator.Persistent); Profiler.EndSample(); } @@ -157,7 +146,6 @@ namespace UniGLTF.SpringBoneJobs.InputPorts IsDisposed = true; Springs.Dispose(); Joints.Dispose(); - BlittableTransforms.Dispose(); Colliders.Dispose(); Logics.Dispose(); } diff --git a/Assets/VRM10/Runtime/Components/Vrm10Runtime/FastSpringBoneBufferFactory.cs b/Assets/VRM10/Runtime/Components/Vrm10Runtime/FastSpringBoneBufferFactory.cs index a6a03f23c..c84f58de0 100644 --- a/Assets/VRM10/Runtime/Components/Vrm10Runtime/FastSpringBoneBufferFactory.cs +++ b/Assets/VRM10/Runtime/Components/Vrm10Runtime/FastSpringBoneBufferFactory.cs @@ -26,6 +26,7 @@ namespace UniVRM10 if (fastSpringBoneBuffer != null) { fastSpringBoneBuffer.Dispose(); + fastSpringBoneBuffer = null; } Func GetOrAddDefaultTransformState = (Transform tf) => @@ -41,7 +42,7 @@ namespace UniVRM10 // create(Spring情報の再収集。設定変更の反映) var springs = vrm.SpringBone.Springs.Select(spring => new FastSpringBoneSpring - { + { center = spring.Center, colliders = spring.ColliderGroups .SelectMany(group => group.Colliders) From 8e259e20dd6898f94355a2bbcbe22406733df420 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Mon, 18 Nov 2024 16:38:17 +0900 Subject: [PATCH 006/113] comment --- .../Runtime/SpringBoneJobs/FastSpringBoneConbinedBuffer.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Assets/UniGLTF/Runtime/SpringBoneJobs/FastSpringBoneConbinedBuffer.cs b/Assets/UniGLTF/Runtime/SpringBoneJobs/FastSpringBoneConbinedBuffer.cs index 34410ece7..e067c07d4 100644 --- a/Assets/UniGLTF/Runtime/SpringBoneJobs/FastSpringBoneConbinedBuffer.cs +++ b/Assets/UniGLTF/Runtime/SpringBoneJobs/FastSpringBoneConbinedBuffer.cs @@ -124,6 +124,7 @@ namespace UniGLTF.SpringBoneJobs _transformAccessArray = new TransformAccessArray(transforms); Profiler.EndSample(); + // Transforms を更新。後続の InitCurrentTails で使う handle = new PullTransformJob { Transforms = Transforms @@ -176,6 +177,10 @@ namespace UniGLTF.SpringBoneJobs logicsOffset += buffer.Logics.Length; transformOffset += buffer.Transforms.Length; } + + // verlet の current, prev, next のバッファを今の transform の状態にする。 + // 速度は 0 にクリアする。 + // TODO: 速度の維持は SaveToSourceBuffer でされていたのだがデータ構造変更で場所が変わった handle = InitCurrentTails(handle); Profiler.EndSample(); @@ -345,7 +350,7 @@ namespace UniGLTF.SpringBoneJobs } else { - var tail = Transforms[spring.transformIndexOffset + tailIndex]; + var tail = Transforms[spring.transformIndexOffset + tailIndex]; CurrentTails[jointIndex] = tail.position; PrevTails[jointIndex] = tail.position; NextTails[jointIndex] = tail.position; From a8bd641bae98fa9c33c6378508a01da7ab13f05f Mon Sep 17 00:00:00 2001 From: ousttrue Date: Mon, 18 Nov 2024 16:44:15 +0900 Subject: [PATCH 007/113] fix tailIndex --- .../FastSpringBoneConbinedBuffer.cs | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/Assets/UniGLTF/Runtime/SpringBoneJobs/FastSpringBoneConbinedBuffer.cs b/Assets/UniGLTF/Runtime/SpringBoneJobs/FastSpringBoneConbinedBuffer.cs index e067c07d4..c126c5e95 100644 --- a/Assets/UniGLTF/Runtime/SpringBoneJobs/FastSpringBoneConbinedBuffer.cs +++ b/Assets/UniGLTF/Runtime/SpringBoneJobs/FastSpringBoneConbinedBuffer.cs @@ -338,23 +338,21 @@ namespace UniGLTF.SpringBoneJobs var spring = Springs[springIndex]; for (int jointIndex = spring.logicSpan.startIndex; jointIndex < spring.logicSpan.EndIndex; ++jointIndex) { - var tailIndex = Logics[jointIndex].tailTransformIndex; - if (tailIndex == -1) + int tailIndex; + if (Logics[jointIndex].tailTransformIndex == -1) { // tail 無い - var index = springIndex + Logics[jointIndex].headTransformIndex; - var tail = Transforms[index]; - CurrentTails[jointIndex] = tail.position; - PrevTails[jointIndex] = tail.position; - NextTails[jointIndex] = tail.position; + tailIndex = spring.transformIndexOffset + Logics[jointIndex].headTransformIndex; } else { - var tail = Transforms[spring.transformIndexOffset + tailIndex]; - CurrentTails[jointIndex] = tail.position; - PrevTails[jointIndex] = tail.position; - NextTails[jointIndex] = tail.position; + tailIndex= spring.transformIndexOffset + Logics[jointIndex].tailTransformIndex; } + + var tail = Transforms[tailIndex]; + CurrentTails[jointIndex] = tail.position; + PrevTails[jointIndex] = tail.position; + NextTails[jointIndex] = tail.position; } } } From 32e004d821dbc3c470d435b43bcf784fc334639f Mon Sep 17 00:00:00 2001 From: ousttrue Date: Tue, 19 Nov 2024 01:50:05 +0900 Subject: [PATCH 008/113] Editor.OnValidate not work --- .../Editor/SpringBone/VRMSpringBoneEditor.cs | 31 ++++++++++++------- .../VRM/Runtime/SpringBone/VRMSpringBone.cs | 2 +- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/Assets/VRM/Editor/SpringBone/VRMSpringBoneEditor.cs b/Assets/VRM/Editor/SpringBone/VRMSpringBoneEditor.cs index c591ee672..5a870b006 100644 --- a/Assets/VRM/Editor/SpringBone/VRMSpringBoneEditor.cs +++ b/Assets/VRM/Editor/SpringBone/VRMSpringBoneEditor.cs @@ -25,18 +25,12 @@ namespace VRM private SerializedProperty m_colliderGroupsProp; private SerializedProperty m_updateTypeProp; - void OnValidate() - { - if (Validate().Any()) - { - m_target.m_gizmoColor = Color.magenta; - } - } - Dictionary m_rootCount = new(); + List m_validation = new(); IEnumerable Validate() { + m_validation.Clear(); m_rootCount.Clear(); foreach (var root in m_target.RootBones) { @@ -53,9 +47,10 @@ namespace VRM { if (v > 1) { - yield return Validation.Error($"Duplicate rootBone: {k} => {v}"); + m_validation.Add(Validation.Error($"Duplicate rootBone: {k} => {v}", ValidationContext.Create(k))); } } + return m_validation; } void OnEnable() @@ -68,7 +63,7 @@ namespace VRM m_script = serializedObject.FindProperty("m_Script"); m_commentProp = serializedObject.FindProperty(nameof(VRMSpringBone.m_comment)); - m_gizmoColorProp = serializedObject.FindProperty(nameof(VRMSpringBone.m_gizmoColor)); + m_gizmoColorProp = serializedObject.FindProperty("m_gizmoColor"); m_stiffnessForceProp = serializedObject.FindProperty(nameof(VRMSpringBone.m_stiffnessForce)); m_gravityPowerProp = serializedObject.FindProperty(nameof(VRMSpringBone.m_gravityPower)); m_gravityDirProp = serializedObject.FindProperty(nameof(VRMSpringBone.m_gravityDir)); @@ -78,6 +73,20 @@ namespace VRM m_hitRadiusProp = serializedObject.FindProperty(nameof(VRMSpringBone.m_hitRadius)); m_colliderGroupsProp = serializedObject.FindProperty(nameof(VRMSpringBone.ColliderGroups)); m_updateTypeProp = serializedObject.FindProperty(nameof(VRMSpringBone.m_updateType)); + + Validate(); + } + + public void OnSceneGUI() + { + foreach (var valiation in m_validation) + { + var t = (Transform)valiation.Context.Context; + if (t != null) + { + Handles.Label(t.position, "duplicate rootBone !"); + } + } } public override void OnInspectorGUI() @@ -92,7 +101,7 @@ namespace VRM EditorGUILayout.PropertyField(m_commentProp); EditorGUILayout.PropertyField(m_gizmoColorProp); EditorGUILayout.Space(); - foreach (var validation in Validate()) + foreach (var validation in m_validation) { validation.DrawGUI(); } diff --git a/Assets/VRM/Runtime/SpringBone/VRMSpringBone.cs b/Assets/VRM/Runtime/SpringBone/VRMSpringBone.cs index 30c74ea7a..75ed5f950 100644 --- a/Assets/VRM/Runtime/SpringBone/VRMSpringBone.cs +++ b/Assets/VRM/Runtime/SpringBone/VRMSpringBone.cs @@ -13,7 +13,7 @@ namespace VRM public sealed class VRMSpringBone : MonoBehaviour { [SerializeField] public string m_comment; - [SerializeField] public Color m_gizmoColor = Color.yellow; + [SerializeField] private Color m_gizmoColor = Color.yellow; [SerializeField] public float m_stiffnessForce = 1.0f; [SerializeField] public float m_gravityPower; [SerializeField] public Vector3 m_gravityDir = new Vector3(0, -1.0f, 0); From a78bf20884a5388492d3d2b4c03544a19611719e Mon Sep 17 00:00:00 2001 From: ousttrue Date: Tue, 19 Nov 2024 03:14:10 +0900 Subject: [PATCH 009/113] =?UTF-8?q?FastSpringBoneBuffer.=5FcurrentTailsBac?= =?UTF-8?q?kup=20=E3=81=A7=E3=83=90=E3=83=83=E3=82=AF=E3=82=A2=E3=83=83?= =?UTF-8?q?=E3=83=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FastSpringBoneBufferCombiner.cs | 23 ++++++- .../FastSpringBoneConbinedBuffer.cs | 69 ++++++------------- .../InputPorts/FastSpringBoneBuffer.cs | 35 ++++++++++ 3 files changed, 76 insertions(+), 51 deletions(-) diff --git a/Assets/UniGLTF/Runtime/SpringBoneJobs/FastSpringBoneBufferCombiner.cs b/Assets/UniGLTF/Runtime/SpringBoneJobs/FastSpringBoneBufferCombiner.cs index 016cbcd96..813d8ae90 100644 --- a/Assets/UniGLTF/Runtime/SpringBoneJobs/FastSpringBoneBufferCombiner.cs +++ b/Assets/UniGLTF/Runtime/SpringBoneJobs/FastSpringBoneBufferCombiner.cs @@ -4,6 +4,7 @@ using Unity.Jobs; using UnityEngine.Profiling; using UniGLTF.SpringBoneJobs.InputPorts; using UnityEngine; +using Unity.Collections; namespace UniGLTF.SpringBoneJobs { @@ -29,9 +30,27 @@ namespace UniGLTF.SpringBoneJobs _isDirty = true; } - public void Unregister(FastSpringBoneBuffer buffer) + public void Unregister(FastSpringBoneBuffer remove) { - _buffers.Remove(buffer); + // index が変わる前に シミュレーションの状態を保存する。 + // 状態の保存場所が BlittableJoint から CurrentTails に移動しているのでここでやる。 + if (_combinedBuffer is FastSpringBoneCombinedBuffer combined) + { + var logicsIndex = 0; + foreach (var buffer in _buffers) + { + if (buffer == remove) + { + // 削除するので skip + // joint の位置が変わる可能性があるので状態を保存せずに速度を0にする方がよい + continue; + } + buffer.BackupCurrentTails(combined.CurrentTails, logicsIndex); + logicsIndex += buffer.Logics.Length; + } + } + + _buffers.Remove(remove); _isDirty = true; } diff --git a/Assets/UniGLTF/Runtime/SpringBoneJobs/FastSpringBoneConbinedBuffer.cs b/Assets/UniGLTF/Runtime/SpringBoneJobs/FastSpringBoneConbinedBuffer.cs index c126c5e95..2e4c578ea 100644 --- a/Assets/UniGLTF/Runtime/SpringBoneJobs/FastSpringBoneConbinedBuffer.cs +++ b/Assets/UniGLTF/Runtime/SpringBoneJobs/FastSpringBoneConbinedBuffer.cs @@ -147,6 +147,9 @@ namespace UniGLTF.SpringBoneJobs _jointMap.Add(buffer.Transforms[head], logicsOffset + j); } + // 速度の維持 + buffer.RestoreCurrentTails(_currentTails, logicsOffset); + handle = new LoadSpringsJob { ModelIndex = i, @@ -205,25 +208,6 @@ namespace UniGLTF.SpringBoneJobs if (_transformAccessArray.isCreated) _transformAccessArray.Dispose(); } - /// - /// バッチングされたバッファから、個々のバッファへと値を戻す - /// Logics to _batchedBuffers[].Logics - /// バッファの再構築前にこの処理を行わないと、揺れの状態がリセットされてしまい、不自然な挙動になる - /// - internal void SaveToSourceBuffer() - { - var logicsIndex = 0; - for (var i = 0; i < _batchedBuffers.Length; ++i) - { - var length = _batchedBufferLogicSizes[i]; - if (!_batchedBuffers[i].IsDisposed && length > 0) - { - NativeArray.Copy(Logics, logicsIndex, _batchedBuffers[i].Logics, 0, length); - } - logicsIndex += length; - } - } - public void FlipBuffer() { var tmp = _prevTails; @@ -248,23 +232,6 @@ namespace UniGLTF.SpringBoneJobs } } -#if ENABLE_SPRINGBONE_BURST - [BurstCompile] -#endif - /// - /// - /// - private struct LoadTransformsJob : IJobParallelFor - { - [ReadOnly] public NativeArray SrcTransforms; - [WriteOnly] public NativeSlice DestTransforms; - - public void Execute(int index) - { - DestTransforms[index] = SrcTransforms[index]; - } - } - #if ENABLE_SPRINGBONE_BURST [BurstCompile] #endif @@ -338,21 +305,25 @@ namespace UniGLTF.SpringBoneJobs var spring = Springs[springIndex]; for (int jointIndex = spring.logicSpan.startIndex; jointIndex < spring.logicSpan.EndIndex; ++jointIndex) { - int tailIndex; - if (Logics[jointIndex].tailTransformIndex == -1) + if (float.IsNaN(CurrentTails[jointIndex].x)) { - // tail 無い - tailIndex = spring.transformIndexOffset + Logics[jointIndex].headTransformIndex; - } - else - { - tailIndex= spring.transformIndexOffset + Logics[jointIndex].tailTransformIndex; - } + // Transsform の現状を使う。velocity を zero にする + int tailIndex; + if (Logics[jointIndex].tailTransformIndex == -1) + { + // tail 無い + tailIndex = spring.transformIndexOffset + Logics[jointIndex].headTransformIndex; + } + else + { + tailIndex = spring.transformIndexOffset + Logics[jointIndex].tailTransformIndex; + } - var tail = Transforms[tailIndex]; - CurrentTails[jointIndex] = tail.position; - PrevTails[jointIndex] = tail.position; - NextTails[jointIndex] = tail.position; + var tail = Transforms[tailIndex]; + CurrentTails[jointIndex] = tail.position; + PrevTails[jointIndex] = tail.position; + NextTails[jointIndex] = tail.position; + } } } } diff --git a/Assets/UniGLTF/Runtime/SpringBoneJobs/InputPorts/FastSpringBoneBuffer.cs b/Assets/UniGLTF/Runtime/SpringBoneJobs/InputPorts/FastSpringBoneBuffer.cs index 07c0de741..c1bf55ffb 100644 --- a/Assets/UniGLTF/Runtime/SpringBoneJobs/InputPorts/FastSpringBoneBuffer.cs +++ b/Assets/UniGLTF/Runtime/SpringBoneJobs/InputPorts/FastSpringBoneBuffer.cs @@ -22,6 +22,7 @@ namespace UniGLTF.SpringBoneJobs.InputPorts public NativeArray Joints { get; } public NativeArray Colliders { get; } public NativeArray Logics { get; } + private NativeArray _currentTailsBackup; public Transform[] Transforms { get; } public bool IsDisposed { get; private set; } @@ -140,6 +141,40 @@ namespace UniGLTF.SpringBoneJobs.InputPorts } } + public void BackupCurrentTails(NativeArray currentTails, int offset) + { + if (!IsDisposed) + { + return; + } + if (Logics.Length == 0) + { + return; + } + if (!_currentTailsBackup.IsCreated) + { + _currentTailsBackup = new(Logics.Length, Allocator.Persistent); + } + NativeArray.Copy(currentTails, offset, _currentTailsBackup, 0, Logics.Length); + } + + public void RestoreCurrentTails(NativeArray currentTails, int offset) + { + if (_currentTailsBackup.IsCreated) + { + NativeArray.Copy(_currentTailsBackup, 0, currentTails, offset, Logics.Length); + } + else + { + var end = offset + Logics.Length; + for (int i = offset; i < end; ++i) + { + // mark velocity zero + currentTails.GetSubArray(offset, Logics.Length).AsSpan().Fill(new Vector3(float.NaN, float.NaN, float.NaN)); + } + } + } + public void Dispose() { if (IsDisposed) return; From e85d332e5650b4c364ad737e7bf0acf8cbfacb55 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Tue, 19 Nov 2024 03:41:07 +0900 Subject: [PATCH 010/113] fix gizmo and assert --- .../FastSpringBoneConbinedBuffer.cs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Assets/UniGLTF/Runtime/SpringBoneJobs/FastSpringBoneConbinedBuffer.cs b/Assets/UniGLTF/Runtime/SpringBoneJobs/FastSpringBoneConbinedBuffer.cs index 2e4c578ea..0e597b70d 100644 --- a/Assets/UniGLTF/Runtime/SpringBoneJobs/FastSpringBoneConbinedBuffer.cs +++ b/Assets/UniGLTF/Runtime/SpringBoneJobs/FastSpringBoneConbinedBuffer.cs @@ -354,9 +354,9 @@ namespace UniGLTF.SpringBoneJobs for (var i = 0; i < _batchedBuffers.Length; ++i) { var length = _batchedBufferLogicSizes[i]; - Debug.Assert(length == buffer.Logics.Length); if (_batchedBuffers[i] == buffer) { + Debug.Assert(length == buffer.Logics.Length); for (var j = 0; j < length; ++j) { var logic = buffer.Logics[j]; @@ -376,22 +376,23 @@ namespace UniGLTF.SpringBoneJobs public void DrawGizmos() { - foreach (var collider in _colliders) - { - collider.DrawGizmo(_transforms[collider.transformIndex]); - } - foreach (var spring in _springs) { + for (int i = spring.colliderSpan.startIndex; i < spring.colliderSpan.EndIndex; ++i) + { + var collider = _colliders[i]; + collider.DrawGizmo(_transforms[spring.transformIndexOffset + collider.transformIndex]); + } + for (int i = spring.logicSpan.startIndex; i < spring.logicSpan.EndIndex; ++i) { var joint = _logics[i]; - joint.DrawGizmo(_transforms[joint.tailTransformIndex], _joints[i]); + joint.DrawGizmo(_transforms[spring.transformIndexOffset + joint.tailTransformIndex], _joints[i]); Gizmos.matrix = Matrix4x4.identity; Gizmos.DrawLine( - _transforms[joint.tailTransformIndex].position, - _transforms[joint.headTransformIndex].position); + _transforms[spring.transformIndexOffset + joint.tailTransformIndex].position, + _transforms[spring.transformIndexOffset + joint.headTransformIndex].position); } } } From 5bda6740ff077b6d49c340597b46be82eb16e7dd Mon Sep 17 00:00:00 2001 From: ousttrue Date: Tue, 19 Nov 2024 03:53:34 +0900 Subject: [PATCH 011/113] =?UTF-8?q?buffer.BackupCurrentTails=20=E3=82=92?= =?UTF-8?q?=20buffer=20=E5=A2=97=E6=B8=9B=E3=81=AE=E7=9B=B4=E5=89=8D?= =?UTF-8?q?=E3=81=AB=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FastSpringBoneBufferCombiner.cs | 70 +++++++++++-------- 1 file changed, 41 insertions(+), 29 deletions(-) diff --git a/Assets/UniGLTF/Runtime/SpringBoneJobs/FastSpringBoneBufferCombiner.cs b/Assets/UniGLTF/Runtime/SpringBoneJobs/FastSpringBoneBufferCombiner.cs index 813d8ae90..a43d5b439 100644 --- a/Assets/UniGLTF/Runtime/SpringBoneJobs/FastSpringBoneBufferCombiner.cs +++ b/Assets/UniGLTF/Runtime/SpringBoneJobs/FastSpringBoneBufferCombiner.cs @@ -5,6 +5,7 @@ using UnityEngine.Profiling; using UniGLTF.SpringBoneJobs.InputPorts; using UnityEngine; using Unity.Collections; +using System.Linq; namespace UniGLTF.SpringBoneJobs { @@ -21,37 +22,17 @@ namespace UniGLTF.SpringBoneJobs private FastSpringBoneCombinedBuffer _combinedBuffer; public FastSpringBoneCombinedBuffer Combined => _combinedBuffer; private readonly LinkedList _buffers = new LinkedList(); - private bool _isDirty; + private Queue<(bool isAdd, FastSpringBoneBuffer buffer)> _request = new(); public bool HasBuffer => _buffers.Count > 0 && _combinedBuffer != null; public void Register(FastSpringBoneBuffer buffer) { - _buffers.AddLast(buffer); - _isDirty = true; + _request.Enqueue((true, buffer)); } - public void Unregister(FastSpringBoneBuffer remove) + public void Unregister(FastSpringBoneBuffer buffer) { - // index が変わる前に シミュレーションの状態を保存する。 - // 状態の保存場所が BlittableJoint から CurrentTails に移動しているのでここでやる。 - if (_combinedBuffer is FastSpringBoneCombinedBuffer combined) - { - var logicsIndex = 0; - foreach (var buffer in _buffers) - { - if (buffer == remove) - { - // 削除するので skip - // joint の位置が変わる可能性があるので状態を保存せずに速度を0にする方がよい - continue; - } - buffer.BackupCurrentTails(combined.CurrentTails, logicsIndex); - logicsIndex += buffer.Logics.Length; - } - } - - _buffers.Remove(remove); - _isDirty = true; + _request.Enqueue((false, buffer)); } /// @@ -59,14 +40,45 @@ namespace UniGLTF.SpringBoneJobs /// public JobHandle ReconstructIfDirty(JobHandle handle) { - if (_isDirty) + if (_request.Count == 0) { - var result = ReconstructBuffers(handle); - _isDirty = false; - return result; + return handle; } - return handle; + if (_combinedBuffer is FastSpringBoneCombinedBuffer combined) + { + // index が変わる前に シミュレーションの状態を保存する。 + // 状態の保存場所が BlittableJoint から CurrentTails に移動しているのでここでやる。 + var logicsIndex = 0; + foreach (var buffer in _buffers) + { + if (_request.Any(x => !x.isAdd && x.buffer == buffer)) + { + // 削除するので skip + continue; + } + buffer.BackupCurrentTails(combined.CurrentTails, logicsIndex); + logicsIndex += buffer.Logics.Length; + } + } + + // buffer 増減 + while (_request.Count > 0) + { + var (isAdd, buffer) = _request.Dequeue(); + if (isAdd) + { + // 速度 0 にする + _buffers.AddLast(buffer); + } + else + { + _buffers.Remove(buffer); + } + } + + // 再構築 + return ReconstructBuffers(handle); } /// From 5ead212afa397ad9b7eeee05d2c41bf66906e2f1 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Tue, 19 Nov 2024 09:53:37 +0900 Subject: [PATCH 012/113] FastSpringBoneBuffer.Dispose --- .../InputPorts/FastSpringBoneBuffer.cs | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/Assets/UniGLTF/Runtime/SpringBoneJobs/InputPorts/FastSpringBoneBuffer.cs b/Assets/UniGLTF/Runtime/SpringBoneJobs/InputPorts/FastSpringBoneBuffer.cs index c1bf55ffb..f17b068f2 100644 --- a/Assets/UniGLTF/Runtime/SpringBoneJobs/InputPorts/FastSpringBoneBuffer.cs +++ b/Assets/UniGLTF/Runtime/SpringBoneJobs/InputPorts/FastSpringBoneBuffer.cs @@ -24,7 +24,6 @@ namespace UniGLTF.SpringBoneJobs.InputPorts public NativeArray Logics { get; } private NativeArray _currentTailsBackup; public Transform[] Transforms { get; } - public bool IsDisposed { get; private set; } /// /// Joint, Collider, Center の Transform のリスト @@ -143,11 +142,7 @@ namespace UniGLTF.SpringBoneJobs.InputPorts public void BackupCurrentTails(NativeArray currentTails, int offset) { - if (!IsDisposed) - { - return; - } - if (Logics.Length == 0) + if (!Logics.IsCreated || Logics.Length == 0) { return; } @@ -177,12 +172,11 @@ namespace UniGLTF.SpringBoneJobs.InputPorts public void Dispose() { - if (IsDisposed) return; - IsDisposed = true; - Springs.Dispose(); - Joints.Dispose(); - Colliders.Dispose(); - Logics.Dispose(); + if (Springs.IsCreated) Springs.Dispose(); + if (Joints.IsCreated) Joints.Dispose(); + if (Colliders.IsCreated) Colliders.Dispose(); + if (Logics.IsCreated) Logics.Dispose(); + if (_currentTailsBackup.IsCreated) _currentTailsBackup.Dispose(); } } } \ No newline at end of file From eed18136be27c08350dfc0bf7e8030d2aa95f003 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Tue, 19 Nov 2024 10:17:30 +0900 Subject: [PATCH 013/113] _nextTailsBackup --- .../FastSpringBoneBufferCombiner.cs | 2 +- .../FastSpringBoneConbinedBuffer.cs | 2 +- .../InputPorts/FastSpringBoneBuffer.cs | 30 ++++++++++--------- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/Assets/UniGLTF/Runtime/SpringBoneJobs/FastSpringBoneBufferCombiner.cs b/Assets/UniGLTF/Runtime/SpringBoneJobs/FastSpringBoneBufferCombiner.cs index a43d5b439..f22112b5e 100644 --- a/Assets/UniGLTF/Runtime/SpringBoneJobs/FastSpringBoneBufferCombiner.cs +++ b/Assets/UniGLTF/Runtime/SpringBoneJobs/FastSpringBoneBufferCombiner.cs @@ -57,7 +57,7 @@ namespace UniGLTF.SpringBoneJobs // 削除するので skip continue; } - buffer.BackupCurrentTails(combined.CurrentTails, logicsIndex); + buffer.BackupCurrentTails(combined.CurrentTails, combined.NextTails, logicsIndex); logicsIndex += buffer.Logics.Length; } } diff --git a/Assets/UniGLTF/Runtime/SpringBoneJobs/FastSpringBoneConbinedBuffer.cs b/Assets/UniGLTF/Runtime/SpringBoneJobs/FastSpringBoneConbinedBuffer.cs index 0e597b70d..ae66220b6 100644 --- a/Assets/UniGLTF/Runtime/SpringBoneJobs/FastSpringBoneConbinedBuffer.cs +++ b/Assets/UniGLTF/Runtime/SpringBoneJobs/FastSpringBoneConbinedBuffer.cs @@ -148,7 +148,7 @@ namespace UniGLTF.SpringBoneJobs } // 速度の維持 - buffer.RestoreCurrentTails(_currentTails, logicsOffset); + buffer.RestoreCurrentTails(_currentTails, _nextTails, logicsOffset); handle = new LoadSpringsJob { diff --git a/Assets/UniGLTF/Runtime/SpringBoneJobs/InputPorts/FastSpringBoneBuffer.cs b/Assets/UniGLTF/Runtime/SpringBoneJobs/InputPorts/FastSpringBoneBuffer.cs index c1bf55ffb..455e17dd6 100644 --- a/Assets/UniGLTF/Runtime/SpringBoneJobs/InputPorts/FastSpringBoneBuffer.cs +++ b/Assets/UniGLTF/Runtime/SpringBoneJobs/InputPorts/FastSpringBoneBuffer.cs @@ -23,8 +23,8 @@ namespace UniGLTF.SpringBoneJobs.InputPorts public NativeArray Colliders { get; } public NativeArray Logics { get; } private NativeArray _currentTailsBackup; + private NativeArray _nextTailsBackup; public Transform[] Transforms { get; } - public bool IsDisposed { get; private set; } /// /// Joint, Collider, Center の Transform のリスト @@ -141,13 +141,9 @@ namespace UniGLTF.SpringBoneJobs.InputPorts } } - public void BackupCurrentTails(NativeArray currentTails, int offset) + public void BackupCurrentTails(NativeArray currentTails, NativeArray nextTails, int offset) { - if (!IsDisposed) - { - return; - } - if (Logics.Length == 0) + if (!Logics.IsCreated || Logics.Length == 0) { return; } @@ -155,14 +151,20 @@ namespace UniGLTF.SpringBoneJobs.InputPorts { _currentTailsBackup = new(Logics.Length, Allocator.Persistent); } + if (!_nextTailsBackup.IsCreated) + { + _nextTailsBackup = new(Logics.Length, Allocator.Persistent); + } NativeArray.Copy(currentTails, offset, _currentTailsBackup, 0, Logics.Length); + NativeArray.Copy(nextTails, offset, _nextTailsBackup, 0, Logics.Length); } - public void RestoreCurrentTails(NativeArray currentTails, int offset) + public void RestoreCurrentTails(NativeArray currentTails, NativeArray nextTails, int offset) { if (_currentTailsBackup.IsCreated) { NativeArray.Copy(_currentTailsBackup, 0, currentTails, offset, Logics.Length); + NativeArray.Copy(_nextTailsBackup, 0, nextTails, offset, Logics.Length); } else { @@ -177,12 +179,12 @@ namespace UniGLTF.SpringBoneJobs.InputPorts public void Dispose() { - if (IsDisposed) return; - IsDisposed = true; - Springs.Dispose(); - Joints.Dispose(); - Colliders.Dispose(); - Logics.Dispose(); + if (Springs.IsCreated) Springs.Dispose(); + if (Joints.IsCreated) Joints.Dispose(); + if (Colliders.IsCreated) Colliders.Dispose(); + if (Logics.IsCreated) Logics.Dispose(); + if (_currentTailsBackup.IsCreated) _currentTailsBackup.Dispose(); + if (_nextTailsBackup.IsCreated) _nextTailsBackup.Dispose(); } } } \ No newline at end of file From bf9c438f1fe131c4317440fe197cfee66a579bef Mon Sep 17 00:00:00 2001 From: ousttrue Date: Tue, 19 Nov 2024 12:58:52 +0900 Subject: [PATCH 014/113] use MonoBehaviour.OnValidate --- .../Editor/SpringBone/VRMSpringBoneEditor.cs | 34 ++----------------- .../VRM/Runtime/SpringBone/VRMSpringBone.cs | 28 +++++++++++++++ 2 files changed, 30 insertions(+), 32 deletions(-) diff --git a/Assets/VRM/Editor/SpringBone/VRMSpringBoneEditor.cs b/Assets/VRM/Editor/SpringBone/VRMSpringBoneEditor.cs index 5a870b006..680bde7c5 100644 --- a/Assets/VRM/Editor/SpringBone/VRMSpringBoneEditor.cs +++ b/Assets/VRM/Editor/SpringBone/VRMSpringBoneEditor.cs @@ -25,34 +25,6 @@ namespace VRM private SerializedProperty m_colliderGroupsProp; private SerializedProperty m_updateTypeProp; - Dictionary m_rootCount = new(); - List m_validation = new(); - - IEnumerable Validate() - { - m_validation.Clear(); - m_rootCount.Clear(); - foreach (var root in m_target.RootBones) - { - if (m_rootCount.TryGetValue(root, out var count)) - { - m_rootCount[root] = count + 1; - } - else - { - m_rootCount.Add(root, 1); - } - } - foreach (var (k, v) in m_rootCount) - { - if (v > 1) - { - m_validation.Add(Validation.Error($"Duplicate rootBone: {k} => {v}", ValidationContext.Create(k))); - } - } - return m_validation; - } - void OnEnable() { if (target == null) @@ -73,13 +45,11 @@ namespace VRM m_hitRadiusProp = serializedObject.FindProperty(nameof(VRMSpringBone.m_hitRadius)); m_colliderGroupsProp = serializedObject.FindProperty(nameof(VRMSpringBone.ColliderGroups)); m_updateTypeProp = serializedObject.FindProperty(nameof(VRMSpringBone.m_updateType)); - - Validate(); } public void OnSceneGUI() { - foreach (var valiation in m_validation) + foreach (var valiation in m_target.Validations) { var t = (Transform)valiation.Context.Context; if (t != null) @@ -101,7 +71,7 @@ namespace VRM EditorGUILayout.PropertyField(m_commentProp); EditorGUILayout.PropertyField(m_gizmoColorProp); EditorGUILayout.Space(); - foreach (var validation in m_validation) + foreach (var validation in m_target.Validations) { validation.DrawGUI(); } diff --git a/Assets/VRM/Runtime/SpringBone/VRMSpringBone.cs b/Assets/VRM/Runtime/SpringBone/VRMSpringBone.cs index 75ed5f950..056224d35 100644 --- a/Assets/VRM/Runtime/SpringBone/VRMSpringBone.cs +++ b/Assets/VRM/Runtime/SpringBone/VRMSpringBone.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Linq; +using UniGLTF; using UnityEngine; namespace VRM @@ -60,6 +61,33 @@ namespace VRM } SpringBone.SpringBoneSystem m_system = new(); + Dictionary m_rootCount = new(); + List m_validations = new(); + public List Validations => m_validations; + public void OnValidate() + { + Validations.Clear(); + m_rootCount.Clear(); + foreach (var root in RootBones) + { + if (m_rootCount.TryGetValue(root, out var count)) + { + m_rootCount[root] = count + 1; + } + else + { + m_rootCount.Add(root, 1); + } + } + foreach (var (k, v) in m_rootCount) + { + if (v > 1) + { + Validations.Add(Validation.Error($"Duplicate rootBone: {k} => {v}", ValidationContext.Create(k))); + } + } + } + void Awake() { Setup(); From c983367f40849d5d3604a9f8be685b3c7709c9fe Mon Sep 17 00:00:00 2001 From: ousttrue Date: Tue, 19 Nov 2024 13:15:55 +0900 Subject: [PATCH 015/113] update comment --- .../FastSpringBoneConbinedBuffer.cs | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/Assets/UniGLTF/Runtime/SpringBoneJobs/FastSpringBoneConbinedBuffer.cs b/Assets/UniGLTF/Runtime/SpringBoneJobs/FastSpringBoneConbinedBuffer.cs index ae66220b6..f06f3f70a 100644 --- a/Assets/UniGLTF/Runtime/SpringBoneJobs/FastSpringBoneConbinedBuffer.cs +++ b/Assets/UniGLTF/Runtime/SpringBoneJobs/FastSpringBoneConbinedBuffer.cs @@ -181,9 +181,6 @@ namespace UniGLTF.SpringBoneJobs transformOffset += buffer.Transforms.Length; } - // verlet の current, prev, next のバッファを今の transform の状態にする。 - // 速度は 0 にクリアする。 - // TODO: 速度の維持は SaveToSourceBuffer でされていたのだがデータ構造変更で場所が変わった handle = InitCurrentTails(handle); Profiler.EndSample(); @@ -328,12 +325,21 @@ namespace UniGLTF.SpringBoneJobs } } - /// - /// Transform から currentTail を更新。 - /// prevTail も同じ内容にする(速度0)。 + /// + /// # CurrentTails[i] == NAN + /// + /// Transforms から Current, Prev, Next を代入する。 + /// 速度 0 で初期化することになる。 + /// + /// # CurrentTails[i] != NAN + /// + /// 本処理はスキップされて Current, Next の利用が継続されます。 + /// + /// # NAN + /// + /// Batching 関数内の FastSpringBoneBuffer.RestoreCurrentTails にて backup の Current, Next が無かったときに + /// 目印として NAN が代入されます。 /// - /// - /// public JobHandle InitCurrentTails(JobHandle handle) { return new InitCurrentTailsJob From bbcb74c4ed012dbc1668cb5a2dd93c2b06a39360 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Thu, 17 Oct 2024 19:01:07 +0900 Subject: [PATCH 016/113] init cloth dev --- Assets/VRM10_Samples/ClothSample.meta | 8 + .../ClothSample/RotateParticle.meta | 8 + .../RotateParticle/RotateParticle.asmdef | 16 + .../RotateParticle/RotateParticle.asmdef.meta | 7 + .../ClothSample/RotateParticle/Runtime.meta | 8 + .../RotateParticle/Runtime/FrameTime.cs | 13 + .../RotateParticle/Runtime/FrameTime.cs.meta | 11 + .../Runtime/HumanoidAutoSetup.cs | 233 +++ .../Runtime/HumanoidAutoSetup.cs.meta | 11 + .../RotateParticle/Runtime/HumanoidPose.cs | 59 + .../Runtime/HumanoidPose.cs.meta | 11 + .../Runtime/ParticleInitState.cs | 49 + .../Runtime/ParticleInitState.cs.meta | 11 + .../RotateParticle/Runtime/ParticleJob.cs | 81 + .../Runtime/ParticleJob.cs.meta | 11 + .../RotateParticle/Runtime/ParticleList.cs | 95 + .../Runtime/ParticleList.cs.meta | 11 + .../Runtime/ParticleRuntimeState.cs | 42 + .../Runtime/ParticleRuntimeState.cs.meta | 11 + .../RotateParticle/Runtime/RigidTransform.cs | 22 + .../Runtime/RigidTransform.cs.meta | 11 + .../RotateParticle/Runtime/RotateParticle.cs | 125 ++ .../Runtime/RotateParticle.cs.meta | 11 + .../Runtime/RotateParticleSystem.cs | 363 ++++ .../Runtime/RotateParticleSystem.cs.meta | 11 + .../RotateParticle/Runtime/SimulationEnv.cs | 18 + .../Runtime/SimulationEnv.cs.meta | 11 + .../Runtime/SpringConstraint.cs | 41 + .../Runtime/SpringConstraint.cs.meta | 11 + .../RotateParticle/Runtime/Strand.cs | 165 ++ .../RotateParticle/Runtime/Strand.cs.meta | 11 + .../ClothSample/RotateParticle/Scenes.meta | 8 + .../RotateParticle/Scenes/sample.unity | 1756 +++++++++++++++++ .../RotateParticle/Scenes/sample.unity.meta | 7 + .../ClothSample/SphereTriangle.meta | 8 + .../ClothSample/SphereTriangle/CapsuleInfo.cs | 117 ++ .../SphereTriangle/CapsuleInfo.cs.meta | 11 + .../SphereTriangle/ClothRectCollision.cs | 244 +++ .../SphereTriangle/ClothRectCollision.cs.meta | 11 + .../SphereTriangle/ColliderGroup.cs | 16 + .../SphereTriangle/ColliderGroup.cs.meta | 11 + .../ClothSample/SphereTriangle/FrameRate.cs | 20 + .../SphereTriangle/FrameRate.cs.meta | 11 + .../SphereTriangle/LineDistanceGizmo.cs | 58 + .../SphereTriangle/LineDistanceGizmo.cs.meta | 11 + .../ClothSample/SphereTriangle/LineSegment.cs | 160 ++ .../SphereTriangle/LineSegment.cs.meta | 11 + .../SphereTriangle/PositionList.cs | 103 + .../SphereTriangle/PositionList.cs.meta | 11 + .../SphereTriangle/ProfileSample.cs | 21 + .../SphereTriangle/ProfileSample.cs.meta | 11 + .../SphereTriangle/SphereCapsuleCollider.cs | 176 ++ .../SphereCapsuleCollider.cs.meta | 11 + .../SphereTriangle/SphereTriangle.asmdef | 14 + .../SphereTriangle/SphereTriangle.asmdef.meta | 7 + .../ClothSample/SphereTriangle/StrandGroup.cs | 73 + .../SphereTriangle/StrandGroup.cs.meta | 11 + .../SphereTriangle/TransformSort.cs | 40 + .../SphereTriangle/TransformSort.cs.meta | 11 + .../ClothSample/SphereTriangle/Triangle.cs | 285 +++ .../SphereTriangle/Triangle.cs.meta | 11 + .../TriangleCapsuleCollisionSolver.cs | 366 ++++ .../TriangleCapsuleCollisionSolver.cs.meta | 11 + .../SphereTriangle/TriangleCapsuleGizmo.cs | 64 + .../TriangleCapsuleGizmo.cs.meta | 11 + 65 files changed, 5193 insertions(+) create mode 100644 Assets/VRM10_Samples/ClothSample.meta create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle.meta create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/RotateParticle.asmdef create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/RotateParticle.asmdef.meta create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime.meta create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/FrameTime.cs create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/FrameTime.cs.meta create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/HumanoidAutoSetup.cs create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/HumanoidAutoSetup.cs.meta create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/HumanoidPose.cs create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/HumanoidPose.cs.meta create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleInitState.cs create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleInitState.cs.meta create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleJob.cs create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleJob.cs.meta create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleList.cs create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleList.cs.meta create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleRuntimeState.cs create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleRuntimeState.cs.meta create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RigidTransform.cs create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RigidTransform.cs.meta create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticle.cs create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticle.cs.meta create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs.meta create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SimulationEnv.cs create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SimulationEnv.cs.meta create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SpringConstraint.cs create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SpringConstraint.cs.meta create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Strand.cs create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Strand.cs.meta create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Scenes.meta create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Scenes/sample.unity create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Scenes/sample.unity.meta create mode 100644 Assets/VRM10_Samples/ClothSample/SphereTriangle.meta create mode 100644 Assets/VRM10_Samples/ClothSample/SphereTriangle/CapsuleInfo.cs create mode 100644 Assets/VRM10_Samples/ClothSample/SphereTriangle/CapsuleInfo.cs.meta create mode 100644 Assets/VRM10_Samples/ClothSample/SphereTriangle/ClothRectCollision.cs create mode 100644 Assets/VRM10_Samples/ClothSample/SphereTriangle/ClothRectCollision.cs.meta create mode 100644 Assets/VRM10_Samples/ClothSample/SphereTriangle/ColliderGroup.cs create mode 100644 Assets/VRM10_Samples/ClothSample/SphereTriangle/ColliderGroup.cs.meta create mode 100644 Assets/VRM10_Samples/ClothSample/SphereTriangle/FrameRate.cs create mode 100644 Assets/VRM10_Samples/ClothSample/SphereTriangle/FrameRate.cs.meta create mode 100644 Assets/VRM10_Samples/ClothSample/SphereTriangle/LineDistanceGizmo.cs create mode 100644 Assets/VRM10_Samples/ClothSample/SphereTriangle/LineDistanceGizmo.cs.meta create mode 100644 Assets/VRM10_Samples/ClothSample/SphereTriangle/LineSegment.cs create mode 100644 Assets/VRM10_Samples/ClothSample/SphereTriangle/LineSegment.cs.meta create mode 100644 Assets/VRM10_Samples/ClothSample/SphereTriangle/PositionList.cs create mode 100644 Assets/VRM10_Samples/ClothSample/SphereTriangle/PositionList.cs.meta create mode 100644 Assets/VRM10_Samples/ClothSample/SphereTriangle/ProfileSample.cs create mode 100644 Assets/VRM10_Samples/ClothSample/SphereTriangle/ProfileSample.cs.meta create mode 100644 Assets/VRM10_Samples/ClothSample/SphereTriangle/SphereCapsuleCollider.cs create mode 100644 Assets/VRM10_Samples/ClothSample/SphereTriangle/SphereCapsuleCollider.cs.meta create mode 100644 Assets/VRM10_Samples/ClothSample/SphereTriangle/SphereTriangle.asmdef create mode 100644 Assets/VRM10_Samples/ClothSample/SphereTriangle/SphereTriangle.asmdef.meta create mode 100644 Assets/VRM10_Samples/ClothSample/SphereTriangle/StrandGroup.cs create mode 100644 Assets/VRM10_Samples/ClothSample/SphereTriangle/StrandGroup.cs.meta create mode 100644 Assets/VRM10_Samples/ClothSample/SphereTriangle/TransformSort.cs create mode 100644 Assets/VRM10_Samples/ClothSample/SphereTriangle/TransformSort.cs.meta create mode 100644 Assets/VRM10_Samples/ClothSample/SphereTriangle/Triangle.cs create mode 100644 Assets/VRM10_Samples/ClothSample/SphereTriangle/Triangle.cs.meta create mode 100644 Assets/VRM10_Samples/ClothSample/SphereTriangle/TriangleCapsuleCollisionSolver.cs create mode 100644 Assets/VRM10_Samples/ClothSample/SphereTriangle/TriangleCapsuleCollisionSolver.cs.meta create mode 100644 Assets/VRM10_Samples/ClothSample/SphereTriangle/TriangleCapsuleGizmo.cs create mode 100644 Assets/VRM10_Samples/ClothSample/SphereTriangle/TriangleCapsuleGizmo.cs.meta diff --git a/Assets/VRM10_Samples/ClothSample.meta b/Assets/VRM10_Samples/ClothSample.meta new file mode 100644 index 000000000..f64df945b --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6871c022e581b3742bbc892f38900607 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle.meta new file mode 100644 index 000000000..453904a79 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a00a3e7f5bad4ae4cbbf0e2acc739fa8 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/RotateParticle.asmdef b/Assets/VRM10_Samples/ClothSample/RotateParticle/RotateParticle.asmdef new file mode 100644 index 000000000..023d57489 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/RotateParticle.asmdef @@ -0,0 +1,16 @@ +{ + "name": "RotateParticle", + "rootNamespace": "", + "references": [ + "GUID:0138a2c7639266f45b948ea162125de5" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": false, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/RotateParticle.asmdef.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/RotateParticle.asmdef.meta new file mode 100644 index 000000000..8aae2c5d4 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/RotateParticle.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 308b348fb80d89d42a9620951b0f60db +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime.meta new file mode 100644 index 000000000..5fa557c3f --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2ba7e498c4d5eef44aba4cf125686089 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/FrameTime.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/FrameTime.cs new file mode 100644 index 000000000..6a998a38f --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/FrameTime.cs @@ -0,0 +1,13 @@ +namespace RotateParticle +{ + public struct FrameTime + { + public readonly float DeltaTime; + public readonly float SqDt; + public FrameTime(float deltaTime) + { + DeltaTime = deltaTime; + SqDt = deltaTime * deltaTime; + } + } +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/FrameTime.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/FrameTime.cs.meta new file mode 100644 index 000000000..be6af65f6 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/FrameTime.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 568e5702a44c18d4487775441e011a61 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/HumanoidAutoSetup.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/HumanoidAutoSetup.cs new file mode 100644 index 000000000..622a34a78 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/HumanoidAutoSetup.cs @@ -0,0 +1,233 @@ +using System.Collections.Generic; +using System.Linq; +using SphereTriangle; +using UnityEngine; + + +namespace RotateParticle +{ + public class HumanoidAutoSetup : MonoBehaviour + { + static (string group, HumanBodyBones head, HumanBodyBones tail, float radius)[] Capsules = new[] + { + ("Leg", HumanBodyBones.LeftUpperLeg, HumanBodyBones.LeftLowerLeg, 0.06f), + ("Leg", HumanBodyBones.LeftLowerLeg, HumanBodyBones.LeftFoot, 0.05f), + ("Leg", HumanBodyBones.RightUpperLeg, HumanBodyBones.RightLowerLeg, 0.06f), + ("Leg", HumanBodyBones.RightLowerLeg, HumanBodyBones.RightFoot, 0.05f), + + ("Arm", HumanBodyBones.LeftUpperArm, HumanBodyBones.LeftLowerArm, 0.03f), + ("Arm", HumanBodyBones.LeftLowerArm, HumanBodyBones.LeftHand, 0.03f), + ("Arm", HumanBodyBones.LeftHand, HumanBodyBones.LeftMiddleProximal, 0.02f), + ("Arm", HumanBodyBones.RightUpperArm, HumanBodyBones.RightLowerArm, 0.03f), + ("Arm", HumanBodyBones.RightLowerArm, HumanBodyBones.RightHand, 0.03f), + ("Arm", HumanBodyBones.RightHand, HumanBodyBones.RightMiddleProximal, 0.02f), + }; + + T GetOrAddComponent() where T : Component + { + var t = GetComponent(); + if (t != null) + { + return t; + } + return gameObject.AddComponent(); + } + + bool TryAddGroup(CollisionGroupMask mask, string name, Animator animator, HumanBodyBones humanBone, string[] targets, StrandConnectionType type, + out StrandGroup group) + { + var bone = animator.GetBoneTransform(humanBone); + if (bone == null) + { + Debug.LogWarning($"{humanBone} not found"); + group = default; + return false; + } + + List transforms = new(); + foreach (Transform child in bone) + { + foreach (var target in targets) + { + if (child.name.ToLower().Contains(target.ToLower())) + { + transforms.Add(child); + break; + } + } + } + if (transforms.Count == 0) + { + Debug.LogWarning($"{string.Join(',', targets)} not found"); + group = default; + return false; + } + + group = new StrandGroup + { + Name = name, + CollisionMask = mask, + DefaultStrandRaius = 0.02f, + Connection = type + }; + group.Roots.AddRange(transforms); + + // sort + group.Roots.Sort(new TransformSort(bone.position)); + return true; + } + + bool TryAddGroupChildChild(CollisionGroupMask mask, string name, Animator animator, HumanBodyBones humanBone, + string[] targets, string[] excludes, + StrandConnectionType type, + bool sort, + out StrandGroup group) + { + var bone = animator.GetBoneTransform(humanBone); + if (bone == null) + { + Debug.LogWarning($"{humanBone} not found"); + group = default; + return false; + } + + List transforms = new(); + foreach (Transform child in bone) + { + foreach (Transform childchild in child) + { + if (excludes.Any(x => childchild.name.ToLower().Contains(x.ToLower()))) + { + continue; + } + + foreach (var target in targets) + { + if (childchild.name.ToLower().Contains(target.ToLower())) + { + transforms.Add(childchild); + break; + } + } + } + } + if (transforms.Count == 0) + { + Debug.LogWarning($"{string.Join(',', targets)} not found"); + group = default; + return false; + } + + group = new StrandGroup + { + Name = name, + CollisionMask = mask, + DefaultStrandRaius = 0.02f, + Connection = type + }; + group.Roots.AddRange(transforms); + + // sort + if (sort) + { + group.Roots.Sort(new TransformSort(bone.position)); + } + return true; + } + + public void Reset() + { + var animator = GetComponent(); + if (animator == null) + { + Debug.LogWarning("no animator"); + return; + } + var avatar = animator.avatar; + if (!avatar.isHuman) + { + Debug.LogWarning("not humanoid"); + return; + } + + var system = GetOrAddComponent(); + system.Env.DragForce = 0.6f; + system.Env.Stiffness = 0.07f; + + foreach (var (group, head, tail, radius) in Capsules) + { + system.AddColliderIfNotExists(group, + animator.GetBoneTransform(head), animator.GetBoneTransform(tail), radius); + } + + // skirt + { + if (TryAddGroup(CollisionGroupMask.Group01, "Skirt", animator, HumanBodyBones.Hips, new[] { "skirt", "スカート", "スカート" }, StrandConnectionType.ClothLoop, + out var g)) + { + system._strandGroups.Add(g); + } + } + { + if (TryAddGroupChildChild(CollisionGroupMask.Group01, "Skirt", animator, HumanBodyBones.Hips, new[] { "skirt", "スカート", "スカート" }, new string[]{}, StrandConnectionType.ClothLoop, false, + out var g)) + { + system._strandGroups.Add(g); + } + } + { + if (TryAddGroup(CollisionGroupMask.Group02, "髪", animator, HumanBodyBones.Head, new[] { "髪", "hair" }, StrandConnectionType.Strand, + out var g)) + { + system._strandGroups.Add(g); + } + } + { + if (TryAddGroup(CollisionGroupMask.Group01, "裾", animator, HumanBodyBones.Hips, new[] { "裾" }, StrandConnectionType.Cloth, + out var g)) + { + system._strandGroups.Add(g); + } + } + { + if (TryAddGroupChildChild(CollisionGroupMask.Group02, "左袖", animator, HumanBodyBones.LeftUpperArm, new[] { "袖" }, new[] { "ひじ袖" }, StrandConnectionType.ClothLoop, + false, + out var g)) + { + system._strandGroups.Add(g); + } + } + { + if (TryAddGroupChildChild(CollisionGroupMask.Group02, "左ひじ袖", animator, HumanBodyBones.LeftLowerArm, new[] { "袖" }, new string[] { }, StrandConnectionType.ClothLoop, + false, + out var g)) + { + system._strandGroups.Add(g); + } + } + { + if (TryAddGroupChildChild(CollisionGroupMask.Group02, "右袖", animator, HumanBodyBones.RightUpperArm, new[] { "袖" }, new[] { "ひじ袖" }, StrandConnectionType.ClothLoop, + false, + out var g)) + { + system._strandGroups.Add(g); + } + } + { + if (TryAddGroupChildChild(CollisionGroupMask.Group02, "右ひじ袖", animator, HumanBodyBones.RightLowerArm, new[] { "袖" }, new string[] { }, StrandConnectionType.ClothLoop, + false, + out var g)) + { + system._strandGroups.Add(g); + } + } + { + if (TryAddGroup(CollisionGroupMask.Group01 | CollisionGroupMask.Group02, "マント", animator, HumanBodyBones.Chest, new[] { "マント" }, StrandConnectionType.Cloth, + out var g)) + { + system._strandGroups.Add(g); + } + } + } + } +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/HumanoidAutoSetup.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/HumanoidAutoSetup.cs.meta new file mode 100644 index 000000000..7bc096b42 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/HumanoidAutoSetup.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f2c23a62e016b3244b286404bc339540 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/HumanoidPose.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/HumanoidPose.cs new file mode 100644 index 000000000..56362c7d3 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/HumanoidPose.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; + +namespace RotateParticle +{ + public class HumanoidPose + { + public Vector3 HipsPosition; + public List<(HumanBodyBones, Quaternion)> Rotations = new(); + + public HumanoidPose(Animator aninmator) + { + foreach (HumanBodyBones bone in Enum.GetValues(typeof(HumanBodyBones))) + { + if (bone == HumanBodyBones.LastBone) + { + continue; + } + var t = aninmator.GetBoneTransform(bone); + if (t != null) + { + if (bone == HumanBodyBones.Hips) + { + HipsPosition = t.localPosition; + } + Rotations.Add((bone, t.localRotation)); + } + } + } + + public static void ApplyLerp(Animator a, HumanoidPose start, HumanoidPose end, float t) + { + foreach (var (b, sr, er) in Enumerable.Zip(start.Rotations, end.Rotations, (s, e) => + { + var (sb, sr) = s; + var (eb, er) = e; + if (sb != eb) + { + throw new Exception(); + } + return (sb, sr, er); + })) + { + var transform = a.GetBoneTransform(b); + if (transform == null) + { + throw new Exception(); + } + transform.localRotation = Quaternion.Slerp(sr, er, t); + if (b == HumanBodyBones.Hips) + { + transform.localPosition = Vector3.Lerp(start.HipsPosition, end.HipsPosition, t); + } + } + } + } +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/HumanoidPose.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/HumanoidPose.cs.meta new file mode 100644 index 000000000..cdf78bb99 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/HumanoidPose.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 500c97fb71417394e8144b008b462e6c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleInitState.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleInitState.cs new file mode 100644 index 000000000..48c2f897b --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleInitState.cs @@ -0,0 +1,49 @@ +using System; +using SphereTriangle; +using UnityEngine; + +namespace RotateParticle +{ + [Serializable] + public struct ParticleInitState + { + public readonly int Index; + + [SerializeField] + public Vector3 LocalPosition; + [SerializeField] + public Quaternion LocalRotation; + + [SerializeField] + public Vector3 BoneAxis; + + [SerializeField] + public float StrandLength; + + [SerializeField] + public float Radius; + + // 0 は移動しない固定(回転はしてもよい) + // TODO: force / mass => accelaration + public float Mass; + + public CollisionGroupMask CollisionMask; + + public ParticleInitState(int index, Transform t, float radius, float mass, CollisionGroupMask collisionMask) + { + Index = index; + LocalPosition = t.localPosition; + LocalRotation = t.localRotation; + StrandLength = LocalPosition.magnitude; + BoneAxis = LocalPosition.normalized; + Radius = radius; + Mass = mass; + CollisionMask = collisionMask; + } + + public override string ToString() + { + return $"create Particle: {LocalPosition}, {BoneAxis}, {StrandLength}"; + } + } +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleInitState.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleInitState.cs.meta new file mode 100644 index 000000000..d4999be02 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleInitState.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4bccf867d0bc7b244841c8ecff9ce65a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleJob.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleJob.cs new file mode 100644 index 000000000..0b235f0c2 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleJob.cs @@ -0,0 +1,81 @@ +using Unity.Collections; +using Unity.Jobs; +using UnityEngine; + +namespace RotateParticle +{ + public struct ParticleJob : IJob + { + public float DeltaTime; + public float Stiffness; + public float DragForce; + public Vector3 External; + + public int Index; + public int ParentIndex; + + public float Mass; + public Vector3 Rest; + public Vector3 CurrentPosition; + public Vector3 Prev; + + public Quaternion ParentParentRotation; + public Quaternion InitParentLocalRotation; + public Vector3 InitBoneAxis; + public Vector3 ParentPosition; + + public NativeArray NewPos; + public NativeArray NewRot; + + public void Execute() + { + var tr = Step(); + if (tr.HasValue) + { + var (newPos, parentRot) = tr.Value; + NewPos[Index] = newPos; + NewRot[ParentIndex] = parentRot; + } + } + + public (Vector3 NewPos, Quaternion ParentRotation)? Step() + { + if (Mass == 0) + { + return default; + } + + var sqDt = DeltaTime * DeltaTime; + + var f = (Rest - CurrentPosition) * Stiffness / sqDt; + // Debug.Log($"{rest}"); + + f += (External / sqDt); + + var newPos = CurrentPosition + (CurrentPosition - Prev) * (1 - DragForce) + f * sqDt; + + var parentRotation = CalcParentRotation(newPos, ParentParentRotation, InitParentLocalRotation, InitBoneAxis, ParentPosition); + + return (newPos, parentRotation); + } + + public static Quaternion CalcParentRotation(in Vector3 newPos, + in Quaternion parentparent, + in Quaternion initParentLocalRotation, + in Vector3 initBoneAxis, + in Vector3 parentPosition) + { + // 親の回転として結果を適用する(位置から回転を作る) + var restRotation = parentparent * initParentLocalRotation; + var r = CalcRotation(restRotation, initBoneAxis, newPos - parentPosition); + // _runtime = new ParticleRuntimeState(_runtime.CurrentPosition, transform.position); + return r; + } + + static Quaternion CalcRotation(Quaternion restRotation, Vector3 boneAxis, Vector3 to) + { + Quaternion aimRotation = Quaternion.FromToRotation(restRotation * boneAxis, to); + return aimRotation * restRotation; + } + } +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleJob.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleJob.cs.meta new file mode 100644 index 000000000..08d8ff997 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleJob.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7127f077eba307343a5f5ce15213a595 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleList.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleList.cs new file mode 100644 index 000000000..de7babbed --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleList.cs @@ -0,0 +1,95 @@ +using System; +using System.Collections.Generic; +using SphereTriangle; +using UnityEngine; + + +namespace RotateParticle +{ + [Serializable] + public class ParticleList + { + public List _particles = new(); + public List _particleTransforms = new(); + + public Strand MakeParticleStrand(SimulationEnv env, Transform t, float radius, CollisionGroupMask mask) + { + var strand = new Strand(mask); + _MakeParticlesRecursive(strand, env, 0, t, radius, null); + return strand; + } + + RotateParticle _MakeParticlesRecursive(Strand strand, SimulationEnv env, int child_index, Transform t, float radius, RotateParticle parent) + { + var mass = parent == null ? 0 : 1; + if (child_index > 0) + { + // 枝分かれ動かない + mass = 0; + } + + var particle_index = _MakeAParticle(env, t, radius, parent, mass, strand.CollisionMask); + var joint = _particles[particle_index]; + strand.Particles.Add(joint); + for (int i = 0; i < t.childCount; ++i) + { + var child = t.GetChild(i); + var child_joint = _MakeParticlesRecursive(strand, env, i, child, radius, joint); + joint.Children.Add(child_joint); + } + return joint; + } + + int _MakeAParticle(SimulationEnv env, Transform t, float radius, RotateParticle parent, float mass, CollisionGroupMask collisionMask) + { + var index = _particles.Count; + _particleTransforms.Add(t); + _particles.Add(new RotateParticle(index, parent, env, t, radius, mass, collisionMask)); + return index; + } + + public void EndInitialize(SphereTriangle.InitPosition initPos) + { + for (int i = 0; i < _particles.Count; ++i) + { + initPos(i, _particles[i].Init.Mass, _particleTransforms[i].position); + } + } + + public void BeginFrame(SimulationEnv env, FrameTime time, IReadOnlyList restPositions) + { + for (int i = 0; i < _particles.Count; ++i) + { + var p = _particles[i]; + if (p.Init.Mass <= 0) + { + continue; + } + + var rest = restPositions[p.Init.Index]; + p.BeginFrame(env, time, rest); + } + } + + public void Verlet(SimulationEnv env, FrameTime time, SphereTriangle.InitPosition initPos) + { + for (int i = 0; i < _particles.Count; ++i) + { + var p = _particles[i]; + if (p.Init.Mass > 0) + { + var newPos = p.Verlet(env, time); + initPos(i, p.Init.Mass, newPos); + } + } + } + + public void DrawGizmos() + { + foreach (var p in _particles) + { + p.OnDrawGizmos(_particleTransforms[p.Init.Index]); + } + } + } +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleList.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleList.cs.meta new file mode 100644 index 000000000..062930b59 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleList.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fee618dfb5846ea47978b49ed4c0282b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleRuntimeState.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleRuntimeState.cs new file mode 100644 index 000000000..1eed46f94 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleRuntimeState.cs @@ -0,0 +1,42 @@ +using System; +using UnityEngine; + +namespace RotateParticle +{ + public class ParticleRuntimeState + { + public Vector3 Current; + public Vector3 Prev; + + public ParticleRuntimeState(SimulationEnv env, Transform transform) + { + if (env.Center == null) + { + Prev = transform.position; + Current = transform.position; + } + else + { + throw new NotImplementedException(); + } + } + + public void Update(Transform t) + { + Current = t.position; + } + + public void Apply(in Vector3 newPos, bool zeroVelocity = false) + { + if (zeroVelocity) + { + Prev = newPos; + } + else + { + Prev = Current; + } + Current = newPos; + } + } +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleRuntimeState.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleRuntimeState.cs.meta new file mode 100644 index 000000000..1a193c839 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleRuntimeState.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: eddc8c1b804734c49a6eb04d72afb0a8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RigidTransform.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RigidTransform.cs new file mode 100644 index 000000000..e3a2bcdd1 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RigidTransform.cs @@ -0,0 +1,22 @@ +using UnityEngine; + +namespace RotateParticle +{ + public struct RigidTransform + { + public readonly Vector3 Position; + public readonly Quaternion Rotation; + + public RigidTransform(in Vector3 pos, in Quaternion rot) + { + Position = pos; + Rotation = rot; + } + + public RigidTransform(Transform t) + { + Position = t.position; + Rotation = t.rotation; + } + } +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RigidTransform.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RigidTransform.cs.meta new file mode 100644 index 000000000..542915cf0 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RigidTransform.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1fe036d9e9352e54ea009e8322a4faa2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticle.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticle.cs new file mode 100644 index 000000000..b6ddbb481 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticle.cs @@ -0,0 +1,125 @@ +using System; +using System.Collections.Generic; +using SphereTriangle; +using UnityEngine; + + +namespace RotateParticle +{ + [Serializable] + public class RotateParticle + { + public ParticleInitState Init; + public ParticleRuntimeState State; + + public readonly List Children = new(); + public readonly RotateParticle Parent; + + // 現フレームの力積算 + public Vector3 Force = Vector3.zero; + + // 直前で接触があった + public bool HasCollide = false; + + public RotateParticle(int index, RotateParticle parent, SimulationEnv env, Transform transform, float radius, float mass, CollisionGroupMask collisionMask) + { + Init = new ParticleInitState(index, transform, radius, mass, collisionMask); + State = new ParticleRuntimeState(env, transform); + Parent = parent; + } + + + public void BeginFrame(SimulationEnv env, FrameTime time, in Vector3 rest) + { + // integrate forces + Force = Vector3.zero; + + // 曲げ + if (HasCollide) + { + // 震え防止。ちょっとマイルドになるような気もする? + } + else + { + // Stiffness: 1 で即時に元に戻る + Force += (rest - State.Current) * env.Stiffness / time.SqDt; + } + + // 外力(sqDtで割るとピーキーすぎるのでこれでいいのでは?) + Force += env.External / time.DeltaTime; + } + + public Vector3 Verlet(SimulationEnv env, FrameTime time) + { + var velocity = (State.Current - State.Prev); + if (HasCollide) + { + // 震え防止。ちょっとマイルドになるような気もする? + velocity = Vector3.zero; + } + else + { + // DragForce: 1 で即時停止 + velocity *= (1 - env.DragForce); + } + + HasCollide = false; + return State.Current + velocity + Force * time.SqDt; + } + + /// + /// get ParentParent.rotatio * Parent.Init.LocalRotation + /// + /// + /// + public Quaternion RestRotation(IReadOnlyList transforms) + { + if (Parent == null) + { + return Quaternion.identity; + } + + var parent = transforms[Parent.Init.Index]; + if (Parent.Parent == null) + { + var pt = parent.parent; + if (pt == null) + { + return Parent.Init.LocalRotation; + } + + return pt.rotation * Parent.Init.LocalRotation; + } + + var parentparent = transforms[Parent.Parent.Init.Index]; + var restRotation = parentparent.rotation * Parent.Init.LocalRotation; + return restRotation; + } + + public void OnDrawGizmos(Transform transform) + { + if (Init.Radius == 0) + { + return; + } + + Gizmos.color = Init.Mass == 0 ? Color.red : Color.gray; + if (transform.parent != null && Init.Mass > 0) + { + Gizmos.matrix = Matrix4x4.identity; + Gizmos.DrawLine(transform.parent.position, transform.position); + } + + Gizmos.matrix = transform.localToWorldMatrix; + Gizmos.DrawWireSphere(Vector3.zero, Init.Radius); + + var r = Init.Radius * 2; + Gizmos.color = Color.red; + Gizmos.DrawLine(Vector3.left * r, Vector3.right * r); + Gizmos.color = Color.green; + Gizmos.DrawLine(Vector3.down * r, Vector3.up * r); + Gizmos.color = Color.blue; + Gizmos.DrawLine(Vector3.back * r, Vector3.forward * r); + } + } +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticle.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticle.cs.meta new file mode 100644 index 000000000..9afb92224 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticle.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 125347015f2366e4b8957431407ddf9d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs new file mode 100644 index 000000000..e0f8ef2d7 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs @@ -0,0 +1,363 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using SphereTriangle; +using UnityEngine; + + +namespace RotateParticle +{ + [DisallowMultipleComponent] + public class RotateParticleSystem : MonoBehaviour + { + // TODO: param to _strandGroups + [SerializeField] + public SimulationEnv Env = new(); + + [SerializeField] + public List _strandGroups = new List(); + + [SerializeField] + public List _colliderGroups = new(); + + [Range(0, 1)] + public float _clothFactor = 0.5f; + + // runtime + bool _initialized = false; + List _strands = new List(); + public ParticleList _list = new(); + public List<(SpringConstraint, ClothRectCollision)> _clothRects = new(); + + public PositionList _newPos; + Vector3[] _restPositions; + + static Color[] Colors = new Color[] + { + Color.yellow, + Color.green, + Color.magenta, + }; + + Color GetGizmoColor(ColliderGroup g) + { + for (int i = 0; i < _colliderGroups.Count; ++i) + { + if (_colliderGroups[i] == g) + { + return Colors[i]; + } + } + + return Color.gray; + } + + public void AddColliderIfNotExists(string groupName, Transform head, Transform tail, float radius) + { + ColliderGroup group = default; + foreach (var g in _colliderGroups) + { + if (g.Name == groupName) + { + group = g; + break; + } + } + if (group == null) + { + group = new ColliderGroup { Name = groupName }; + _colliderGroups.Add(group); + } + + foreach (var collider in group.Colliders) + { + if (collider.transform == head) + { + return; + } + } + + var c = GetOrAddComponent(head.gameObject); + c.Tail = tail; + c.Radius = radius; + c.GizmoColor = GetGizmoColor(group); + group.Colliders.Add(c); + } + + static T GetOrAddComponent(GameObject o) where T : Component + { + var t = o.GetComponent(); + if (t != null) + { + return t; + } + return o.AddComponent(); + } + + HashSet _clothUsedParticles = new(); + + public void InitializeCloth( + StrandGroup g, + ParticleList list, + List strands, + List<(SpringConstraint, ClothRectCollision)> clothRects) + { + if (g.Connection == StrandConnectionType.Cloth || g.Connection == StrandConnectionType.ClothLoop) + { + for (int i = 1; i < strands.Count; ++i) + { + var s0 = strands[i - 1]; + var s1 = strands[i]; + for (int j = 1; j < s0.Particles.Count && j < s1.Particles.Count; ++j) + { + // d x x c + // | | + // a x-x b + var a = s0.Particles[j]; + var b = s1.Particles[j]; + var c = s1.Particles[j - 1]; + var d = s0.Particles[j - 1]; + _clothUsedParticles.Add(a.Init.Index); + _clothUsedParticles.Add(b.Init.Index); + _clothUsedParticles.Add(c.Init.Index); + _clothUsedParticles.Add(d.Init.Index); + if (i % 2 == 1) + { + // 互い違いに + // abcd to badc + (a, b) = (b, a); + (c, d) = (d, c); + } + clothRects.Add(( + new SpringConstraint( + list._particles[a.Init.Index], + list._particles[b.Init.Index]), + new ClothRectCollision( + a.Init.Index, b.Init.Index, c.Init.Index, d.Init.Index))); + } + } + if (strands.Count >= 3) + { + if (g.Connection == StrandConnectionType.ClothLoop) + { + var i = strands.Count; + var s0 = strands.Last(); + var s1 = strands.First(); + for (int j = 1; j < s0.Particles.Count && j < s1.Particles.Count; ++j) + { + var a = s0.Particles[j]; + var b = s1.Particles[j]; + var c = s1.Particles[j - 1]; + var d = s0.Particles[j - 1]; + _clothUsedParticles.Add(a.Init.Index); + _clothUsedParticles.Add(b.Init.Index); + _clothUsedParticles.Add(c.Init.Index); + _clothUsedParticles.Add(d.Init.Index); + if (i % 2 == 1) + { + // 互い違いに + // abcd to badc + (a, b) = (b, a); + (c, d) = (d, c); + } + clothRects.Add(( + new SpringConstraint( + list._particles[a.Init.Index], + list._particles[b.Init.Index]), + new ClothRectCollision( + a.Init.Index, b.Init.Index, c.Init.Index, d.Init.Index + ) + )); + } + } + } + } + } + + public void Initialize() + { + _initialized = true; + foreach (var g in _strandGroups) + { + if (g.Roots?.Count == 0) + { + continue; + } + var strands = new List(); + foreach (var root in g.Roots) + { + var strand = _list.MakeParticleStrand(Env, root, g.DefaultStrandRaius, g.CollisionMask); + strands.Add(strand); + } + + InitializeCloth(g, _list, strands, _clothRects); + _strands.AddRange(strands); + } + + _newPos = new(_list._particles.Count); + _list.EndInitialize(_newPos.Init); + _restPositions = new Vector3[_list._particles.Count]; + _newPos.EndInitialize(); + + foreach (var (s, c) in _clothRects) + { + c.InitializeColliderSide(_newPos, _colliderGroups); + } + } + + void Start() + { + if (!_initialized) + { + Initialize(); + } + } + + /// + /// すべての Particle を Init 状態にする。 + /// Verlet の Prev を現在地に更新する(速度0)。 + /// + public void ResetParticle() + { + foreach (var strand in _strands) + { + strand.Reset(_list._particleTransforms); + } + } + + public void Update() + { + if (Time.deltaTime == 0) + { + return; + } + Process(Time.deltaTime); + } + + public void Process(float deltaTime) + { + using var profile = new ProfileSample("RotateParticle"); + + using (new ProfileSample("UpdateRoot")) + { + // + // input + // + // 各strandのrootの移動と回転を外部から入力する。 + // それらを元に各 joint の方向を元に戻した場合の戻り位置を計算する + foreach (var strand in _strands) + { + strand.UpdateRoot(_list._particleTransforms, _newPos, _restPositions); + } + } + + using (new ProfileSample("Verlet")) + { + // + // particle simulation + // + // verlet 積分 + var time = new FrameTime(deltaTime); + _list.BeginFrame(Env, time, _restPositions); + foreach (var (spring, collision) in _clothRects) + { + // cloth constraint + spring.Resolve(time, _clothFactor); + } + _list.Verlet(Env, time, _newPos.Init); + // 長さで拘束 + foreach (var strand in _strands) + { + strand.ForceLength(_list._particleTransforms, _newPos); + } + } + + // collision + using (new ProfileSample("Collision")) + { + for (int i = 0; i < _colliderGroups.Count; ++i) + { + var g = _colliderGroups[i]; + + + foreach (var (spring, rect) in _clothRects) + { + using var prof = new ProfileSample("Collision: Cloth"); + // 頂点 abcd は同じ CollisionMask + if (_list._particles[rect._a].Init.CollisionMask.HasFlag((CollisionGroupMask)(i + 1))) + { + // cloth + rect.Collide(_newPos, g.Colliders); + } + } + + for (int j = 0; j < _list._particles.Count; ++j) + { + using var prof = new ProfileSample("Collision: Strand"); + if (_clothUsedParticles.Contains(j)) + { + // 布で処理された + continue; + } + + var particle = _list._particles[j]; + if (particle.Init.Mass == 0) + { + continue; + } + + // 紐の当たり判定 + if (particle.Init.CollisionMask.HasFlag((CollisionGroupMask)(i + 1))) + { + var p = _newPos.Get(j); + foreach (var c in g.Colliders) + { + // strand + if (c != null && c.TryCollide(p, particle.Init.Radius, out var resolved)) + { + _newPos.CollisionMove(particle.Init.Index, resolved, c.Radius); + } + } + } + } + } + } + + using (new ProfileSample("Apply")) + { + for (int i = 0; i < _newPos.CollisionCount.Length; ++i) + { + if (_newPos.CollisionCount[i] > 0) + { + _list._particles[i].HasCollide = true; + } + } + var result = _newPos.Resolve(); + // + // apply result + // + // apply positions and + // calc rotation from positions recursive + foreach (var strand in _strands) + { + strand.Apply(_list._particleTransforms, result); + } + } + } + + void OnDrawGizmos() + { + _list.DrawGizmos(); + + foreach (var (spring, rect) in _clothRects) + { + rect.DrawGizmos(); + } + + if (_newPos != null) + { + _newPos.DrawGizmos(); + } + } + } +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs.meta new file mode 100644 index 000000000..5bf73e159 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 67a32b7c5e169f64daa6a8717d3de4f1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SimulationEnv.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SimulationEnv.cs new file mode 100644 index 000000000..94728205f --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SimulationEnv.cs @@ -0,0 +1,18 @@ +using UnityEngine; + +namespace RotateParticle +{ + [System.Serializable] + public class SimulationEnv + { + public Transform Center; + + [Range(0, 1)] + public float Stiffness = 0.1f; + + [Range(0, 1)] + public float DragForce = 0.4f; + + public Vector3 External = new Vector3(0, -0.001f, 0); + } +} diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SimulationEnv.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SimulationEnv.cs.meta new file mode 100644 index 000000000..3eb703729 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SimulationEnv.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c9c034f40b6adaf4ba23f456fd5a2ec1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SpringConstraint.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SpringConstraint.cs new file mode 100644 index 000000000..cec219e18 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SpringConstraint.cs @@ -0,0 +1,41 @@ +using System; +using UnityEngine; + +namespace RotateParticle +{ + public class SpringConstraint + { + RotateParticle _p0; + + RotateParticle _p1; + + // 初期長さ + float _rest; + + public SpringConstraint(RotateParticle p0, RotateParticle p1) + { + _p0 = p0; + _p1 = p1; + _rest = Vector3.Distance(p0.State.Current, p1.State.Current); + } + + /// + /// フックの法則 + /// + /// + public void Resolve(FrameTime time, float hookean) + { + var d = Vector3.Distance(_p0.State.Current, _p1.State.Current); + var f = (d - _rest) * hookean; + var dx = (_p1.State.Current - _p0.State.Current).normalized * f / time.SqDt; + + _p0.Force += dx; + _p1.Force -= dx; + } + + public void DrawGizmo() + { + Gizmos.DrawLine(_p0.State.Current, _p1.State.Current); + } + } +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SpringConstraint.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SpringConstraint.cs.meta new file mode 100644 index 000000000..dfb815753 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SpringConstraint.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f9f187b56235e024bb4edef8b3bb2142 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Strand.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Strand.cs new file mode 100644 index 000000000..a36b1178b --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Strand.cs @@ -0,0 +1,165 @@ +using System.Collections.Generic; +using SphereTriangle; +using UnityEngine; + +namespace RotateParticle +{ + public class Strand + { + public CollisionGroupMask CollisionMask; + + public Strand(CollisionGroupMask mask) + { + CollisionMask = mask; + } + + public readonly List Particles = new(); + + public void UpdateRoot(IReadOnlyList transforms, SphereTriangle.PositionList positions, Vector3[] restPositions) + { + var root = Particles[0]; + + // only root affected + var t = transforms[root.Init.Index]; + root.State.Update(t); + positions.Init(root.Init.Index, root.Init.Mass, t.position); + + // Debug.Assert(root.Children.Count == 1); + foreach (var child in root.Children) + { + _CalcRest(transforms, positions.Result, restPositions, root.Children[0]); + } + } + + void _CalcRest(IReadOnlyList transforms, IReadOnlyList positions, + Vector3[] restPositions, + RotateParticle particle) + { + var restRotation = particle.RestRotation(transforms); + + + if (particle.Parent != null) + { + // var localPosition = particle.Init.BoneAxis * Vector3.Distance(positions[particle.Parent.Init.Index], positions[particle.Init.Index]); + restPositions[particle.Init.Index] = positions[particle.Parent.Init.Index] + restRotation * particle.Init.LocalPosition; + } + else + { + restPositions[particle.Init.Index] = restRotation * particle.Init.LocalPosition; + } + + foreach (var child in particle.Children) + { + _CalcRest(transforms, positions, restPositions, child); + } + } + + public void ForceLength(IReadOnlyList transforms, PositionList positions) + { + var root = Particles[0]; + for (int i = 0; i < root.Children.Count; ++i) + { + _ForceConstraint(transforms, positions, i, root.Children[i], positions.Get(root.Init.Index)); + } + } + + void _ForceConstraint(IReadOnlyList transforms, PositionList positions, int child_index, RotateParticle particle, in Vector3 parent) + { + // update position + Vector3 newPosition; + if (child_index == 0) + { + newPosition = parent + (positions.Get(particle.Init.Index) - parent).normalized * particle.Init.StrandLength; + } + else + { + // 枝分かれ。特別処理 + var firstSibling = particle.Parent.Children[0]; + var firstPosition = positions.Get(firstSibling.Init.Index); + newPosition = firstPosition + transforms[particle.Parent.Init.Index].rotation * (particle.Init.LocalPosition - firstSibling.Init.LocalPosition); + } + positions.Init(particle.Init.Index, particle.Init.Mass, newPosition); + + for (int i = 0; i < particle.Children.Count; ++i) + { + _ForceConstraint(transforms, positions, i, particle.Children[i], newPosition); + } + } + + public void Reset(IReadOnlyList transforms) + { + var root = Particles[0]; + _ResetRecursive(transforms, root); + } + + void _ResetRecursive(IReadOnlyList transforms, + RotateParticle joint) + { + var t = transforms[joint.Init.Index]; + t.localPosition = joint.Init.LocalPosition; + t.localRotation = joint.Init.LocalRotation; + joint.State.Apply(t.position, zeroVelocity: true); + for (int i = 0; i < joint.Children.Count; ++i) + { + _ResetRecursive(transforms, joint.Children[i]); + } + } + + public void Apply(IReadOnlyList transforms, IReadOnlyList positions) + { + var root = Particles[0]; + for (int i = 0; i < root.Children.Count; ++i) + { + var child = root.Children[i]; + _ApplyRecursive(transforms, positions, i, child); + } + } + + void _ApplyRecursive(IReadOnlyList transforms, IReadOnlyList positions, + int child_index, RotateParticle joint) + { + var t = transforms[joint.Init.Index]; + + if (child_index > 0) + { + // 枝分かれ。mass=0 にもしている。 + // self position + t.position = positions[joint.Init.Index]; + joint.State.Apply(t.position); + } + else if (joint.Init.Mass > 0) + { + Debug.Assert(joint.Parent != null); + var restRotation = joint.RestRotation(transforms); + + Quaternion aimRotation = Quaternion.FromToRotation( + // 初期状態 + restRotation * joint.Init.BoneAxis, + // 現状 + positions[joint.Init.Index] - positions[joint.Parent.Init.Index]); + + var r = aimRotation * restRotation; + + // parent rotation + transforms[joint.Parent.Init.Index].rotation = r; + + // self position + t.position = positions[joint.Init.Index]; + joint.State.Apply(t.position); + } + + if (joint.Children.Count > 0) + { + for (int i = 0; i < joint.Children.Count; ++i) + { + _ApplyRecursive(transforms, positions, i, joint.Children[i]); + } + } + else + { + // tail + t.rotation = t.parent.rotation * joint.Init.LocalRotation; + } + } + } +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Strand.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Strand.cs.meta new file mode 100644 index 000000000..a9bafb7c1 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Strand.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d9aee349d7a2c2344a232a0e158f57dc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Scenes.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Scenes.meta new file mode 100644 index 000000000..20e52fe13 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Scenes.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: cfa6b58a8a8571e478cf6bac4a00a23d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Scenes/sample.unity b/Assets/VRM10_Samples/ClothSample/RotateParticle/Scenes/sample.unity new file mode 100644 index 000000000..6a9a31a28 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Scenes/sample.unity @@ -0,0 +1,1756 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0.18028378, g: 0.22571412, b: 0.30692285, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 12 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 512 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 256 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 1 + m_PVRDenoiserTypeDirect: 1 + m_PVRDenoiserTypeIndirect: 1 + m_PVRDenoiserTypeAO: 1 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 0} + m_LightingSettings: {fileID: 0} +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &18281988 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 18281990} + - component: {fileID: 18281989} + - component: {fileID: 18281991} + m_Layer: 0 + m_Name: Directional Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &18281989 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 18281988} + m_Enabled: 1 + serializedVersion: 10 + m_Type: 1 + m_Shape: 0 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1 + m_Range: 10 + m_SpotAngle: 30 + m_InnerSpotAngle: 21.80208 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_CullingMatrixOverride: + e00: 1 + e01: 0 + e02: 0 + e03: 0 + e10: 0 + e11: 1 + e12: 0 + e13: 0 + e20: 0 + e21: 0 + e22: 1 + e23: 0 + e30: 0 + e31: 0 + e32: 0 + e33: 1 + m_UseCullingMatrixOverride: 0 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingLayerMask: 1 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} + m_UseBoundingSphereOverride: 0 + m_UseViewFrustumForShadowCasterCull: 1 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &18281990 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 18281988} + m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} + m_LocalPosition: {x: 0, y: 3, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} +--- !u!114 &18281991 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 18281988} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 474bcb49853aa07438625e644c072ee6, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Version: 1 + m_UsePipelineSettings: 1 + m_AdditionalLightsShadowResolutionTier: 2 + m_LightLayerMask: 1 + m_CustomShadowLayers: 0 + m_ShadowLayerMask: 1 + m_LightCookieSize: {x: 1, y: 1} + m_LightCookieOffset: {x: 0, y: 0} +--- !u!1 &89594358 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 89594359} + m_Layer: 0 + m_Name: p01 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &89594359 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 89594358} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.2, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 764167383} + m_Father: {fileID: 1795237625} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &254332538 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 254332539} + m_Layer: 0 + m_Name: p00 (3) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &254332539 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 254332538} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0.5, y: -0.5, z: -0.017} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 2079542329} + m_Father: {fileID: 1776840502} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &378890423 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 378890424} + m_Layer: 0 + m_Name: p01 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &378890424 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 378890423} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.2, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 495122916} + m_Father: {fileID: 510828803} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &495122915 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 495122916} + m_Layer: 0 + m_Name: p02 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &495122916 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 495122915} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.2, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 567596718} + m_Father: {fileID: 378890424} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &510828802 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 510828803} + m_Layer: 0 + m_Name: p00 (2) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &510828803 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 510828802} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0.5, y: -0.5, z: 0.397} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 378890424} + m_Father: {fileID: 1776840502} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &567596717 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 567596718} + m_Layer: 0 + m_Name: p03 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &567596718 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 567596717} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.2, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 495122916} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &697358959 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 697358962} + - component: {fileID: 697358961} + m_Layer: 0 + m_Name: LineDistance + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &697358961 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 697358959} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4d8072930ebf6d34ea30547c75dfb378, type: 3} + m_Name: + m_EditorClassIdentifier: + Radius: 0.181 + Tail: {fileID: 1499507829} + GizmoColor: {r: 1, g: 0.92156863, b: 0.015686275, a: 1} + SolidGizmo: 0 +--- !u!4 &697358962 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 697358959} + m_LocalRotation: {x: -0.17039932, y: 0.6416098, z: -0.14918736, w: 0.7328329} + m_LocalPosition: {x: 2.054, y: 0.227, z: 0.198} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1499507829} + m_Father: {fileID: 0} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: -3.343, y: 83.177, z: -25.98} +--- !u!1 &764167382 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 764167383} + m_Layer: 0 + m_Name: p02 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &764167383 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 764167382} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.2, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1649862058} + m_Father: {fileID: 89594359} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &784028318 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 784028319} + m_Layer: 0 + m_Name: p00 (4) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &784028319 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 784028318} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0.5, y: -0.5, z: -0.434} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1282382606} + m_Father: {fileID: 1776840502} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &852854938 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 852854939} + m_Layer: 0 + m_Name: c + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &852854939 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 852854938} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 1.94, y: 0, z: -0.438} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1716731905} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &869331620 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 869331621} + m_Layer: 0 + m_Name: p02 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &869331621 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 869331620} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.2, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1309984319} + m_Father: {fileID: 1291439358} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &993404687 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 993404690} + - component: {fileID: 993404689} + - component: {fileID: 993404688} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &993404688 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 993404687} + m_Enabled: 1 +--- !u!20 &993404689 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 993404687} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &993404690 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 993404687} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1051717020 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1051717021} + m_Layer: 0 + m_Name: p03 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1051717021 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1051717020} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.2, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1909109868} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1061526277 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1061526278} + m_Layer: 0 + m_Name: p03 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1061526278 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1061526277} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.2, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1604317965} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1064316579 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1064316580} + m_Layer: 0 + m_Name: p01 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1064316580 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1064316579} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.2, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1885955863} + m_Father: {fileID: 1566314966} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1068665243 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1068665244} + m_Layer: 0 + m_Name: GameObject + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1068665244 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1068665243} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.76, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 2045284903} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1100075149 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1100075150} + m_Layer: 0 + m_Name: p02 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1100075150 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1100075149} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.2, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 2054899972} + m_Father: {fileID: 2141907755} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1111855027 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1111855028} + m_Layer: 0 + m_Name: p00 (6) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1111855028 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1111855027} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -0.467, y: -0.5, z: -0.49} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 2141907755} + m_Father: {fileID: 1776840502} + m_RootOrder: 6 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1274286520 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1274286521} + m_Layer: 0 + m_Name: p02 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1274286521 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1274286520} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.2, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1866045913} + m_Father: {fileID: 2079542329} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1282382605 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1282382606} + m_Layer: 0 + m_Name: p01 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1282382606 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1282382605} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.2, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1909109868} + m_Father: {fileID: 784028319} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1291439357 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1291439358} + m_Layer: 0 + m_Name: p01 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1291439358 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1291439357} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.2, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 869331621} + m_Father: {fileID: 1620666996} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1309984318 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1309984319} + m_Layer: 0 + m_Name: p03 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1309984319 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1309984318} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.2, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 869331621} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1471300592 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1471300593} + m_Layer: 0 + m_Name: b + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1471300593 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1471300592} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0.037, y: 0, z: -0.42} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1716731905} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1499507828 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1499507829} + m_Layer: 0 + m_Name: GameObject + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1499507829 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1499507828} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 1.475, y: 0, z: -0.147} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 697358962} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1519617806 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1519617807} + m_Layer: 0 + m_Name: p01 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1519617807 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1519617806} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.2, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1604317965} + m_Father: {fileID: 1890118283} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1566314965 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1566314966} + m_Layer: 0 + m_Name: p00 (7) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1566314966 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1566314965} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -0.478, y: -0.5, z: -0.023} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1064316580} + m_Father: {fileID: 1776840502} + m_RootOrder: 7 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1604317964 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1604317965} + m_Layer: 0 + m_Name: p02 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1604317965 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1604317964} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.2, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1061526278} + m_Father: {fileID: 1519617807} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1620666995 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1620666996} + m_Layer: 0 + m_Name: p00 (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1620666996 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1620666995} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.5, z: 0.393} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1291439358} + m_Father: {fileID: 1776840502} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1649862057 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1649862058} + m_Layer: 0 + m_Name: p03 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1649862058 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1649862057} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.2, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 764167383} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1716731903 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1716731905} + - component: {fileID: 1716731904} + m_Layer: 0 + m_Name: Triangle + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1716731904 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1716731903} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c201feca8fd8c644b987521e89706c4f, type: 3} + m_Name: + m_EditorClassIdentifier: + B: {fileID: 1471300593} + C: {fileID: 852854939} + Capsule: {fileID: 697358961} +--- !u!4 &1716731905 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1716731903} + m_LocalRotation: {x: -0, y: -0.05464378, z: -0, w: 0.99850595} + m_LocalPosition: {x: 1.49, y: 0.146, z: 0.92} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1471300593} + - {fileID: 852854939} + m_Father: {fileID: 0} + m_RootOrder: 5 + m_LocalEulerAnglesHint: {x: 0, y: -6.265, z: 0} +--- !u!1 &1776840497 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1776840502} + - component: {fileID: 1776840501} + - component: {fileID: 1776840500} + - component: {fileID: 1776840499} + - component: {fileID: 1776840498} + m_Layer: 0 + m_Name: Cube + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1776840498 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1776840497} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 67a32b7c5e169f64daa6a8717d3de4f1, type: 3} + m_Name: + m_EditorClassIdentifier: + Env: + Center: {fileID: 0} + Stiffness: 0.1 + DragForce: 0.607 + External: {x: 0, y: -0.001, z: 0} + _strandGroups: + - Name: + CollisionMask: 4294967295 + Connection: 1 + Roots: + - {fileID: 1890118283} + - {fileID: 1620666996} + - {fileID: 510828803} + - {fileID: 254332539} + - {fileID: 784028319} + - {fileID: 1795237625} + - {fileID: 1111855028} + - {fileID: 1566314966} + DefaultStrandRaius: 0 + _colliderGroups: + - Name: + Colliders: + - {fileID: 2045284902} + _clothFactor: 0.5 + _list: + _particles: [] + _particleTransforms: [] +--- !u!65 &1776840499 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1776840497} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Size: {x: 2, y: 2, z: 2} + m_Center: {x: 0, y: 0, z: 0} +--- !u!23 &1776840500 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1776840497} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!33 &1776840501 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1776840497} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &1776840502 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1776840497} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0.5, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1890118283} + - {fileID: 1620666996} + - {fileID: 510828803} + - {fileID: 254332539} + - {fileID: 784028319} + - {fileID: 1795237625} + - {fileID: 1111855028} + - {fileID: 1566314966} + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1788457790 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1788457791} + m_Layer: 0 + m_Name: p03 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1788457791 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1788457790} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.2, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1885955863} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1795237624 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1795237625} + m_Layer: 0 + m_Name: p00 (5) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1795237625 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1795237624} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0.011, y: -0.5, z: -0.468} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 89594359} + m_Father: {fileID: 1776840502} + m_RootOrder: 5 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1866045912 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1866045913} + m_Layer: 0 + m_Name: p03 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1866045913 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1866045912} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.2, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1274286521} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1885955862 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1885955863} + m_Layer: 0 + m_Name: p02 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1885955863 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1885955862} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.2, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1788457791} + m_Father: {fileID: 1064316580} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1890118282 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1890118283} + m_Layer: 0 + m_Name: p00 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1890118283 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1890118282} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -0.5, y: -0.5, z: 0.452} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1519617807} + m_Father: {fileID: 1776840502} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1909109867 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1909109868} + m_Layer: 0 + m_Name: p02 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1909109868 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1909109867} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.2, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1051717021} + m_Father: {fileID: 1282382606} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &2045284901 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2045284903} + - component: {fileID: 2045284902} + m_Layer: 0 + m_Name: collider + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &2045284902 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2045284901} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4d8072930ebf6d34ea30547c75dfb378, type: 3} + m_Name: + m_EditorClassIdentifier: + Radius: 0.201 + Tail: {fileID: 1068665244} + GizmoColor: {r: 1, g: 0.92156863, b: 0.015686275, a: 1} + SolidGizmo: 0 +--- !u!4 &2045284903 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2045284901} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.26, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1068665244} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &2054899971 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2054899972} + m_Layer: 0 + m_Name: p03 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2054899972 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2054899971} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.2, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1100075150} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &2079542328 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2079542329} + m_Layer: 0 + m_Name: p01 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2079542329 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2079542328} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.2, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1274286521} + m_Father: {fileID: 254332539} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &2141907754 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2141907755} + m_Layer: 0 + m_Name: p01 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2141907755 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2141907754} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: -0.2, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1100075150} + m_Father: {fileID: 1111855028} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Scenes/sample.unity.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Scenes/sample.unity.meta new file mode 100644 index 000000000..34d1b6092 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Scenes/sample.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 7caaf005bf5d55e41860411c0c3d0710 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle.meta b/Assets/VRM10_Samples/ClothSample/SphereTriangle.meta new file mode 100644 index 000000000..680b09da3 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/SphereTriangle.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 36a9770569fe64c4f98dbe384596e4b2 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/CapsuleInfo.cs b/Assets/VRM10_Samples/ClothSample/SphereTriangle/CapsuleInfo.cs new file mode 100644 index 000000000..4b151ebf9 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/SphereTriangle/CapsuleInfo.cs @@ -0,0 +1,117 @@ +using UnityEngine; + +namespace SphereTriangle +{ + struct CapsuleInfo + { + public SphereCapsuleCollider Collider; + public Triangle Triangle; + + public Vector3 MinOnPlane; + public float MinDistance; + public float MinDistanceClmap; + public Vector3 MinOnPlaneClamp; + public Vector3 MinPos; + public Vector3 MinClamp; + + public Vector3 MaxOnPlane; + public float MaxDistance; + public float MaxDistanceClamp; + public Vector3 MaxOnPlaneClamp; + public Vector3 MaxPos; + public Vector3 MaxClamp; + + /// + /// min and max is tail and head. + /// + public bool Reverse; + + public bool Intersected; + + public CapsuleInfo(in Triangle t, SphereCapsuleCollider collider) + { + Collider = collider; + Triangle = t; + var headDistance = t.Plane.GetDistanceToPoint(collider.transform.position); + var tailDistance = t.Plane.GetDistanceToPoint(collider.Tail.position); + if (headDistance <= tailDistance) + { + Reverse = false; + MinDistance = headDistance; + MaxDistance = tailDistance; + MinOnPlane = t.Plane.ClosestPointOnPlane(collider.transform.position); + MaxOnPlane = t.Plane.ClosestPointOnPlane(collider.Tail.position); + MinClamp = collider.transform.position; + MaxClamp = collider.Tail.position; + MinPos = collider.transform.position; + MaxPos = collider.Tail.position; + } + else + { + Reverse = true; + MaxDistance = headDistance; + MinDistance = tailDistance; + MaxOnPlane = t.Plane.ClosestPointOnPlane(collider.transform.position); + MinOnPlane = t.Plane.ClosestPointOnPlane(collider.Tail.position); + MaxClamp = collider.transform.position; + MinClamp = collider.Tail.position; + MaxPos = collider.transform.position; + MinPos = collider.Tail.position; + } + + // Intersect + Intersected = true; + MinDistanceClmap = MinDistance; + MinOnPlaneClamp = MinOnPlane; + MaxDistanceClamp = MaxDistance; + MaxOnPlaneClamp = MaxOnPlane; + if (MinDistance < -Collider.Radius) + { + if (MaxDistance < -Collider.Radius) + { + Intersected = false; + } + else + { + // clamp Min + MinDistanceClmap = -Collider.Radius; + } + } + else if (MaxDistance > Collider.Radius) + { + if (MinDistance > Collider.Radius) + { + Intersected = false; + } + else + { + // clamp Max + MaxDistanceClamp = Collider.Radius; + } + } + + // + MaxOnPlaneClamp = Vector3.Lerp(MinOnPlane, MaxOnPlane, (MaxDistanceClamp - MinDistance) / (MaxDistance - MinDistance)); + MinOnPlaneClamp = Vector3.Lerp(MaxOnPlane, MinOnPlane, (MinDistanceClmap - MaxDistance) / (MinDistance - MaxDistance)); + MaxClamp = Vector3.Lerp(MinPos, MaxPos, (MaxDistanceClamp - MinDistance) / (MaxDistance - MinDistance)); + MinClamp = Vector3.Lerp(MaxPos, MinPos, (MinDistanceClmap - MaxDistance) / (MinDistance - MaxDistance)); + } + + public void DrawGizmo() + { + Gizmos.color = Color.blue; + Gizmos.DrawLine(Reverse ? Collider.Tail.position : Collider.transform.position, MinOnPlane); + Gizmos.DrawWireSphere(MinOnPlane, 0.01f); + + Gizmos.color = Color.blue; + Gizmos.DrawLine(Reverse ? Collider.transform.position : Collider.Tail.position, MaxOnPlane); + Gizmos.DrawWireSphere(MaxOnPlane, 0.01f); + + Gizmos.color = Color.magenta; + Gizmos.DrawLine(MinOnPlaneClamp, MaxOnPlaneClamp); + + Gizmos.color = Color.green; + Triangle.DrawGizmos(); + } + } +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/CapsuleInfo.cs.meta b/Assets/VRM10_Samples/ClothSample/SphereTriangle/CapsuleInfo.cs.meta new file mode 100644 index 000000000..811eac0f5 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/SphereTriangle/CapsuleInfo.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7a797b9c09763964d84ef1497b260fb7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/ClothRectCollision.cs b/Assets/VRM10_Samples/ClothSample/SphereTriangle/ClothRectCollision.cs new file mode 100644 index 000000000..b61537bdb --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/SphereTriangle/ClothRectCollision.cs @@ -0,0 +1,244 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace SphereTriangle +{ + public class ClothRectCollision + { + // 2枚の三角形 + // abc + // cda + // に対する衝突(球 or カプセル)を管理する + public readonly int _a; + public readonly int _b; + public readonly int _c; + public readonly int _d; + + Triangle _triangle0; + float _trinagle0Collision; + Triangle _triangle1; + float _triangle1Collision; + + TriangleCapsuleCollisionSolver _s0 = new(); + TriangleCapsuleCollisionSolver _s1 = new(); + + // 各コライダーが初期姿勢で三角形ABCの法線の正か負のどちらにあるのかを記録する + Dictionary _initialColliderNormalSide = new(); + + /// + /// two triangles + /// d x-x c + /// |/| + /// a x-x b + /// + /// + /// + /// + /// + public ClothRectCollision( + int a, int b, int c, int d) + { + _a = a; + _b = b; + _c = c; + _d = d; + } + + public void InitializeColliderSide(PositionList list, IReadOnlyList colliderGroups) + { + var a = list.Get(_a); + var b = list.Get(_b); + var c = list.Get(_c); + var d = list.Get(_d); + + // x c + // /| + // a x-x b + var t = new Triangle(a, b, c); + + foreach (var g in colliderGroups) + { + foreach (var collider in g.Colliders) + { + var p = t.Plane.ClosestPointOnPlane(collider.transform.position); + var dot = Vector3.Dot(t.Plane.normal, collider.transform.position - p); + _initialColliderNormalSide[collider] = dot; + } + } + } + + Bounds GetBoundsFrom4(in Vector3 a, in Vector3 b, in Vector3 c, in Vector3 d) + { + var aabb = new Bounds(a, Vector3.zero); + aabb.Encapsulate(b); + aabb.Encapsulate(c); + aabb.Encapsulate(d); + return aabb; + } + + Bounds GetBounds(PositionList list) + { + return GetBoundsFrom4(list.Get(_a), list.Get(_b), list.Get(_c), list.Get(_d)); + } + + public void Collide(PositionList list, IReadOnlyCollection colliders) + { + using (new ProfileSample("Rect: Prepare")) + { + _s0.BeginFrame(); + _s1.BeginFrame(); + + var a = list.Get(_a); + var b = list.Get(_b); + var c = list.Get(_c); + var d = list.Get(_d); + + // d x-x c + // |/ + // a x + _triangle1 = new Triangle(c, d, a); + _triangle1Collision -= 0.1f; + if (_triangle1Collision < 0) + { + _triangle1Collision = 0; + } + // x c + // /| + // a x-x b + _triangle0 = new Triangle(a, b, c); + _trinagle0Collision -= 0.1f; + if (_trinagle0Collision < 0) + { + _trinagle0Collision = 0; + } + } + + using (new ProfileSample("Rect: Collide")) + { + var aabb = GetBounds(list); + + foreach (var collider in colliders) + { + using (new ProfileSample("EaryOut")) + { + if (!aabb.Intersects(collider.GetBounds())) + { + continue; + } + + var p = _triangle0.Plane.ClosestPointOnPlane(collider.transform.position); + var dot = Vector3.Dot(_triangle0.Plane.normal, collider.transform.position - p); + if (_initialColliderNormalSide[collider] * dot < 0) + { + // 片側 + continue; + } + } + + if (TryCollide(_s0, collider, _triangle0, out var l0)) + { + _trinagle0Collision = 1.0f; + list.CollisionMove(_a, l0, collider.Radius); + list.CollisionMove(_b, l0, collider.Radius); + list.CollisionMove(_c, l0, collider.Radius); + } + if (TryCollide(_s1, collider, _triangle1, out var l1)) + { + _triangle1Collision = 1.0f; + list.CollisionMove(_c, l1, collider.Radius); + list.CollisionMove(_d, l1, collider.Radius); + list.CollisionMove(_a, l1, collider.Radius); + } + } + } + } + + /// + /// 衝突して移動デルタを得る + /// + /// + /// + /// + /// + static bool TryCollide(TriangleCapsuleCollisionSolver solver, SphereCapsuleCollider collider, in Triangle t, out LineSegment l) + { + if (collider.Tail == null) + { + using var profile = new ProfileSample("Sphere"); + // sphere + return TryCollideSphere(t, collider.transform.position, collider.Radius, out l); + } + else + { + // capsule + TriangleCapsuleCollisionSolver.Result result = default; + using (new ProfileSample("Capsule: Collide")) + { + result = solver.Collide(t, collider, new(collider.transform.position, collider.Tail.position), collider.Radius); + } + using (new ProfileSample("Capsule: TryGetClosest")) + { + var type = result.TryGetClosest(out l); + return type.HasValue; + } + } + } + + /// + /// + /// + /// + /// + /// + /// collider => 衝突点 への線分を返す + static bool TryCollideSphere(in Triangle triangle, in Vector3 collider, float radius, out LineSegment l) + { + var p = triangle.Plane.ClosestPointOnPlane(collider); + var distance = Vector3.Distance(p, collider); + if (distance > radius) + { + l = default; + return false; + } + + if (triangle.IsSameSide(p)) + { + l = new LineSegment(collider, p); + return true; + } + + // p を三辺に投影し t を得る + // var proj = triangle.Project(p); + // if (proj.TryGetClosest(collider, out var x)) + // { + // // 最近点の距離 + // // TODO: + // return new LineSegment(collider, x); + // } + throw new System.NotImplementedException(); + } + + public void DrawGizmos() + { + if (_triangle0.Points == null) + { + return; + } + var r = Vector3.Distance(_triangle0.b, _triangle0.c) * 0.1f; + _DrawGizmos(_triangle0, _s0, _trinagle0Collision, r); + _DrawGizmos(_triangle1, _s1, _triangle1Collision, r); + +#if AABB_DEBUG + Gizmos.matrix = Matrix4x4.identity; + Gizmos.color = Color.cyan; + var aabb = GetBoundsFrom4(_triangle0.a, _triangle0.b, _triangle1.a, _triangle1.b); + Gizmos.DrawWireCube(aabb.center, aabb.size); +#endif + } + + void _DrawGizmos(in Triangle t, TriangleCapsuleCollisionSolver solver, float collision, float radius) + { + solver.DrawGizmos(t, collision, radius); + } + } +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/ClothRectCollision.cs.meta b/Assets/VRM10_Samples/ClothSample/SphereTriangle/ClothRectCollision.cs.meta new file mode 100644 index 000000000..f22245c92 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/SphereTriangle/ClothRectCollision.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c16dea6c47fa81d4184547a209d8fe61 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/ColliderGroup.cs b/Assets/VRM10_Samples/ClothSample/SphereTriangle/ColliderGroup.cs new file mode 100644 index 000000000..401d4d866 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/SphereTriangle/ColliderGroup.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace SphereTriangle +{ + [Serializable] + public class ColliderGroup + { + [SerializeField] + public string Name; + + [SerializeField] + public List Colliders = new List(); + } +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/ColliderGroup.cs.meta b/Assets/VRM10_Samples/ClothSample/SphereTriangle/ColliderGroup.cs.meta new file mode 100644 index 000000000..c6e6b683c --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/SphereTriangle/ColliderGroup.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 07647b77d9934cd42b0bd0ab880ed321 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/FrameRate.cs b/Assets/VRM10_Samples/ClothSample/SphereTriangle/FrameRate.cs new file mode 100644 index 000000000..1b4c4dfe2 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/SphereTriangle/FrameRate.cs @@ -0,0 +1,20 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class FrameRate : MonoBehaviour +{ + [Range(15, 200)] + public int _FrameRate = 30; + + // Start is called before the first frame update + void Start() + { + } + + // Update is called once per frame + void Update() + { + Application.targetFrameRate = _FrameRate; + } +} diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/FrameRate.cs.meta b/Assets/VRM10_Samples/ClothSample/SphereTriangle/FrameRate.cs.meta new file mode 100644 index 000000000..c73a23360 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/SphereTriangle/FrameRate.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 39108f27e89d7514d86e56e2ffb0550c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/LineDistanceGizmo.cs b/Assets/VRM10_Samples/ClothSample/SphereTriangle/LineDistanceGizmo.cs new file mode 100644 index 000000000..f555b5bba --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/SphereTriangle/LineDistanceGizmo.cs @@ -0,0 +1,58 @@ +using UnityEngine; + +namespace SphereTriangle +{ + public class LineDistanceGizmo : MonoBehaviour + { + public SphereCapsuleCollider LineA; + public SphereCapsuleCollider LineB; + + void Reset() + { + if (LineA == null) + { + LineA = GetComponent(); + } + } + + public void OnDrawGizmos() + { + if (LineA?.Tail != null && LineB?.Tail != null) + { + var a = new LineSegment(LineA.transform.position, LineA.Tail.position); + var b = new LineSegment(LineB.transform.position, LineB.Tail.position); + var (s, t) = LineSegment.CalcClosest(a, b); + var a_s = a.GetPoint(s); + var b_t = b.GetPoint(t); + Gizmos.color = Color.magenta; + Gizmos.DrawLine(a_s, b_t); + + Gizmos.color = Color.gray; + if (s < 0) + { + Gizmos.DrawLine(LineA.transform.position, a_s); + } + else if (s > 1) + { + Gizmos.DrawLine(LineA.Tail.position, a_s); + } + else + { + Gizmos.DrawWireSphere(a_s, 0.05f); + } + if (t < 0) + { + Gizmos.DrawLine(LineB.transform.position, b_t); + } + else if (t > 1) + { + Gizmos.DrawLine(LineB.transform.position, b_t); + } + else + { + Gizmos.DrawWireSphere(b_t, 0.05f); + } + } + } + } +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/LineDistanceGizmo.cs.meta b/Assets/VRM10_Samples/ClothSample/SphereTriangle/LineDistanceGizmo.cs.meta new file mode 100644 index 000000000..0f9f777f5 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/SphereTriangle/LineDistanceGizmo.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: cceeecd3d3db5cd4ba74dfa6490e38b1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/LineSegment.cs b/Assets/VRM10_Samples/ClothSample/SphereTriangle/LineSegment.cs new file mode 100644 index 000000000..459066c37 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/SphereTriangle/LineSegment.cs @@ -0,0 +1,160 @@ +using UnityEngine; + +namespace SphereTriangle +{ + public readonly struct LineSegment + { + public readonly Vector3 Start; + public readonly Vector3 End; + + public Vector3 Vector => End - Start; + public Ray Ray => new Ray(Start, Vector); + public float Length => Vector.magnitude; + public float SqLength => Vector.sqrMagnitude; + + public LineSegment(in Vector3 start, in Vector3 end) => (Start, End) = (start, end); + + public Vector3 GetPoint(float t) + { + return Start + Vector * t; + } + + /// + /// 球との衝突時の移動ベクトル + /// Start が球の中心。End 衝突点。 + /// + /// + /// + public Vector3 GetDelta(float radius) + { + return Vector.normalized * (radius - Length); + } + + public float Project(in Vector3 p) + { + var dir = p - Start; + return Vector3.Dot(Vector.normalized, dir) / dir.magnitude; + } + + // P(s) + // Q(t) + public static (float s, float t) CalcClosest(in LineSegment p, in LineSegment q) + { + var d_p2 = Vector3.Dot(p.Vector, p.Vector); + var d_q2 = Vector3.Dot(q.Vector, q.Vector); + var d_pq = Vector3.Dot(p.Vector, q.Vector); + var d_q_p_p = Vector3.Dot(q.Start - p.Start, p.Vector); + var d_p_q_q = Vector3.Dot(p.Start - q.Start, q.Vector); + var denom = d_p2 * d_q2 - d_pq * d_pq; + if (denom < 1e-4) + { + var pq = q.Start - p.Start; + var d = Vector3.Dot(p.Vector, pq); + var s = d / p.Length; + return (s, 0); + } + else + { + var f = 1 / denom; + var s = d_q2 * d_q_p_p + d_pq * d_p_q_q; + var t = d_pq * d_q_p_p + d_p2 * d_p_q_q; + return (f * s, f * t); + } + } + + // public static bool Intersect(in LineSegment p, in LineSegment q, out float s, out float t) + // { + // (s, t) = CalcClosest(p, q); + // if (s >= 0.0 && s <= 1.0 && t >= 0.0 && t <= 1.0) + // { + // if (Vector3.Distance(p.GetPoint(s), q.GetPoint(t)) < 1e4f) + // { + // return true; + // } + // } + // return false; + // } + + public bool TryClampPlaneDistance(in Plane p, float distance, out LineSegment clamped, out Vector3 o) + { + var ray = Ray; + var hit = p.Raycast(ray, out var t); + if (!hit && t == 0) + { + // 平行 + clamped = default; + o = default; + return false; + } + + o = ray.GetPoint(t); + var vs = Start - o; + var ve = End - o; + + var ds = p.GetDistanceToPoint(Start); + var de = p.GetDistanceToPoint(End); + var ts = 1.0f; + var te = 1.0f; + if (ds > 0) + { + if (de > 0) + { + //+s + //+e + //== + if (ds > distance && de > distance) + { + clamped = default; + return false; + } + ts = Mathf.Min(distance, ds) / ds; + te = Mathf.Min(distance, de) / de; + } + else + { + //+s + //== + //-e + ts = Mathf.Min(distance, ds) / ds; + te = Mathf.Max(-distance, de) / de; + } + } + else + { + if (de < 0) + { + //== + //-s + //-e + if (ds < -distance && de < -distance) + { + clamped = default; + return false; + } + ts = Mathf.Max(-distance, ds) / ds; + te = Mathf.Max(-distance, de) / de; + } + else + { + //+e + //== + //-s + ts = Mathf.Max(-distance, ds) / ds; + te = Mathf.Min(distance, de) / de; + } + } + + var cs = new Ray(o, vs).GetPoint(vs.magnitude * ts); + var ce = new Ray(o, ve).GetPoint(ve.magnitude * te); + clamped = new(cs, ce); + return true; + } + + public void DrawGizmos(float radius = 0.01f) + { + Gizmos.DrawLine(Start, End); + Gizmos.DrawWireSphere(Start, radius); + Gizmos.DrawWireSphere(End, radius); + } + } +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/LineSegment.cs.meta b/Assets/VRM10_Samples/ClothSample/SphereTriangle/LineSegment.cs.meta new file mode 100644 index 000000000..e5fb83755 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/SphereTriangle/LineSegment.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: add9de55aee3f344cab64a1c99c7c6aa +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/PositionList.cs b/Assets/VRM10_Samples/ClothSample/SphereTriangle/PositionList.cs new file mode 100644 index 000000000..b13b87fe8 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/SphereTriangle/PositionList.cs @@ -0,0 +1,103 @@ +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace SphereTriangle +{ + public delegate void InitPosition(int index, float mass, in Vector3 position); + + public class PositionList + { + // 初期状態 + // 質点の重さ(0は移動しない) + float[] Mass; + + // 衝突前 + Vector3[] Positions; + public int[] CollisionCount; + + // 衝突による移動距離 + public Vector3[] Delta; + // Positions に Delta を反映した結果 + public Vector3[] Result; + + public PositionList(int count) + { + Positions = new Vector3[count]; + CollisionCount = new int[count]; + Mass = new float[count]; + Delta = new Vector3[count]; + Result = new Vector3[count]; + } + + public Vector3 Get(int index) + { + return Positions[index]; + } + + public void Init(int index, float mass, in Vector3 pos) + { + Mass[index] = mass; + Positions[index] = pos; + CollisionCount[index] = 0; + Delta[index] = Vector3.zero; + } + + public void EndInitialize() + { + // Buffer.BlockCopy(Positions, 0, Result, 0, Positions.Length); + for (int i = 0; i < Positions.Length; ++i) + { + Result[i] = Positions[i]; + } + } + + /// + /// 衝突した。移動を蓄積 + /// + /// + /// + public void CollisionMove(int index, in LineSegment l, float radius, float factor = 1.0f) + { + using var profile = new ProfileSample("CollisionMove"); + if (Mass[index] > 0) + { + Delta[index] += l.GetDelta(radius) * factor; + ++CollisionCount[index]; + } + } + + public IReadOnlyList Resolve() + { + for (int i = 0; i < Positions.Length; ++i) + { + if (CollisionCount[i] > 0) + { + Result[i] = Positions[i] + Delta[i] / CollisionCount[i]; + } + else + { + Result[i] = Positions[i]; + } + } + return Result; + } + + /// + /// 衝突前後の状態を描画 + /// + public void DrawGizmos() + { + Gizmos.color = Color.red; + for (int i = 0; i < Positions.Length; ++i) + { + if (CollisionCount[i] > 0) + { + Gizmos.DrawLine(Positions[i], Result[i]); + // Gizmos.DrawWireSphere(Positions[i], 0.01f); + // Gizmos.DrawSphere(Result[i], 0.01f); + } + } + } + } +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/PositionList.cs.meta b/Assets/VRM10_Samples/ClothSample/SphereTriangle/PositionList.cs.meta new file mode 100644 index 000000000..0733c4dc1 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/SphereTriangle/PositionList.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 836b32456872256409962a684cbee1b4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/ProfileSample.cs b/Assets/VRM10_Samples/ClothSample/SphereTriangle/ProfileSample.cs new file mode 100644 index 000000000..ac9a2d04a --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/SphereTriangle/ProfileSample.cs @@ -0,0 +1,21 @@ +using System; +using UnityEngine.Profiling; + +namespace SphereTriangle +{ + public struct ProfileSample : IDisposable + { + string _name; + + public ProfileSample(string name) + { + _name = name; + Profiler.BeginSample(name); + } + + public void Dispose() + { + Profiler.EndSample(); + } + } +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/ProfileSample.cs.meta b/Assets/VRM10_Samples/ClothSample/SphereTriangle/ProfileSample.cs.meta new file mode 100644 index 000000000..f44d2f9ef --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/SphereTriangle/ProfileSample.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e8375e9fc2aee4f448e349401c0bf068 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/SphereCapsuleCollider.cs b/Assets/VRM10_Samples/ClothSample/SphereTriangle/SphereCapsuleCollider.cs new file mode 100644 index 000000000..2908963f8 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/SphereTriangle/SphereCapsuleCollider.cs @@ -0,0 +1,176 @@ +using UnityEngine; + + +namespace SphereTriangle +{ + [DisallowMultipleComponent] + public class SphereCapsuleCollider : MonoBehaviour + { + [SerializeField, Range(0.01f, 1f)] + public float Radius = 0.05f; + + public Transform Tail; + + public Ray? HeadTailRay => Tail == null ? null : new Ray { origin = transform.position, direction = (Tail.position - transform.position) }; + + public float CapsuleLength => Tail == null ? 0 : Vector3.Distance(Tail.position, transform.position); + + + public Color GizmoColor = Color.yellow; + public bool SolidGizmo = false; + + public Bounds GetBounds() + { + if (Tail == null) + { + return new Bounds(transform.position, new Vector3(Radius, Radius, Radius)); + } + + var h = transform.position; + var t = Tail.position; + var d = h - t; + var aabb = new Bounds((h + t) * 0.5f, new Vector3(Mathf.Abs(d.x), Mathf.Abs(d.y), Mathf.Abs(d.z))); + aabb.Expand(Radius * 2); + return aabb; + } + + public void Reset() + { + if (transform.childCount > 0) + { + Tail = transform.GetChild(0); + } + } + + /// + /// collide sphere a and sphere b. + /// move sphere b to resolved if collide. + /// + /// + /// + /// + /// + /// + /// + static bool TryCollideSphereAndSphere( + in Vector3 from, float ra, + in Vector3 to, float rb, + out LineSegment resolved + ) + { + var d = Vector3.Distance(from, to); + if (d > (ra + rb)) + { + resolved = default; + return false; + } + Vector3 normal = (to - from).normalized; + resolved = new(from, from + normal * (d - rb)); + return true; + } + + /// + /// collide capsule and sphere b. + /// move sphere b to resolved if collide. + /// + /// + /// + /// + /// + /// + static bool TryCollideCapsuleAndSphere( + in Vector3 capsuleHead, + in Vector3 capsuleTail, + float capsuleRadius, + in Vector3 b, + float rb, + out LineSegment resolved + ) + { + var P = (capsuleTail - capsuleHead).normalized; + var Q = b - capsuleHead; + var dot = Vector3.Dot(P, Q); + if (dot <= 0) + { + // head側半球の球判定 + return TryCollideSphereAndSphere(capsuleHead, capsuleRadius, b, rb, out resolved); + } + + var t = dot / P.magnitude; + if (t >= 1.0f) + { + // tail側半球の球判定 + return TryCollideSphereAndSphere(capsuleTail, capsuleRadius, b, rb, out resolved); + } + + // head-tail上の m_transform.position との最近点 + var p = capsuleHead + P * t; + return TryCollideSphereAndSphere(p, capsuleRadius, b, rb, out resolved); + } + + /// + /// collision for strand + /// + /// + /// + /// + /// + public bool TryCollide(in Vector3 p, float radius, out LineSegment resolved) + { + if (Tail != null) + { + return TryCollideCapsuleAndSphere(transform.position, Tail.position, this.Radius, p, radius, out resolved); + } + else + { + return TryCollideSphereAndSphere(transform.position, this.Radius, p, radius, out resolved); + } + } + + public static void DrawCapsuleGizmo(Vector3 start, Vector3 end, float radius) + { + var tail = end - start; + var distance = (end - start).magnitude; + Gizmos.matrix = Matrix4x4.TRS(start, Quaternion.FromToRotation(Vector3.forward, tail), Vector3.one); + Gizmos.DrawWireSphere(Vector3.zero, radius); + Gizmos.DrawWireSphere(Vector3.forward * distance, radius); + var capsuleEnd = Vector3.forward * distance; + var offsets = new Vector3[] { new Vector3(-1.0f, 0.0f, 0.0f), new Vector3(0.0f, 1.0f, 0.0f), new Vector3(1.0f, 0.0f, 0.0f), new Vector3(0.0f, -1.0f, 0.0f) }; + for (int i = 0; i < offsets.Length; i++) + { + Gizmos.DrawLine(offsets[i] * radius, capsuleEnd + offsets[i] * radius); + } + Gizmos.matrix = Matrix4x4.identity; + } + + public void OnDrawGizmos() + { + if (SolidGizmo) + { + Gizmos.color = Color.white; + Gizmos.DrawSphere(transform.position, Radius); + } + + Gizmos.color = GizmoColor; + if (transform.parent) + { + Gizmos.DrawLine(transform.parent.position, transform.position); + } + if (Tail != null) + { + DrawCapsuleGizmo(transform.position, Tail.position, Radius); + } + else + { + Gizmos.DrawWireSphere(transform.position, Radius); + } + +#if AABB_DEBUG + Gizmos.matrix = Matrix4x4.identity; + Gizmos.color = Color.magenta; + var aabb = GetBounds(); + Gizmos.DrawWireCube(aabb.center, aabb.size); +#endif + } + } +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/SphereCapsuleCollider.cs.meta b/Assets/VRM10_Samples/ClothSample/SphereTriangle/SphereCapsuleCollider.cs.meta new file mode 100644 index 000000000..eb2d57d39 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/SphereTriangle/SphereCapsuleCollider.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4d8072930ebf6d34ea30547c75dfb378 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/SphereTriangle.asmdef b/Assets/VRM10_Samples/ClothSample/SphereTriangle/SphereTriangle.asmdef new file mode 100644 index 000000000..835b18877 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/SphereTriangle/SphereTriangle.asmdef @@ -0,0 +1,14 @@ +{ + "name": "SphereTriangle", + "rootNamespace": "", + "references": [], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": false, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/SphereTriangle.asmdef.meta b/Assets/VRM10_Samples/ClothSample/SphereTriangle/SphereTriangle.asmdef.meta new file mode 100644 index 000000000..6281600a3 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/SphereTriangle/SphereTriangle.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 0138a2c7639266f45b948ea162125de5 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/StrandGroup.cs b/Assets/VRM10_Samples/ClothSample/SphereTriangle/StrandGroup.cs new file mode 100644 index 000000000..c4392467b --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/SphereTriangle/StrandGroup.cs @@ -0,0 +1,73 @@ +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace SphereTriangle +{ + public enum StrandConnectionType + { + Cloth, + ClothLoop, + Strand, + } + + [System.Flags] + public enum CollisionGroupMask : uint + { + None = 0, + Group01 = 0x00000001, + Group02 = 0x00000002, + Group03 = 0x00000004, + Group04 = 0x00000008, + Group05 = 0x00000010, + Group06 = 0x00000020, + Group07 = 0x00000040, + Group08 = 0x00000080, + Group09 = 0x00000100, + Group10 = 0x00000200, + Group11 = 0x00000400, + Group12 = 0x00000800, + Group13 = 0x00001000, + Group14 = 0x00002000, + Group15 = 0x00004000, + Group16 = 0x00008000, + Group17 = 0x00010000, + Group18 = 0x00020000, + Group19 = 0x00040000, + Group20 = 0x00080000, + Group21 = 0x00100000, + Group22 = 0x00200000, + Group23 = 0x00400000, + Group24 = 0x00800000, + Group25 = 0x01000000, + Group26 = 0x02000000, + Group27 = 0x04000000, + Group28 = 0x08000000, + Group29 = 0x10000000, + Group30 = 0x20000000, + Group31 = 0x40000000, + Group32 = 0x80000000, + All = uint.MaxValue, + } + + [Serializable] + public class StrandGroup + { + [SerializeField] + public string Name; + + [SerializeField] + public CollisionGroupMask CollisionMask; + + [SerializeField] + public StrandConnectionType Connection; + + [SerializeField] + public List Roots = new List(); + + [SerializeField] + [Range(0.001f, 0.5f)] + public float DefaultStrandRaius = 0.05f; + + } +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/StrandGroup.cs.meta b/Assets/VRM10_Samples/ClothSample/SphereTriangle/StrandGroup.cs.meta new file mode 100644 index 000000000..4dbbe515d --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/SphereTriangle/StrandGroup.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: efab592ca762fea46adb3c38b41e65d0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/TransformSort.cs b/Assets/VRM10_Samples/ClothSample/SphereTriangle/TransformSort.cs new file mode 100644 index 000000000..99f8db10a --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/SphereTriangle/TransformSort.cs @@ -0,0 +1,40 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace SphereTriangle +{ + public class TransformSort : IComparer + { + Vector3 _o; + public TransformSort(in Vector3 origin) + { + _o = origin; + } + + static int Rot180(int d) + { + // d -= 180; + while (d < 0) + { + d += 360; + } + return d; + } + + public int Degree(Transform t) + { + var x = t.position.x - _o.x; + var y = t.position.z - _o.z; + var a = (int)(Mathf.Rad2Deg * Mathf.Atan2(x, y)); + a = Rot180(a); + // Debug.Log($"{t.name} => {a}"); + return a; + } + + public int Compare(Transform x, Transform y) + { + return Degree(x) - Degree(y); + } + } + +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/TransformSort.cs.meta b/Assets/VRM10_Samples/ClothSample/SphereTriangle/TransformSort.cs.meta new file mode 100644 index 000000000..6ecea035a --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/SphereTriangle/TransformSort.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: dcbd60313a3b8e34fbe465e9bcbcab98 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/Triangle.cs b/Assets/VRM10_Samples/ClothSample/SphereTriangle/Triangle.cs new file mode 100644 index 000000000..082007891 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/SphereTriangle/Triangle.cs @@ -0,0 +1,285 @@ +using UnityEngine; + + +namespace SphereTriangle +{ + /// + /// 三角形との交差が 2 => 交点 と 交点 + /// 三角形との交差が 1 => 交点 と 三角形内の線分端点 + /// 三角形との交差が 0 => 線分の端点が両方とも三角形内の場合。端点 と 端点 + /// + public struct TriangleSegmentIntersection + { + public float t0; + public float t1; + public TriangleSegmentIntersection(float _t0, float _t1) + { + if (_t0 <= _t1) + { + t0 = _t0; + t1 = _t1; + } + else + { + t0 = _t1; + t1 = _t0; + } + } + } + + public struct Triangle + { + public Plane Plane; + public Vector3[] Points; + + public Vector3 a => Points[0]; + public Vector3 b => Points[1]; + public Vector3 c => Points[2]; + + public Triangle(Vector3 a, Vector3 b, Vector3 c) + { + Plane = new Plane(a, b, c); + Points = new Vector3[] { a, b, c }; + } + + /// + /// p がすべての辺の同じ側(内積的な意味で)にある => 三角形の内側にある + /// + /// + /// + public bool IsSameSide(Vector3 p) + { + var da = Vector3.Dot(Vector3.Cross(p - a, b - a), Plane.normal); + var db = Vector3.Dot(Vector3.Cross(p - b, c - b), Plane.normal); + var dc = Vector3.Dot(Vector3.Cross(p - c, a - c), Plane.normal); + + if (da > 0) + { + if (db > 0) + { + if (dc > 0) + { + return true; + } + } + } + else if (da < 0) + { + if (db < 0) + { + if (dc < 0) + { + return true; + } + } + } + + return false; + } + + // /// + // /// p から lerp の係数を計算 + // /// + // /// + // /// + // /// + // /// + // static float getT(in Vector3 p0, in Vector3 p1, in Vector3 p) + // { + // return (p - p0).magnitude / (p1 - p0).magnitude; + // } + + // /// + // /// 三角形と線分の交差を判定する。 + // /// + // /// 線分始点(t=0)。三角形 abc と同一平面を期待 + // /// 線分終点(t=1)。三角形 abc と同一平面を期待 + // /// + // public bool TryIntersectSegment(in Vector3 p0, in Vector3 p1, out TriangleSegmentIntersection intersection) + // { + // // [ab bc ca] + // // [ab bc] [bc ca] [ca ab] + // // [ab] [bc] [ca] + // // [] + // if (TryIntersectSegments(p0, p1, a, b, out var ab)) + // { + // if (TryIntersectSegments(p0, p1, b, c, out var bc)) + // { + // // [ab bc] or [ab bc ca] + // intersection = new TriangleSegmentIntersection(getT(p0, p1, ab), getT(p0, p1, bc)); + // return true; + // } + // else + // { + // if (TryIntersectSegments(p0, p1, c, a, out var ca)) + // { + // // [ab ca] + // intersection = new TriangleSegmentIntersection(getT(p0, p1, ab), getT(p0, p1, ca)); + // return true; + // } + // else + // { + // // [ab] + // if (IsSameSide(p0)) + // { + // intersection = new TriangleSegmentIntersection(0, getT(p0, p1, ab)); + // return true; + // } + // else + // { + // intersection = new TriangleSegmentIntersection(getT(p0, p1, ab), 1.0f); + // return true; + // } + // } + // } + // } + // else + // { + // if (TryIntersectSegments(p0, p1, b, c, out var bc)) + // { + // if (TryIntersectSegments(p0, p1, c, a, out var ca)) + // { + // // [bc ca] + // intersection = new TriangleSegmentIntersection(getT(p0, p1, bc), getT(p0, p1, ca)); + // return true; + // } + // else + // { + // // [bc] + // if (IsSameSide(p0)) + // { + // intersection = new TriangleSegmentIntersection(0, getT(p0, p1, bc)); + // return true; + // } + // else + // { + // intersection = new TriangleSegmentIntersection(getT(p0, p1, bc), 1.0f); + // return true; + // } + // } + // } + // else + // { + // if (TryIntersectSegments(p0, p1, c, a, out var ca)) + // { + // // [ca] + // if (IsSameSide(p0)) + // { + // intersection = new TriangleSegmentIntersection(0, getT(p0, p1, ca)); + // return true; + // } + // else + // { + // intersection = new TriangleSegmentIntersection(getT(p0, p1, ca), 1.0f); + // return true; + // } + // } + // else + // { + // // [] + // if (IsSameSide(p0) && IsSameSide(p1)) + // { + // intersection = new TriangleSegmentIntersection(0, 1); + // return true; + // } + // else + // { + // intersection = default; + // return false; + // } + // } + // } + // } + // } + + // /// + // /// 線分と線分の交差を判定する + // /// a-b d + // /// / + // /// c + // /// https://qiita.com/zu_rin/items/09876d2c7ec12974bc0f + // /// + // /// + // /// + // /// + // /// + // /// + // static bool TryIntersectSegments(in Vector3 a, in Vector3 b, in Vector3 c, in Vector3 d, out Vector3 p) + // { + // var deno = Vector3.Cross(b - a, d - c).magnitude; + // if (deno < 1e-5) + // { + // // 線分が平行 + // p = default; + // return false; + // } + + // var s = Vector3.Cross(c - a, d - c).magnitude / deno; + // var t = Vector3.Cross(b - a, a - c).magnitude / deno; + // if (s < 0.0 || 1.0 < s || t < 0.0 || 1.0 < t) + // { + // // 線分が交差していない + // p = default; + // return false; + // } + + // p = new Vector3( + // a.x + s * (b - a).x, + // a.y + s * (b - a).y, + // a.z + s * (b - a).z + // ); + // return true; + // } + + // public (Vector3, float) ProjectAB(in Vector3 p) + // { + // var ab = (b - a).normalized; + // var d = Vector3.Dot(ab, (p - a)); + // var x = a + ab * d; + // return (x, d / (b - a).magnitude); + // } + // public (Vector3, float) ProjectBC(in Vector3 p) + // { + // var bc = (c - b).normalized; + // var d = Vector3.Dot(bc, (p - b)); + // var x = b + bc * d; + // return (x, d / (c - b).magnitude); + // } + // public (Vector3, float) ProjectCA(in Vector3 p) + // { + // var ca = (a - c).normalized; + // var d = Vector3.Dot(ca, (p - c)); + // var x = c + ca * d; + // return (x, d / (a - c).magnitude); + // } + + // public TriangleProjection Project(in Vector3 p) + // { + // var (ab, ta) = ProjectAB(p); + // var (bc, tb) = ProjectBC(p); + // var (ca, tc) = ProjectCA(p); + // return new TriangleProjection + // { + // ab = ab, + // ta = ta, + // bc = bc, + // tb = tb, + // ca = ca, + // tc = tc, + // }; + // } + + public void DrawGizmos() + { +#if UNITY_2022_3_OR_NEWER + Gizmos.DrawLineStrip(Points, true); +#else + for (int i = 0; i < Points.Length - 1; ++i) + { + Gizmos.DrawLine(Points[i], Points[i + 1]); + } + Gizmos.DrawLine(Points[Points.Length - 1], Points[0]); +#endif + } + } +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/Triangle.cs.meta b/Assets/VRM10_Samples/ClothSample/SphereTriangle/Triangle.cs.meta new file mode 100644 index 000000000..25ddcdea6 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/SphereTriangle/Triangle.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2558c27234db0c741a6821682205da57 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/TriangleCapsuleCollisionSolver.cs b/Assets/VRM10_Samples/ClothSample/SphereTriangle/TriangleCapsuleCollisionSolver.cs new file mode 100644 index 000000000..63d1cee79 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/SphereTriangle/TriangleCapsuleCollisionSolver.cs @@ -0,0 +1,366 @@ +// #define USE_VERTEX_DISTANCE +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace SphereTriangle +{ + [Serializable] + public class TriangleCapsuleCollisionSolver + { + public enum IntersectionType + { + PlaneInTriangle, +#if USE_VERTEX_DISTANCE + VertexDistance, +#endif + EdgeDistance, + } + + public struct Result + { + /// + /// カプセルStartの投影点が三角形内部 + /// + public LineSegment? StartInTriangle; + /// + /// カプセルEndの投影点が三角形内部 + /// + public LineSegment? EndInTriangle; + +#if USE_VERTEX_DISTANCE + /// + /// カプセル線分と頂点Aの距離が半径以内 + /// + public LineSegment? VertexADistance; + /// + /// カプセル線分と頂点Bの距離が半径以内 + /// + public LineSegment? VertexBDistance; + /// + /// カプセル線分と頂点Cの距離が半径以内 + /// + public LineSegment? VertexCDistance; +#endif + + /// + /// カプセル線分と辺ABの距離が半径以内 + /// + public LineSegment? EdgeABDistance; + /// + /// カプセル線分と辺BCの距離が半径以内 + /// + public LineSegment? EdgeBCDistance; + /// + /// カプセル線分と辺CAの距離が半径以内 + /// + public LineSegment? EdgeCADistance; + + public IntersectionType? TryGetClosest(out LineSegment value) + { + using var profile = new ProfileSample("TryGetClosest"); + var d = float.PositiveInfinity; + value = default; + IntersectionType? it = default; + + if (StartInTriangle.HasValue && StartInTriangle.Value.SqLength < d) + { + value = StartInTriangle.Value; + it = IntersectionType.PlaneInTriangle; + } + + if (EndInTriangle.HasValue && EndInTriangle.Value.SqLength < d) + { + value = EndInTriangle.Value; + it = IntersectionType.PlaneInTriangle; + } + +#if USE_VERTEX_DISTANCE + if (VertexADistance.HasValue) yield return (IntersectionType.VertexDistance, VertexADistance.Value); + if (VertexBDistance.HasValue) yield return (IntersectionType.VertexDistance, VertexBDistance.Value); + if (VertexCDistance.HasValue) yield return (IntersectionType.VertexDistance, VertexCDistance.Value); +#endif + + if (EdgeABDistance.HasValue && EdgeABDistance.Value.SqLength < d) + { + value = EdgeABDistance.Value; + it = IntersectionType.EdgeDistance; + } + + if (EdgeBCDistance.HasValue && EdgeBCDistance.Value.SqLength < d) + { + value = EdgeBCDistance.Value; + it = IntersectionType.EdgeDistance; + } + + if (EdgeCADistance.HasValue && EdgeCADistance.Value.SqLength < d) + { + value = EdgeCADistance.Value; + it = IntersectionType.EdgeDistance; + } + + return it; + } + }; + + public class Status + { + /// + /// Capsule clamped by radius distance from plane + /// + public LineSegment Clamped; + + /// + /// capsule line intersect plane + /// + public Vector3 O; + + /// + /// capsule Start project plane + /// + public Vector3 PS; + /// + /// capsule End project plane + /// + public Vector3 PE; + + public int CollisionCount = 0; + + public Result Result; + } + // 複数コライダーのデバッグ表示のため + public Dictionary collider_status_map = new(); + + public void BeginFrame() + { + collider_status_map.Clear(); + } + + public Result Collide(in Triangle t, SphereCapsuleCollider collider, in LineSegment capsule, float radius) + { + if (collider == null) + { + throw new ArgumentNullException("collider"); + } + Status status = default; + + using (new ProfileSample("Parallel Prepare")) + { + if (collider_status_map.TryGetValue(collider, out status)) + { + } + else + { + status = new Status(); + collider_status_map[collider] = status; + } + + float dot = default; + using (new ProfileSample("Dot")) + { + dot = Vector3.Dot(t.Plane.normal, capsule.Vector); + } + + if (Mathf.Abs(dot) < 1e-4) + { + using var profile = new ProfileSample("Parallel"); + // 三角面とカプセルが平行 + var d = t.Plane.GetDistanceToPoint(capsule.Start); + if (d < -radius || d > radius) + { + return default; + } + // 距離による clamp できない + status.Clamped = capsule; + } + else + { + using var profile = new ProfileSample("TryClampPlaneDistance"); + if (capsule.TryClampPlaneDistance(t.Plane, radius, out status.Clamped, out status.O)) + { + } + else + { + return default; + } + } + + using (new ProfileSample("ClosestPointOnPlane")) + { + status.PS = t.Plane.ClosestPointOnPlane(status.Clamped.Start); + status.PE = t.Plane.ClosestPointOnPlane(status.Clamped.End); + } + } + + LineSegment? startInTriangle = default; + LineSegment? endInTriangle = default; + using (new ProfileSample("InTriangle")) + { + if (t.IsSameSide(status.PS)) + { + startInTriangle = new(status.Clamped.Start, status.PS); + ++status.CollisionCount; + } + + if (t.IsSameSide(status.PE)) + { + endInTriangle = new(status.Clamped.End, status.PE); + ++status.CollisionCount; + } + } + +#if USE_VERTEX_DISTANCE + var vertexADistance = calcVertexDistance(t.a, status.Clamped, radius); + if (vertexADistance.HasValue) + { + ++status.CollisionCount; + } + var vertexBDistance = calcVertexDistance(t.b, status.Clamped, radius); + if (vertexBDistance.HasValue) + { + ++status.CollisionCount; + } + var vertexCDistance = calcVertexDistance(t.c, status.Clamped, radius); + if (vertexCDistance.HasValue) + { + ++status.CollisionCount; + } +#endif + + LineSegment? edgeABDistance = default; + LineSegment? edgeBCDistance = default; + LineSegment? edgeCADistance = default; + using (new ProfileSample("EdgeDistance")) + { + // triangle edges + var ab = new LineSegment(t.a, t.b); + var bc = new LineSegment(t.b, t.c); + var ca = new LineSegment(t.c, t.a); + + edgeABDistance = calcEdgeDistance(ab, status.Clamped, radius); + if (edgeABDistance.HasValue) + { + ++status.CollisionCount; + } + edgeBCDistance = calcEdgeDistance(bc, status.Clamped, radius); + if (edgeBCDistance.HasValue) + { + ++status.CollisionCount; + } + edgeCADistance = calcEdgeDistance(ca, status.Clamped, radius); + if (edgeCADistance.HasValue) + { + ++status.CollisionCount; + } + } + + status.Result = new Result + { + StartInTriangle = startInTriangle, + EndInTriangle = endInTriangle, +#if USE_VERTEX_DISTANCE + VertexADistance = vertexADistance, + VertexBDistance = vertexBDistance, + VertexCDistance = vertexCDistance, +#endif + EdgeABDistance = edgeABDistance, + EdgeBCDistance = edgeBCDistance, + EdgeCADistance = edgeCADistance, + }; + + return status.Result; + } + + LineSegment? calcVertexDistance(in Vector3 a, in LineSegment clamped, float radius) + { + var t = clamped.Project(a); + if (t < 0 || t > 1) + { + return default; + } + + var p = clamped.GetPoint(t); + if (Vector3.Distance(a, p) > radius) + { + return default; + } + + return new LineSegment(p, a); + } + + LineSegment? calcEdgeDistance(in LineSegment ab, in LineSegment clamped, float radius) + { + var (a_s, a_t) = LineSegment.CalcClosest(ab, clamped); + + // clamp range + a_s = Mathf.Clamp(a_s, 0, 1); + a_t = Mathf.Clamp(a_t, 0, 1); + + var ab_s = ab.GetPoint(a_s); + var ab_t = clamped.GetPoint(a_t); + + var distance_a = (ab_s - ab_t).magnitude; + if (distance_a > radius) + { + return default; + } + return new LineSegment(ab_t, ab_s); + } + + Color GetGizmoColor(IntersectionType type, float color) + { + var g = new Color(0.3f, 0.3f, 0.3f); + return Color.Lerp(g, type.ToColor(), color); + } + + public void DrawGizmos(in Triangle t, float collision, float radius) + { + Gizmos.matrix = Matrix4x4.identity; + + var hit = false; + foreach (var (_, status) in collider_status_map) + { + var type = status.Result.TryGetClosest(out var l); + if (!type.HasValue) + { + continue; + } + + // capsule + hit = true; + Gizmos.color = GetGizmoColor(type.Value, collision); + t.DrawGizmos(); + l.DrawGizmos(); + Gizmos.DrawSphere(l.End, radius); + Gizmos.DrawWireSphere(l.Start, radius); + } + + if (!hit) + { + Gizmos.color = Color.gray; + t.DrawGizmos(); + } + } + } + + public static class IntersectionTypeExtensions + { + public static Color ToColor(this TriangleCapsuleCollisionSolver.IntersectionType type) + { + switch (type) + { + case TriangleCapsuleCollisionSolver.IntersectionType.PlaneInTriangle: + return Color.magenta; +#if USE_VERTEX_DISTANCE + case TriangleCapsuleCollisionSolver.IntersectionType.VertexDistance: + return Color.blue; +#endif + case TriangleCapsuleCollisionSolver.IntersectionType.EdgeDistance: + return Color.cyan; + + default: + throw new Exception(); + } + } + } +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/TriangleCapsuleCollisionSolver.cs.meta b/Assets/VRM10_Samples/ClothSample/SphereTriangle/TriangleCapsuleCollisionSolver.cs.meta new file mode 100644 index 000000000..0206377af --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/SphereTriangle/TriangleCapsuleCollisionSolver.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c4efecee94290be43b3affbcc6bd191a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/TriangleCapsuleGizmo.cs b/Assets/VRM10_Samples/ClothSample/SphereTriangle/TriangleCapsuleGizmo.cs new file mode 100644 index 000000000..f73cd67d4 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/SphereTriangle/TriangleCapsuleGizmo.cs @@ -0,0 +1,64 @@ +using UnityEngine; + + +namespace SphereTriangle +{ + public class TriangleCapsuleGizmo : MonoBehaviour + { + public Transform B; + public Transform C; + public SphereCapsuleCollider Capsule; + + void Reset() + { + for (int i = 0; i < transform.childCount; ++i) + { + switch (i) + { + case 0: + if (this.B == null) B = transform.GetChild(i); + break; + + case 1: + if (this.C == null) C = transform.GetChild(i); + break; + } + } + } + + [SerializeField] + TriangleCapsuleCollisionSolver _solver = new(); + + public void OnDrawGizmos() + { + if (B == null) return; + if (C == null) return; + var t = new Triangle(transform.position, B.position, C.position); + + if (Capsule?.Tail == null) return; + var capsule = new LineSegment(Capsule.transform.position, Capsule.Tail.position); + + _solver.BeginFrame(); + var result = _solver.Collide(t, Capsule, capsule, Capsule.Radius); + var type = result.TryGetClosest(out var l); + if (!type.HasValue) + { + Gizmos.color = Color.gray; + t.DrawGizmos(); + return; + } + + _solver.DrawGizmos(t, 1.0f, Capsule.Radius); + + Gizmos.color = Color.magenta; + Gizmos.DrawLine(l.Start, l.End); + Gizmos.DrawSphere(l.End, 0.01f); + Gizmos.DrawWireSphere(l.Start, 0.02f); + + var delta = l.Vector.normalized * (Capsule.Radius - l.Length); + Gizmos.color = Color.green; + Gizmos.DrawLine(l.End, l.End + delta); + Gizmos.DrawSphere(l.End + delta, 0.01f); + } + } +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/TriangleCapsuleGizmo.cs.meta b/Assets/VRM10_Samples/ClothSample/SphereTriangle/TriangleCapsuleGizmo.cs.meta new file mode 100644 index 000000000..035e2cf48 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/SphereTriangle/TriangleCapsuleGizmo.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c201feca8fd8c644b987521e89706c4f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: From 3936ce5efa10076a30a2cf71e29eeefdfde13d8a Mon Sep 17 00:00:00 2001 From: ousttrue Date: Thu, 17 Oct 2024 21:33:51 +0900 Subject: [PATCH 017/113] ClothViewer --- .../ClothSample/ClothViewer.meta | 8 + .../ClothSample/ClothViewer/ClothAIUEO.cs | 73 + .../ClothViewer/ClothAIUEO.cs.meta | 13 + .../ClothViewer/ClothAutoExpression.cs | 76 + .../ClothViewer/ClothAutoExpression.cs.meta | 11 + .../ClothSample/ClothViewer/ClothBlinker.cs | 116 + .../ClothViewer/ClothBlinker.cs.meta | 11 + .../ClothViewer/ClothFileDialogForWindows.cs | 118 + .../ClothFileDialogForWindows.cs.meta | 11 + .../ClothSample/ClothViewer/ClothLoaded.cs | 93 + .../ClothViewer/ClothLoaded.cs.meta | 11 + .../ClothViewer/ClothRokuroCamera.cs | 137 + .../ClothViewer/ClothRokuroCamera.cs.meta | 13 + .../ClothViewer/ClothTargetMover.cs | 40 + .../ClothViewer/ClothTargetMover.cs.meta | 12 + .../ClothViewer/ClothViewer.asmdef | 20 + .../ClothViewer/ClothViewer.asmdef.meta | 7 + .../ClothSample/ClothViewer/ClothViewer.unity | 8382 +++++++++++++++++ .../ClothViewer/ClothViewer.unity.meta | 7 + .../ClothSample/ClothViewer/ClothViewerUI.cs | 628 ++ .../ClothViewer/ClothViewerUI.cs.meta | 11 + .../ClothSample/ClothViewer/Motions.meta | 8 + .../ClothViewer/Motions/BvhMotion.cs | 63 + .../ClothViewer/Motions/BvhMotion.cs.meta | 11 + .../Motions/vrm10viewer_test_motion.txt | 4136 ++++++++ .../Motions/vrm10viewer_test_motion.txt.meta | 8 + 26 files changed, 14024 insertions(+) create mode 100644 Assets/VRM10_Samples/ClothSample/ClothViewer.meta create mode 100644 Assets/VRM10_Samples/ClothSample/ClothViewer/ClothAIUEO.cs create mode 100644 Assets/VRM10_Samples/ClothSample/ClothViewer/ClothAIUEO.cs.meta create mode 100644 Assets/VRM10_Samples/ClothSample/ClothViewer/ClothAutoExpression.cs create mode 100644 Assets/VRM10_Samples/ClothSample/ClothViewer/ClothAutoExpression.cs.meta create mode 100644 Assets/VRM10_Samples/ClothSample/ClothViewer/ClothBlinker.cs create mode 100644 Assets/VRM10_Samples/ClothSample/ClothViewer/ClothBlinker.cs.meta create mode 100644 Assets/VRM10_Samples/ClothSample/ClothViewer/ClothFileDialogForWindows.cs create mode 100644 Assets/VRM10_Samples/ClothSample/ClothViewer/ClothFileDialogForWindows.cs.meta create mode 100644 Assets/VRM10_Samples/ClothSample/ClothViewer/ClothLoaded.cs create mode 100644 Assets/VRM10_Samples/ClothSample/ClothViewer/ClothLoaded.cs.meta create mode 100644 Assets/VRM10_Samples/ClothSample/ClothViewer/ClothRokuroCamera.cs create mode 100644 Assets/VRM10_Samples/ClothSample/ClothViewer/ClothRokuroCamera.cs.meta create mode 100644 Assets/VRM10_Samples/ClothSample/ClothViewer/ClothTargetMover.cs create mode 100644 Assets/VRM10_Samples/ClothSample/ClothViewer/ClothTargetMover.cs.meta create mode 100644 Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewer.asmdef create mode 100644 Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewer.asmdef.meta create mode 100644 Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewer.unity create mode 100644 Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewer.unity.meta create mode 100644 Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewerUI.cs create mode 100644 Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewerUI.cs.meta create mode 100644 Assets/VRM10_Samples/ClothSample/ClothViewer/Motions.meta create mode 100644 Assets/VRM10_Samples/ClothSample/ClothViewer/Motions/BvhMotion.cs create mode 100644 Assets/VRM10_Samples/ClothSample/ClothViewer/Motions/BvhMotion.cs.meta create mode 100644 Assets/VRM10_Samples/ClothSample/ClothViewer/Motions/vrm10viewer_test_motion.txt create mode 100644 Assets/VRM10_Samples/ClothSample/ClothViewer/Motions/vrm10viewer_test_motion.txt.meta diff --git a/Assets/VRM10_Samples/ClothSample/ClothViewer.meta b/Assets/VRM10_Samples/ClothSample/ClothViewer.meta new file mode 100644 index 000000000..7c1a8169b --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/ClothViewer.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: db40660c554df69458e2f1385c6b5b89 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothAIUEO.cs b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothAIUEO.cs new file mode 100644 index 000000000..86cce7bc1 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothAIUEO.cs @@ -0,0 +1,73 @@ +using System.Collections; +using UnityEngine; + + +namespace UniVRM10.Cloth.Viewer +{ + public class ClothAIUEO : MonoBehaviour + { + [SerializeField] + public Vrm10Instance Controller; + private void Reset() + { + Controller = GetComponent(); + } + + Coroutine m_coroutine; + + [SerializeField] + float m_wait = 0.5f; + + private void Awake() + { + if (Controller == null) + { + Controller = GetComponent(); + } + } + + IEnumerator RoutineNest(ExpressionPreset preset, float velocity, float wait) + { + for (var value = 0.0f; value <= 1.0f; value += velocity) + { + Controller.Runtime.Expression.SetWeight(ExpressionKey.CreateFromPreset(preset), value); + yield return null; + } + Controller.Runtime.Expression.SetWeight(ExpressionKey.CreateFromPreset(preset), 1.0f); + yield return new WaitForSeconds(wait); + for (var value = 1.0f; value >= 0; value -= velocity) + { + Controller.Runtime.Expression.SetWeight(ExpressionKey.CreateFromPreset(preset), value); + yield return null; + } + Controller.Runtime.Expression.SetWeight(ExpressionKey.CreateFromPreset(preset), 0); + yield return new WaitForSeconds(wait * 2); + } + + IEnumerator Routine() + { + while (true) + { + yield return new WaitForSeconds(1.0f); + + var velocity = 0.1f; + + yield return RoutineNest(ExpressionPreset.aa, velocity, m_wait); + yield return RoutineNest(ExpressionPreset.ih, velocity, m_wait); + yield return RoutineNest(ExpressionPreset.ou, velocity, m_wait); + yield return RoutineNest(ExpressionPreset.ee, velocity, m_wait); + yield return RoutineNest(ExpressionPreset.oh, velocity, m_wait); + } + } + + private void OnEnable() + { + m_coroutine = StartCoroutine(Routine()); + } + + private void OnDisable() + { + StopCoroutine(m_coroutine); + } + } +} diff --git a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothAIUEO.cs.meta b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothAIUEO.cs.meta new file mode 100644 index 000000000..f363c9146 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothAIUEO.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 915733a6f44f9554cae9a093cca75906 +timeCreated: 1517463794 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothAutoExpression.cs b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothAutoExpression.cs new file mode 100644 index 000000000..1ec5a9482 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothAutoExpression.cs @@ -0,0 +1,76 @@ +using System.Collections; +using UnityEngine; + + +namespace UniVRM10.Cloth.Viewer +{ + /// + /// 喜怒哀楽驚を循環させる + /// + public class ClothAutoExpression : MonoBehaviour + { + [SerializeField] + public Vrm10Instance Controller; + private void Reset() + { + Controller = GetComponent(); + } + + Coroutine m_coroutine; + + [SerializeField] + float m_wait = 0.5f; + + private void Awake() + { + if (Controller == null) + { + Controller = GetComponent(); + } + } + + IEnumerator RoutineNest(ExpressionPreset preset, float velocity, float wait) + { + for (var value = 0.0f; value <= 1.0f; value += velocity) + { + Controller.Runtime.Expression.SetWeight(ExpressionKey.CreateFromPreset(preset), value); + yield return null; + } + Controller.Runtime.Expression.SetWeight(ExpressionKey.CreateFromPreset(preset), 1.0f); + yield return new WaitForSeconds(wait); + for (var value = 1.0f; value >= 0; value -= velocity) + { + Controller.Runtime.Expression.SetWeight(ExpressionKey.CreateFromPreset(preset), value); + yield return null; + } + Controller.Runtime.Expression.SetWeight(ExpressionKey.CreateFromPreset(preset), 0); + yield return new WaitForSeconds(wait * 2); + } + + IEnumerator Routine() + { + while (true) + { + yield return new WaitForSeconds(1.0f); + + var velocity = 0.01f; + + yield return RoutineNest(ExpressionPreset.happy, velocity, m_wait); + yield return RoutineNest(ExpressionPreset.angry, velocity, m_wait); + yield return RoutineNest(ExpressionPreset.sad, velocity, m_wait); + yield return RoutineNest(ExpressionPreset.relaxed, velocity, m_wait); + yield return RoutineNest(ExpressionPreset.surprised, velocity, m_wait); + } + } + + private void OnEnable() + { + m_coroutine = StartCoroutine(Routine()); + } + + private void OnDisable() + { + StopCoroutine(m_coroutine); + } + } +} diff --git a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothAutoExpression.cs.meta b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothAutoExpression.cs.meta new file mode 100644 index 000000000..589070c56 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothAutoExpression.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 974382c74d34d85488192569177a07a6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothBlinker.cs b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothBlinker.cs new file mode 100644 index 000000000..7200f2822 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothBlinker.cs @@ -0,0 +1,116 @@ +using System.Collections; +using UnityEngine; +using UnityEngine.Serialization; + +namespace UniVRM10.Cloth.Viewer +{ + /// + /// VRMBlendShapeProxy によるランダムに瞬きするサンプル。 + /// VRMBlendShapeProxy のある GameObject にアタッチする。 + /// + public class ClothBlinker : MonoBehaviour + { + Vrm10Instance m_controller; + + [FormerlySerializedAs("m_interVal")] + [SerializeField] + public float Interval = 5.0f; + + [FormerlySerializedAs("m_closingTime")] + [SerializeField] + public float ClosingTime = 0.06f; + + [FormerlySerializedAs("m_openingSeconds")] + [SerializeField] + public float OpeningSeconds = 0.03f; + + [FormerlySerializedAs("m_closeSeconds")] + [SerializeField] + public float CloseSeconds = 0.1f; + + Coroutine m_coroutine; + + float m_nextRequest; + bool m_request; + public bool Request + { + get { return m_request; } + set + { + if (Time.time < m_nextRequest) + { + return; + } + m_request = value; + m_nextRequest = Time.time + 1.0f; + } + } + + IEnumerator BlinkRoutine() + { + while (true) + { + var waitTime = Time.time + Random.value * Interval; + while (waitTime > Time.time) + { + if (Request) + { + m_request = false; + break; + } + yield return null; + } + + // close + var value = 0.0f; + var closeSpeed = 1.0f / CloseSeconds; + while (true) + { + value += Time.deltaTime * closeSpeed; + if (value >= 1.0f) + { + break; + } + + m_controller.Runtime.Expression.SetWeight(ExpressionKey.CreateFromPreset(ExpressionPreset.blink), value); + yield return null; + } + m_controller.Runtime.Expression.SetWeight(ExpressionKey.CreateFromPreset(ExpressionPreset.blink), 1.0f); + + // wait... + yield return new WaitForSeconds(ClosingTime); + + // open + value = 1.0f; + var openSpeed = 1.0f / OpeningSeconds; + while (true) + { + value -= Time.deltaTime * openSpeed; + if (value < 0) + { + break; + } + + m_controller.Runtime.Expression.SetWeight(ExpressionKey.CreateFromPreset(ExpressionPreset.blink), value); + yield return null; + } + m_controller.Runtime.Expression.SetWeight(ExpressionKey.CreateFromPreset(ExpressionPreset.blink), 0); + } + } + + private void OnEnable() + { + m_controller = GetComponent(); + m_coroutine = StartCoroutine(BlinkRoutine()); + } + + private void OnDisable() + { + if (m_coroutine != null) + { + StopCoroutine(m_coroutine); + m_coroutine = null; + } + } + } +} diff --git a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothBlinker.cs.meta b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothBlinker.cs.meta new file mode 100644 index 000000000..0b7e22f53 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothBlinker.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: be508240e6f6f57418cca09778dc2546 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothFileDialogForWindows.cs b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothFileDialogForWindows.cs new file mode 100644 index 000000000..f92f7ab7d --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothFileDialogForWindows.cs @@ -0,0 +1,118 @@ +#if UNITY_STANDALONE_WIN +using System; +using System.Collections.Generic; +using System.IO; +using System.Runtime.InteropServices; +#endif + + +namespace UniVRM10.Cloth.Viewer +{ + public static class ClothFileDialogForWindows + { +#if UNITY_STANDALONE_WIN + #region GetOpenFileName + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] + public class OpenFileName + { + public int structSize = 0; + public IntPtr dlgOwner = IntPtr.Zero; + public IntPtr instance = IntPtr.Zero; + public String filter = null; + public String customFilter = null; + public int maxCustFilter = 0; + public int filterIndex = 0; + public String file = null; + public int maxFile = 0; + public String fileTitle = null; + public int maxFileTitle = 0; + public String initialDir = null; + public String title = null; + public int flags = 0; + public short fileOffset = 0; + public short fileExtension = 0; + public String defExt = null; + public IntPtr custData = IntPtr.Zero; + public IntPtr hook = IntPtr.Zero; + public String templateName = null; + public IntPtr reservedPtr = IntPtr.Zero; + public int reservedInt = 0; + public int flagsEx = 0; + } + + [DllImport("Comdlg32.dll", SetLastError = true, ThrowOnUnmappableChar = true, CharSet = CharSet.Auto)] + public static extern bool GetOpenFileName([In, Out] OpenFileName ofn); + /* + public static bool GetOpenFileName1([In, Out] OpenFileName ofn) + { + return GetOpenFileName(ofn); + } + */ + + [DllImport("Comdlg32.dll", SetLastError = true, CharSet = CharSet.Auto)] + private static extern bool GetSaveFileName([In, Out] OpenFileName ofn); + + static string Filter(params string[] filters) + { + return string.Join("\0", filters) + "\0"; + } + public static string FileDialog(string title, params string[] extensions) + { + OpenFileName ofn = new OpenFileName(); + ofn.structSize = Marshal.SizeOf(ofn); + + var filters = new List(); + filters.Add("All Files"); filters.Add("*.*"); + foreach (var ext in extensions) + { + filters.Add(ext); filters.Add("*" + ext); + } + ofn.filter = Filter(filters.ToArray()); + ofn.filterIndex = 2; + ofn.file = new string(new char[256]); + ofn.maxFile = ofn.file.Length; + ofn.fileTitle = new string(new char[64]); + ofn.maxFileTitle = ofn.fileTitle.Length; + ofn.initialDir = UnityEngine.Application.dataPath; + ofn.title = title; + //ofn.defExt = "PNG"; + ofn.flags = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000200 | 0x00000008;//OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST| OFN_ALLOWMULTISELECT|OFN_NOCHANGEDIR + if (!GetOpenFileName(ofn)) + { + return null; + } + + return ofn.file; + } + public static string SaveDialog(string title, string path) + { + var extension = Path.GetExtension(path); + OpenFileName ofn = new OpenFileName(); + ofn.structSize = Marshal.SizeOf(ofn); + ofn.filter = Filter("All Files", "*.*", extension, "*" + extension); + ofn.filterIndex = 2; + var chars = new char[256]; + var it = Path.GetFileName(path).GetEnumerator(); + for (int i = 0; i < chars.Length && it.MoveNext(); ++i) + { + chars[i] = it.Current; + } + ofn.file = new string(chars); + ofn.maxFile = ofn.file.Length; + ofn.fileTitle = new string(new char[64]); + ofn.maxFileTitle = ofn.fileTitle.Length; + ofn.initialDir = Path.GetDirectoryName(path); + ofn.title = title; + //ofn.defExt = "PNG"; + ofn.flags = 0x00000002 | 0x00000004; // OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY; + if (!GetSaveFileName(ofn)) + { + return null; + } + + return ofn.file; + } + #endregion +#endif + } +} diff --git a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothFileDialogForWindows.cs.meta b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothFileDialogForWindows.cs.meta new file mode 100644 index 000000000..0faad90bb --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothFileDialogForWindows.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: aad95bf34c27466469ba37298cd4028c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothLoaded.cs b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothLoaded.cs new file mode 100644 index 000000000..eeb413ba2 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothLoaded.cs @@ -0,0 +1,93 @@ +using System; +using UniGLTF; +using UnityEngine; + +namespace UniVRM10.Cloth.Viewer +{ + class Loaded : IDisposable + { + RuntimeGltfInstance m_instance; + public RuntimeGltfInstance Instance => m_instance; + Vrm10Instance m_controller; + public Vrm10RuntimeControlRig ControlRig => m_controller.Runtime.ControlRig; + public Vrm10Runtime Runtime => m_controller.Runtime; + + ClothAIUEO m_lipSync; + bool m_enableLipSyncValue; + public bool EnableLipSyncValue + { + set + { + if (m_enableLipSyncValue == value) return; + m_enableLipSyncValue = value; + if (m_lipSync != null) + { + m_lipSync.enabled = m_enableLipSyncValue; + } + } + } + + ClothAutoExpression m_autoExpression; + bool m_enableAutoExpressionValue; + public bool EnableAutoExpressionValue + { + set + { + if (m_enableAutoExpressionValue == value) return; + m_enableAutoExpressionValue = value; + if (m_autoExpression != null) + { + m_autoExpression.enabled = m_enableAutoExpressionValue; + } + } + } + + ClothBlinker m_blink; + bool m_enableBlinkValue; + public bool EnableBlinkValue + { + set + { + if (m_blink == value) return; + m_enableBlinkValue = value; + if (m_blink != null) + { + m_blink.enabled = m_enableBlinkValue; + } + } + } + + public Loaded(RuntimeGltfInstance instance, Transform lookAtTarget) + { + m_instance = instance; + + m_controller = instance.GetComponent(); + if (m_controller != null) + { + // VRM + m_controller.UpdateType = Vrm10Instance.UpdateTypes.LateUpdate; // after HumanPoseTransfer's setPose + { + m_lipSync = instance.gameObject.AddComponent(); + m_blink = instance.gameObject.AddComponent(); + m_autoExpression = instance.gameObject.AddComponent(); + + m_controller.LookAtTargetType = VRM10ObjectLookAt.LookAtTargetTypes.SpecifiedTransform; + m_controller.LookAtTarget = lookAtTarget; + } + } + + var animation = instance.GetComponent(); + if (animation && animation.clip != null) + { + // GLTF animation + animation.Play(animation.clip.name); + } + } + + public void Dispose() + { + // destroy GameObject + GameObject.Destroy(m_instance.gameObject); + } + } +} diff --git a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothLoaded.cs.meta b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothLoaded.cs.meta new file mode 100644 index 000000000..79edd29ba --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothLoaded.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b68db84044b3ee84aba85929dad95494 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothRokuroCamera.cs b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothRokuroCamera.cs new file mode 100644 index 000000000..a5fae5c0b --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothRokuroCamera.cs @@ -0,0 +1,137 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + + +namespace VRM.VRM10RokuroCamera +{ + public class ClothRokuroCamera : MonoBehaviour + { + [Range(0.1f, 5.0f)] + public float RotateSpeed = 0.7f; + + [Range(0.1f, 5.0f)] + public float GrabSpeed = 0.7f; + + [Range(0.1f, 5.0f)] + public float DollySpeed = 1.0f; + + struct PosRot + { + public Vector3 Position; + public Quaternion Rotation; + } + + class _Rokuro + { + public float Yaw = 180.0f; + public float Pitch; + public float ShiftX; + public float ShiftY; + public float Distance = 2.0f; + + public void Rotate(float x, float y) + { + Yaw += x; + Pitch -= y; + Pitch = Mathf.Clamp(Pitch, -90, 90); + } + + public void Grab(float x, float y) + { + ShiftX += x * Distance; + ShiftY += y * Distance; + } + + public void Dolly(float delta) + { + if (delta > 0) + { + Distance *= 0.9f; + } + else if (delta < 0) + { + Distance *= 1.1f; + } + } + + public PosRot Calc() + { + var r = Quaternion.Euler(Pitch, Yaw, 0); + return new PosRot + { + Position = r * new Vector3(-ShiftX, -ShiftY, -Distance), + Rotation = r, + }; + } + } + private _Rokuro _currentCamera = new _Rokuro(); + + private List _activeCoroutines = new List(); + private void OnEnable() + { + // right mouse drag + _activeCoroutines.Add(StartCoroutine(MouseDragOperationCoroutine(1, diff => + { + _currentCamera.Rotate(diff.x * RotateSpeed, diff.y * RotateSpeed); + }))); + // middle mouse drag + _activeCoroutines.Add(StartCoroutine(MouseDragOperationCoroutine(2, diff => + { + _currentCamera.Grab( + diff.x * GrabSpeed / Screen.height, + diff.y * GrabSpeed / Screen.height + ); + }))); + // mouse wheel + _activeCoroutines.Add(StartCoroutine(MouseScrollOperationCoroutine(diff => + { + _currentCamera.Dolly(diff.y * DollySpeed); + }))); + } + private void OnDisable() + { + foreach (var coroutine in _activeCoroutines) + { + StopCoroutine(coroutine); + } + _activeCoroutines.Clear(); + } + private void Update() + { + var posRot = _currentCamera.Calc(); + + transform.localRotation = posRot.Rotation; + transform.localPosition = posRot.Position; + } + private IEnumerator MouseDragOperationCoroutine(int buttonIndex, Action dragOperation) + { + while (true) + { + while (!Input.GetMouseButtonDown(buttonIndex)) + { + yield return null; + } + var prevPos = Input.mousePosition; + while (Input.GetMouseButton(buttonIndex)) + { + var currPos = Input.mousePosition; + var diff = currPos - prevPos; + dragOperation(diff); + + prevPos = currPos; + yield return null; + } + } + } + private IEnumerator MouseScrollOperationCoroutine(Action scrollOperation) + { + while (true) + { + scrollOperation(Input.mouseScrollDelta); + yield return null; + } + } + } +} diff --git a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothRokuroCamera.cs.meta b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothRokuroCamera.cs.meta new file mode 100644 index 000000000..184fb20c3 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothRokuroCamera.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 93dcf1b2cc4d917489620707e78e9f27 +timeCreated: 1523878901 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothTargetMover.cs b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothTargetMover.cs new file mode 100644 index 000000000..8348fb86c --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothTargetMover.cs @@ -0,0 +1,40 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + + +namespace UniVRM10.Cloth.Viewer +{ + public class ClothTargetMover : MonoBehaviour + { + [SerializeField] + float m_radius = 5.0f; + + [SerializeField] + float m_angularVelocity = 40.0f; + + [SerializeField] + float m_y = 1.5f; + + [SerializeField] + float m_height = 3.0f; + + public IEnumerator Start() + { + var angle = 0.0f; + + while (true) + { + angle += m_angularVelocity * Time.deltaTime * Mathf.Deg2Rad; + + var x = Mathf.Cos(angle) * m_radius; + var z = Mathf.Sin(angle) * m_radius; + var y = m_y + m_height * Mathf.Cos(angle / 3); + + transform.localPosition = new Vector3(x, y, z); + + yield return null; + } + } + } +} diff --git a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothTargetMover.cs.meta b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothTargetMover.cs.meta new file mode 100644 index 000000000..fb7b47088 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothTargetMover.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 0bc0c019f7af45745aa41b25018fd61f +timeCreated: 1524045545 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewer.asmdef b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewer.asmdef new file mode 100644 index 000000000..75b04563e --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewer.asmdef @@ -0,0 +1,20 @@ +{ + "name": "ClothViewer", + "rootNamespace": "", + "references": [ + "GUID:b7aa47b240b57de44a4b2021c143c9bf", + "GUID:8d76e605759c3f64a957d63ef96ada7c", + "GUID:1cd941934d098654fa21a13f28346412", + "GUID:e47c917724578cc43b5506c17a27e9a0", + "GUID:308b348fb80d89d42a9620951b0f60db" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewer.asmdef.meta b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewer.asmdef.meta new file mode 100644 index 000000000..40bdfa64a --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewer.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 623c6cdde4acc6641978d011f67c5b87 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewer.unity b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewer.unity new file mode 100644 index 000000000..c52c3e245 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewer.unity @@ -0,0 +1,8382 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0.18028381, g: 0.22571406, b: 0.30692294, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 12 + m_GIWorkflowMode: 0 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 1 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 0 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 500 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 2 + m_PVRDenoiserTypeDirect: 0 + m_PVRDenoiserTypeIndirect: 0 + m_PVRDenoiserTypeAO: 0 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 0 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 0} + m_LightingSettings: {fileID: 4890085278179872738, guid: 77ca82a2630b21248b10f4270ff2e6d0, + type: 2} +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &62367394 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 62367395} + - component: {fileID: 62367397} + - component: {fileID: 62367396} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &62367395 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 62367394} + 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_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1189866557} + m_Father: {fileID: 1767738854} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 10, y: -10} + m_SizeDelta: {x: 20, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &62367396 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 62367394} + 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 &62367397 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 62367394} + m_CullTransparentMesh: 0 +--- !u!1 &103723703 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 103723704} + - component: {fileID: 103723706} + - component: {fileID: 103723705} + m_Layer: 5 + m_Name: _ImportOption_ + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &103723704 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 103723703} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 339774397} + m_RootOrder: 18 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 178, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &103723705 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 103723703} + 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: 1 + 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: Import Option +--- !u!222 &103723706 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 103723703} + m_CullTransparentMesh: 0 +--- !u!1 &124675793 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 124675794} + m_Layer: 5 + m_Name: Root + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &124675794 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 124675793} + 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_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 339774397} + - {fileID: 1087391117} + - {fileID: 644517400} + - {fileID: 1268276255} + m_Father: {fileID: 1787938566} + 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!1 &153452228 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 153452229} + - component: {fileID: 153452230} + m_Layer: 5 + m_Name: PauseSpringBone + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &153452229 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 153452228} + 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_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1263556355} + - {fileID: 1422965364} + m_Father: {fileID: 339774397} + m_RootOrder: 7 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 162, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &153452230 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 153452228} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9085046f02f69544eb97fd06b6048fe2, 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: Highlighted + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 1263556356} + toggleTransition: 1 + graphic: {fileID: 962537953} + m_Group: {fileID: 224350194} + onValueChanged: + m_PersistentCalls: + m_Calls: [] + m_IsOn: 0 +--- !u!1 &154330167 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 154330168} + - component: {fileID: 154330170} + - component: {fileID: 154330169} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &154330168 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 154330167} + 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_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1270311309} + m_Father: {fileID: 602093298} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 10, y: -10} + m_SizeDelta: {x: 20, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &154330169 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 154330167} + 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 &154330170 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 154330167} + m_CullTransparentMesh: 0 +--- !u!1 &168425994 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 168425995} + - component: {fileID: 168425998} + - component: {fileID: 168425997} + - component: {fileID: 168425996} + m_Layer: 5 + m_Name: OpenMotion + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &168425995 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 168425994} + 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_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1923525315} + m_Father: {fileID: 339774397} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 162, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &168425996 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 168425994} + 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: Highlighted + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 168425997} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!114 &168425997 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 168425994} + 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 &168425998 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 168425994} + m_CullTransparentMesh: 0 +--- !u!1 &175751362 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 175751363} + - component: {fileID: 175751364} + - component: {fileID: 175751365} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &175751363 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 175751362} + 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_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 450042406} + m_Father: {fileID: 935566651} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 10, y: -10} + m_SizeDelta: {x: 20, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &175751364 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 175751362} + m_CullTransparentMesh: 0 +--- !u!114 &175751365 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 175751362} + 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!1 &188310738 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 188310739} + - component: {fileID: 188310741} + - component: {fileID: 188310740} + m_Layer: 5 + m_Name: Checkmark + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &188310739 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 188310738} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 2010083454} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 20, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &188310740 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 188310738} + 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: 10901, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 0 + 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 &188310741 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 188310738} + m_CullTransparentMesh: 0 +--- !u!1 &204388501 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 204388504} + - component: {fileID: 204388503} + - component: {fileID: 204388502} + m_Layer: 0 + m_Name: EventSystem + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &204388502 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 204388501} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3} + m_Name: + m_EditorClassIdentifier: + m_SendPointerHoverToParent: 1 + m_HorizontalAxis: Horizontal + m_VerticalAxis: Vertical + m_SubmitButton: Submit + m_CancelButton: Cancel + m_InputActionsPerSecond: 10 + m_RepeatDelay: 0.5 + m_ForceModuleActive: 0 +--- !u!114 &204388503 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 204388501} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3} + m_Name: + m_EditorClassIdentifier: + m_FirstSelected: {fileID: 0} + m_sendNavigationEvents: 1 + m_DragThreshold: 5 +--- !u!4 &204388504 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 204388501} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &224350190 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 224350191} + - component: {fileID: 224350193} + - component: {fileID: 224350192} + - component: {fileID: 224350194} + m_Layer: 5 + m_Name: _Motion_ + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &224350191 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 224350190} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 339774397} + m_RootOrder: 8 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 178, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &224350192 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 224350190} + 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: 1 + 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: Motion +--- !u!222 &224350193 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 224350190} + m_CullTransparentMesh: 0 +--- !u!114 &224350194 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 224350190} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 2fafe2cfe61f6974895a912c3755e8f1, type: 3} + m_Name: + m_EditorClassIdentifier: + m_AllowSwitchOff: 0 +--- !u!1 &241398688 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 241398689} + m_Layer: 0 + m_Name: CameraOrigin + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &241398689 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 241398688} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1.2, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1629460662} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &251940583 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 251940584} + - component: {fileID: 251940586} + - component: {fileID: 251940585} + m_Layer: 5 + m_Name: Checkmark + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &251940584 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 251940583} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 452923209} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 20, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &251940585 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 251940583} + 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: 10901, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 0 + 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 &251940586 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 251940583} + m_CullTransparentMesh: 0 +--- !u!1 &284921870 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 284921871} + - component: {fileID: 284921873} + - component: {fileID: 284921872} + m_Layer: 5 + m_Name: _ + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &284921871 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 284921870} + 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_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 800895692} + m_Father: {fileID: 644517400} + m_RootOrder: 7 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 297, y: 100} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &284921872 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 284921870} + 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: 1 + 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: +--- !u!222 &284921873 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 284921870} + m_CullTransparentMesh: 0 +--- !u!1 &310000825 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 310000826} + - component: {fileID: 310000828} + - component: {fileID: 310000827} + m_Layer: 5 + m_Name: _Permission_ + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &310000826 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 310000825} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 644517400} + m_RootOrder: 8 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 297, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &310000827 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 310000825} + 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: 1 + 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: "\u30A2\u30D0\u30BF\u30FC\u306E\u4EBA\u683C\u306B\u95A2\u3059\u308B\u8A31\u8AFE\u7BC4\u56F2" +--- !u!222 &310000828 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 310000825} + m_CullTransparentMesh: 0 +--- !u!1 &322182884 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 322182885} + - component: {fileID: 322182888} + - component: {fileID: 322182887} + - component: {fileID: 322182886} + m_Layer: 0 + m_Name: Plane + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &322182885 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 322182884} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 5 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!23 &322182886 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 322182884} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!64 &322182887 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 322182884} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 4 + m_Convex: 0 + m_CookingOptions: 30 + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!33 &322182888 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 322182884} + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &339774396 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 339774397} + - component: {fileID: 339774400} + - component: {fileID: 339774399} + - component: {fileID: 339774398} + m_Layer: 5 + m_Name: LeftPanel + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &339774397 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 339774396} + 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_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1621794411} + - {fileID: 2009818432} + - {fileID: 168425995} + - {fileID: 1307084561} + - {fileID: 947409974} + - {fileID: 2144476967} + - {fileID: 1194499280} + - {fileID: 153452229} + - {fileID: 224350191} + - {fileID: 1791103379} + - {fileID: 1311520909} + - {fileID: 1557052150} + - {fileID: 1767706907} + - {fileID: 974864191} + - {fileID: 597950322} + - {fileID: 935566651} + - {fileID: 634488421} + - {fileID: 1767738854} + - {fileID: 103723704} + - {fileID: 1438613464} + - {fileID: 602093298} + m_Father: {fileID: 124675794} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 89, y: 0} + m_SizeDelta: {x: 178, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &339774398 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 339774396} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 59f8146938fff824cb5fd77236b75775, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Padding: + m_Left: 5 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_ChildAlignment: 0 + m_Spacing: 5 + m_ChildForceExpandWidth: 1 + m_ChildForceExpandHeight: 0 + m_ChildControlWidth: 0 + m_ChildControlHeight: 0 + m_ChildScaleWidth: 0 + m_ChildScaleHeight: 0 + m_ReverseArrangement: 0 +--- !u!114 &339774399 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 339774396} + 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: 0.392} + 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: 10907, 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 &339774400 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 339774396} + m_CullTransparentMesh: 0 +--- !u!1 &427963460 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 427963461} + - component: {fileID: 427963463} + - component: {fileID: 427963462} + m_Layer: 5 + m_Name: Copyright (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &427963461 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 427963460} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1434602809} + 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: 50, y: 0} + m_SizeDelta: {x: -100, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &427963462 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 427963460} + 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: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: copyright +--- !u!222 &427963463 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 427963460} + m_CullTransparentMesh: 0 +--- !u!1 &450042403 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 450042406} + - component: {fileID: 450042405} + - component: {fileID: 450042404} + m_Layer: 5 + m_Name: Checkmark + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &450042404 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 450042403} + 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: 10901, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 0 + 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 &450042405 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 450042403} + m_CullTransparentMesh: 0 +--- !u!224 &450042406 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 450042403} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 175751363} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 20, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!1 &452923208 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 452923209} + - component: {fileID: 452923211} + - component: {fileID: 452923210} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &452923209 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 452923208} + 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_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 251940584} + m_Father: {fileID: 1438613464} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 10, y: -10} + m_SizeDelta: {x: 20, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &452923210 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 452923208} + 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 &452923211 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 452923208} + m_CullTransparentMesh: 0 +--- !u!1 &488934504 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 488934505} + - component: {fileID: 488934507} + - component: {fileID: 488934506} + m_Layer: 5 + m_Name: Checkmark + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &488934505 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 488934504} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1166391799} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 20, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &488934506 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 488934504} + 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: 10901, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 0 + 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 &488934507 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 488934504} + m_CullTransparentMesh: 0 +--- !u!1 &491613100 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 491613101} + - component: {fileID: 491613103} + - component: {fileID: 491613102} + m_Layer: 5 + m_Name: _Model_ + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &491613101 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 491613100} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 644517400} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 297, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &491613102 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 491613100} + 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: 1 + 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: "\u30E2\u30C7\u30EB\u60C5\u5831" +--- !u!222 &491613103 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 491613100} + m_CullTransparentMesh: 0 +--- !u!1 &587234268 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 587234269} + - component: {fileID: 587234271} + - component: {fileID: 587234270} + m_Layer: 5 + m_Name: Contact (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &587234269 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 587234268} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1922159876} + 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: 50, y: 0} + m_SizeDelta: {x: -100, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &587234270 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 587234268} + 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: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u9023\u7D61\u5148" +--- !u!222 &587234271 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 587234268} + m_CullTransparentMesh: 0 +--- !u!1 &597950321 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 597950322} + - component: {fileID: 597950324} + - component: {fileID: 597950323} + m_Layer: 5 + m_Name: _BlendShape_ + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &597950322 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 597950321} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 339774397} + m_RootOrder: 14 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 178, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &597950323 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 597950321} + 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: 1 + 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: Expression +--- !u!222 &597950324 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 597950321} + m_CullTransparentMesh: 0 +--- !u!1 &602093297 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 602093298} + - component: {fileID: 602093299} + m_Layer: 5 + m_Name: UseAsync + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &602093298 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 602093297} + 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_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 154330168} + - {fileID: 1954133885} + m_Father: {fileID: 339774397} + m_RootOrder: 20 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 162, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &602093299 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 602093297} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9085046f02f69544eb97fd06b6048fe2, 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: Highlighted + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 154330169} + toggleTransition: 1 + graphic: {fileID: 1270311310} + m_Group: {fileID: 0} + onValueChanged: + m_PersistentCalls: + m_Calls: [] + m_IsOn: 0 +--- !u!1 &634488420 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 634488421} + - component: {fileID: 634488422} + m_Layer: 5 + m_Name: EnableAutoBlink + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &634488421 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 634488420} + 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_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 2010083454} + - {fileID: 1081455630} + m_Father: {fileID: 339774397} + m_RootOrder: 16 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 162, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &634488422 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 634488420} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9085046f02f69544eb97fd06b6048fe2, 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: Highlighted + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 2010083455} + toggleTransition: 1 + graphic: {fileID: 188310740} + m_Group: {fileID: 0} + onValueChanged: + m_PersistentCalls: + m_Calls: [] + m_IsOn: 1 +--- !u!1 &642985707 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 642985708} + - component: {fileID: 642985710} + - component: {fileID: 642985709} + m_Layer: 5 + m_Name: Label + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &642985708 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 642985707} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1767706907} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 9, y: -0.5} + m_SizeDelta: {x: -28, y: -3} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &642985709 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 642985707} + 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: 0 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: ShowBoxMan +--- !u!222 &642985710 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 642985707} + m_CullTransparentMesh: 1 +--- !u!1 &644517399 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 644517400} + - component: {fileID: 644517402} + - component: {fileID: 644517401} + - component: {fileID: 644517403} + m_Layer: 5 + m_Name: RightPanel + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &644517400 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 644517399} + 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_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 491613101} + - {fileID: 1636340564} + - {fileID: 2105159132} + - {fileID: 827174941} + - {fileID: 1434602809} + - {fileID: 1922159876} + - {fileID: 806723449} + - {fileID: 284921871} + - {fileID: 310000826} + - {fileID: 1633219308} + - {fileID: 935554081} + - {fileID: 928757301} + - {fileID: 773923919} + - {fileID: 1172469239} + - {fileID: 1761414316} + - {fileID: 926214996} + - {fileID: 1007924636} + - {fileID: 1199975013} + m_Father: {fileID: 124675794} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 1, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: -149, y: 0} + m_SizeDelta: {x: 297, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &644517401 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 644517399} + 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: 0.392} + 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: 10907, 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 &644517402 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 644517399} + m_CullTransparentMesh: 0 +--- !u!114 &644517403 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 644517399} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 59f8146938fff824cb5fd77236b75775, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Padding: + m_Left: 0 + m_Right: -5 + m_Top: 5 + m_Bottom: 0 + m_ChildAlignment: 2 + m_Spacing: 0 + m_ChildForceExpandWidth: 1 + m_ChildForceExpandHeight: 0 + m_ChildControlWidth: 0 + m_ChildControlHeight: 0 + m_ChildScaleWidth: 0 + m_ChildScaleHeight: 0 + m_ReverseArrangement: 0 +--- !u!1 &773923918 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 773923919} + - component: {fileID: 773923921} + - component: {fileID: 773923920} + m_Layer: 5 + m_Name: Commercial + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &773923919 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 773923918} + 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_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 852999695} + m_Father: {fileID: 644517400} + m_RootOrder: 12 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 297, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &773923920 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 773923918} + 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: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u5546\u7528\u5229\u7528" +--- !u!222 &773923921 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 773923918} + m_CullTransparentMesh: 0 +--- !u!1 &800895691 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 800895692} + - component: {fileID: 800895693} + - component: {fileID: 800895694} + m_Layer: 5 + m_Name: RawImage + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &800895692 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 800895691} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 284921871} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 1, y: 1} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: -5, y: -50} + m_SizeDelta: {x: 100, y: 100} + m_Pivot: {x: 1, y: 0.5} +--- !u!222 &800895693 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 800895691} + m_CullTransparentMesh: 0 +--- !u!114 &800895694 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 800895691} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, 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_Texture: {fileID: 0} + m_UVRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 +--- !u!1 &802105000 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 802105004} + - component: {fileID: 802105003} + - component: {fileID: 802105002} + - component: {fileID: 802105001} + - component: {fileID: 802105005} + m_Layer: 5 + m_Name: LookAtTarget + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!23 &802105001 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 802105000} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!135 &802105002 +SphereCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 802105000} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Radius: 0.5 + m_Center: {x: 0, y: 0, z: 0} +--- !u!33 &802105003 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 802105000} + m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &802105004 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 802105000} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0.1, y: 0.1, z: 0.1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &802105005 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 802105000} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0bc0c019f7af45745aa41b25018fd61f, type: 3} + m_Name: + m_EditorClassIdentifier: + m_radius: 5 + m_angularVelocity: 40 + m_y: 1.5 + m_height: 3 +--- !u!1 &806723448 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 806723449} + - component: {fileID: 806723451} + - component: {fileID: 806723450} + m_Layer: 5 + m_Name: Reference + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &806723449 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 806723448} + 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_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1181308132} + m_Father: {fileID: 644517400} + m_RootOrder: 6 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 297, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &806723450 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 806723448} + 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: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u53C2\u7167" +--- !u!222 &806723451 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 806723448} + m_CullTransparentMesh: 0 +--- !u!1 &826167455 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 826167456} + - component: {fileID: 826167458} + - component: {fileID: 826167457} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &826167456 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 826167455} + 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_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1987265555} + m_Father: {fileID: 1767706907} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 10, y: -10} + m_SizeDelta: {x: 20, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &826167457 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 826167455} + 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 &826167458 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 826167455} + m_CullTransparentMesh: 1 +--- !u!1 &827174940 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 827174941} + - component: {fileID: 827174943} + - component: {fileID: 827174942} + m_Layer: 5 + m_Name: Author + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &827174941 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 827174940} + 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_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 854014594} + m_Father: {fileID: 644517400} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 297, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &827174942 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 827174940} + 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: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u4F5C\u8005" +--- !u!222 &827174943 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 827174940} + m_CullTransparentMesh: 0 +--- !u!1 &852999694 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 852999695} + - component: {fileID: 852999697} + - component: {fileID: 852999696} + m_Layer: 5 + m_Name: Commercial (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &852999695 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 852999694} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 773923919} + 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: 50, y: 0} + m_SizeDelta: {x: -100, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &852999696 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 852999694} + 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: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u5546\u7528\u5229\u7528" +--- !u!222 &852999697 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 852999694} + m_CullTransparentMesh: 0 +--- !u!1 &854014593 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 854014594} + - component: {fileID: 854014596} + - component: {fileID: 854014595} + m_Layer: 5 + m_Name: Author (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &854014594 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 854014593} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 827174941} + 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: 50, y: 0} + m_SizeDelta: {x: -100, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &854014595 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 854014593} + 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: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u4F5C\u8005" +--- !u!222 &854014596 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 854014593} + m_CullTransparentMesh: 0 +--- !u!1 &910859647 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 910859648} + - component: {fileID: 910859650} + - component: {fileID: 910859649} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &910859648 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 910859647} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1307084561} + 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 &910859649 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 910859647} + 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: 'Paste Pose + +' +--- !u!222 &910859650 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 910859647} + m_CullTransparentMesh: 0 +--- !u!1 &926214995 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 926214996} + - component: {fileID: 926214998} + - component: {fileID: 926214997} + m_Layer: 5 + m_Name: _License_ + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &926214996 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 926214995} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 644517400} + m_RootOrder: 15 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 297, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &926214997 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 926214995} + 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: 1 + 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: "\u518D\u914D\u5E03\u30FB\u6539\u5909\u306B\u95A2\u3059\u308B\u8A31\u8AFE\u7BC4\u56F2" +--- !u!222 &926214998 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 926214995} + m_CullTransparentMesh: 0 +--- !u!1 &928757300 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 928757301} + - component: {fileID: 928757303} + - component: {fileID: 928757302} + m_Layer: 5 + m_Name: Sexual + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &928757301 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 928757300} + 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_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 933018278} + m_Father: {fileID: 644517400} + m_RootOrder: 11 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 297, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &928757302 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 928757300} + 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: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u6027\u7684\u8868\u73FE" +--- !u!222 &928757303 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 928757300} + m_CullTransparentMesh: 0 +--- !u!1 &933018277 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 933018278} + - component: {fileID: 933018280} + - component: {fileID: 933018279} + m_Layer: 5 + m_Name: Sexual (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &933018278 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 933018277} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 928757301} + 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: 50, y: 0} + m_SizeDelta: {x: -100, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &933018279 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 933018277} + 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: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u6027\u7684\u8868\u73FE" +--- !u!222 &933018280 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 933018277} + m_CullTransparentMesh: 0 +--- !u!1 &935554080 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 935554081} + - component: {fileID: 935554083} + - component: {fileID: 935554082} + m_Layer: 5 + m_Name: Violent + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &935554081 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 935554080} + 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_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1242458543} + m_Father: {fileID: 644517400} + m_RootOrder: 10 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 297, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &935554082 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 935554080} + 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: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u66B4\u529B\u8868\u73FE" +--- !u!222 &935554083 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 935554080} + m_CullTransparentMesh: 0 +--- !u!1 &935566649 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 935566651} + - component: {fileID: 935566650} + m_Layer: 5 + m_Name: EnableLipSync + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &935566650 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 935566649} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9085046f02f69544eb97fd06b6048fe2, 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: Highlighted + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 175751365} + toggleTransition: 1 + graphic: {fileID: 450042404} + m_Group: {fileID: 0} + onValueChanged: + m_PersistentCalls: + m_Calls: [] + m_IsOn: 1 +--- !u!224 &935566651 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 935566649} + 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_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 175751363} + - {fileID: 1904789319} + m_Father: {fileID: 339774397} + m_RootOrder: 15 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 162, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!1 &947409973 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 947409974} + - component: {fileID: 947409977} + - component: {fileID: 947409976} + - component: {fileID: 947409975} + m_Layer: 5 + m_Name: _Cloth_ + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &947409974 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 947409973} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 339774397} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 178, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &947409975 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 947409973} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 2fafe2cfe61f6974895a912c3755e8f1, type: 3} + m_Name: + m_EditorClassIdentifier: + m_AllowSwitchOff: 0 +--- !u!114 &947409976 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 947409973} + 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: 1 + 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: 'Cloth + +' +--- !u!222 &947409977 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 947409973} + m_CullTransparentMesh: 0 +--- !u!1 &962537951 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 962537952} + - component: {fileID: 962537954} + - component: {fileID: 962537953} + m_Layer: 5 + m_Name: Checkmark + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &962537952 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 962537951} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1263556355} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 20, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &962537953 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 962537951} + 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: 10901, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 0 + 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 &962537954 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 962537951} + m_CullTransparentMesh: 0 +--- !u!1 &974864190 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 974864191} + - component: {fileID: 974864193} + - component: {fileID: 974864192} + m_Layer: 5 + m_Name: _ + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &974864191 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 974864190} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 339774397} + m_RootOrder: 13 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 178, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &974864192 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 974864190} + 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: 1 + 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: +--- !u!222 &974864193 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 974864190} + m_CullTransparentMesh: 0 +--- !u!1 &1007924635 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1007924636} + - component: {fileID: 1007924638} + - component: {fileID: 1007924637} + m_Layer: 5 + m_Name: LicenseType + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1007924636 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1007924635} + 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_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1476033061} + m_Father: {fileID: 644517400} + m_RootOrder: 16 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 297, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1007924637 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1007924635} + 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: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u30E9\u30A4\u30BB\u30F3\u30B9" +--- !u!222 &1007924638 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1007924635} + m_CullTransparentMesh: 0 +--- !u!1 &1037763548 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1037763549} + - component: {fileID: 1037763551} + - component: {fileID: 1037763550} + m_Layer: 5 + m_Name: Label + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1037763549 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1037763548} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1767738854} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 9, y: -0.5} + m_SizeDelta: {x: -28, y: -3} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1037763550 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1037763548} + 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: 0 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: EnableAutoExpression +--- !u!222 &1037763551 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1037763548} + m_CullTransparentMesh: 0 +--- !u!1 &1045380261 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1045380262} + - component: {fileID: 1045380264} + - component: {fileID: 1045380263} + m_Layer: 5 + m_Name: Version (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1045380262 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1045380261} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 2105159132} + 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: 50, y: 0} + m_SizeDelta: {x: -100, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1045380263 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1045380261} + 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: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u30D0\u30FC\u30B8\u30E7\u30F3" +--- !u!222 &1045380264 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1045380261} + m_CullTransparentMesh: 0 +--- !u!1 &1081455629 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1081455630} + - component: {fileID: 1081455632} + - component: {fileID: 1081455631} + m_Layer: 5 + m_Name: Label + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1081455630 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1081455629} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 634488421} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 9, y: -0.5} + m_SizeDelta: {x: -28, y: -3} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1081455631 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1081455629} + 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: 0 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: EnableAutoBlink +--- !u!222 &1081455632 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1081455629} + m_CullTransparentMesh: 0 +--- !u!1 &1087391116 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1087391117} + - component: {fileID: 1087391119} + - component: {fileID: 1087391118} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1087391117 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1087391116} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 124675794} + 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: 86.2, y: 22.5} + m_SizeDelta: {x: 147.5, y: 45} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1087391118 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1087391116} + 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: 0 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "Tab\u30AD\u30FC\u3067UI\u3092\n\u8868\u793A\u30FB\u975E\u8868\u793A\u306B\u3067\u304D\u307E\u3059" +--- !u!222 &1087391119 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1087391116} + m_CullTransparentMesh: 0 +--- !u!1 &1104290796 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1104290797} + - component: {fileID: 1104290799} + - component: {fileID: 1104290798} + m_Layer: 5 + m_Name: OtherLicense (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1104290797 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1104290796} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1199975013} + 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: 50, y: 0} + m_SizeDelta: {x: -100, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1104290798 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1104290796} + 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: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u305D\u306E\u4ED6\u306E\u6761\u4EF6" +--- !u!222 &1104290799 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1104290796} + m_CullTransparentMesh: 0 +--- !u!1 &1111491924 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1111491927} + - component: {fileID: 1111491926} + - component: {fileID: 1111491925} + m_Layer: 5 + m_Name: Title (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1111491925 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1111491924} + 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: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u30BF\u30A4\u30C8\u30EB" +--- !u!222 &1111491926 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1111491924} + m_CullTransparentMesh: 0 +--- !u!224 &1111491927 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1111491924} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1636340564} + 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: 50, y: 0} + m_SizeDelta: {x: -100, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!1 &1140410863 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1140410864} + - component: {fileID: 1140410866} + - component: {fileID: 1140410865} + m_Layer: 5 + m_Name: Label + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1140410864 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1140410863} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1791103379} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 9, y: -0.5} + m_SizeDelta: {x: -28, y: -3} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1140410865 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1140410863} + 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: 0 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: T-Pose +--- !u!222 &1140410866 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1140410863} + m_CullTransparentMesh: 0 +--- !u!1 &1166391798 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1166391799} + - component: {fileID: 1166391801} + - component: {fileID: 1166391800} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1166391799 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1166391798} + 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_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 488934505} + m_Father: {fileID: 1791103379} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 10, y: -10} + m_SizeDelta: {x: 20, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1166391800 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1166391798} + 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 &1166391801 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1166391798} + m_CullTransparentMesh: 0 +--- !u!1 &1172469238 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1172469239} + - component: {fileID: 1172469241} + - component: {fileID: 1172469240} + m_Layer: 5 + m_Name: Other + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1172469239 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1172469238} + 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_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1289294208} + m_Father: {fileID: 644517400} + m_RootOrder: 13 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 297, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1172469240 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1172469238} + 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: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u305D\u306E\u4ED6\u306E\u6761\u4EF6" +--- !u!222 &1172469241 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1172469238} + m_CullTransparentMesh: 0 +--- !u!1 &1181308131 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1181308132} + - component: {fileID: 1181308134} + - component: {fileID: 1181308133} + m_Layer: 5 + m_Name: Reference (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1181308132 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1181308131} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 806723449} + 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: 50, y: 0} + m_SizeDelta: {x: -100, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1181308133 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1181308131} + 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: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u53C2\u7167" +--- !u!222 &1181308134 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1181308131} + m_CullTransparentMesh: 0 +--- !u!1 &1189866556 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1189866557} + - component: {fileID: 1189866559} + - component: {fileID: 1189866558} + m_Layer: 5 + m_Name: Checkmark + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1189866557 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1189866556} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 62367395} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 20, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1189866558 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1189866556} + 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: 10901, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 0 + 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 &1189866559 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1189866556} + m_CullTransparentMesh: 0 +--- !u!1 &1194499279 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1194499280} + - component: {fileID: 1194499283} + - component: {fileID: 1194499282} + - component: {fileID: 1194499281} + m_Layer: 5 + m_Name: ResetSpringBone + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1194499280 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1194499279} + 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_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1255857727} + m_Father: {fileID: 339774397} + m_RootOrder: 6 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 162, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1194499281 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1194499279} + 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: Highlighted + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 1194499282} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!114 &1194499282 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1194499279} + 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 &1194499283 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1194499279} + m_CullTransparentMesh: 0 +--- !u!1 &1199975012 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1199975013} + - component: {fileID: 1199975015} + - component: {fileID: 1199975014} + m_Layer: 5 + m_Name: OtherLicense + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1199975013 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1199975012} + 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_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1104290797} + m_Father: {fileID: 644517400} + m_RootOrder: 17 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 297, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1199975014 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1199975012} + 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: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u305D\u306E\u4ED6\u306E\u6761\u4EF6" +--- !u!222 &1199975015 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1199975012} + m_CullTransparentMesh: 0 +--- !u!1 &1215781541 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1215781542} + - component: {fileID: 1215781544} + - component: {fileID: 1215781543} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1215781542 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1215781541} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 2144476967} + 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 &1215781543 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1215781541} + 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: Reconstruct +--- !u!222 &1215781544 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1215781541} + m_CullTransparentMesh: 0 +--- !u!1 &1242458542 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1242458543} + - component: {fileID: 1242458545} + - component: {fileID: 1242458544} + m_Layer: 5 + m_Name: Violent (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1242458543 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1242458542} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 935554081} + 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: 50, y: 0} + m_SizeDelta: {x: -100, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1242458544 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1242458542} + 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: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u66B4\u529B\u8868\u73FE" +--- !u!222 &1242458545 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1242458542} + m_CullTransparentMesh: 0 +--- !u!1 &1255857726 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1255857727} + - component: {fileID: 1255857729} + - component: {fileID: 1255857728} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1255857727 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1255857726} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1194499280} + 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 &1255857728 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1255857726} + 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: Reset +--- !u!222 &1255857729 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1255857726} + m_CullTransparentMesh: 0 +--- !u!1 &1263556354 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1263556355} + - component: {fileID: 1263556357} + - component: {fileID: 1263556356} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1263556355 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1263556354} + 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_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 962537952} + m_Father: {fileID: 153452229} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 10, y: -10} + m_SizeDelta: {x: 20, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1263556356 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1263556354} + 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 &1263556357 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1263556354} + m_CullTransparentMesh: 0 +--- !u!1 &1268276254 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1268276255} + - component: {fileID: 1268276257} + - component: {fileID: 1268276256} + m_Layer: 5 + m_Name: VrmVersion + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1268276255 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1268276254} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 124675794} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 0} + m_AnchoredPosition: {x: -59.75, y: 15} + m_SizeDelta: {x: -475.5, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1268276256 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1268276254} + 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: Version +--- !u!222 &1268276257 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1268276254} + m_CullTransparentMesh: 0 +--- !u!1 &1270311308 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1270311309} + - component: {fileID: 1270311311} + - component: {fileID: 1270311310} + m_Layer: 5 + m_Name: Checkmark + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1270311309 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1270311308} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 154330168} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 20, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1270311310 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1270311308} + 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: 10901, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 0 + 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 &1270311311 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1270311308} + m_CullTransparentMesh: 0 +--- !u!1 &1289294207 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1289294208} + - component: {fileID: 1289294210} + - component: {fileID: 1289294209} + m_Layer: 5 + m_Name: Other (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1289294208 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1289294207} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1172469239} + 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: 50.25, y: 0} + m_SizeDelta: {x: -99.5, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1289294209 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1289294207} + 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: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u305D\u306E\u4ED6\u306E\u6761\u4EF6" +--- !u!222 &1289294210 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1289294207} + m_CullTransparentMesh: 0 +--- !u!1 &1307084560 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1307084561} + - component: {fileID: 1307084563} + - component: {fileID: 1307084562} + - component: {fileID: 1307084564} + m_Layer: 5 + m_Name: PastePose + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1307084561 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1307084560} + 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_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 910859648} + m_Father: {fileID: 339774397} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 162, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1307084562 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1307084560} + 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 &1307084563 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1307084560} + m_CullTransparentMesh: 0 +--- !u!114 &1307084564 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1307084560} + 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: Highlighted + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 1307084562} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!1 &1307737654 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1307737655} + - component: {fileID: 1307737657} + - component: {fileID: 1307737656} + m_Layer: 5 + m_Name: Checkmark + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1307737655 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1307737654} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1866921958} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 20, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1307737656 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1307737654} + 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: 10901, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 0 + 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 &1307737657 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1307737654} + m_CullTransparentMesh: 0 +--- !u!1 &1311520908 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1311520909} + - component: {fileID: 1311520910} + m_Layer: 5 + m_Name: BVH + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1311520909 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1311520908} + 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_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1866921958} + - {fileID: 1767669911} + m_Father: {fileID: 339774397} + m_RootOrder: 10 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 162, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1311520910 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1311520908} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9085046f02f69544eb97fd06b6048fe2, 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: Highlighted + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 1866921959} + toggleTransition: 1 + graphic: {fileID: 1307737656} + m_Group: {fileID: 224350194} + onValueChanged: + m_PersistentCalls: + m_Calls: [] + m_IsOn: 1 +--- !u!1 &1322834809 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1322834810} + - component: {fileID: 1322834812} + - component: {fileID: 1322834811} + m_Layer: 5 + m_Name: AllowedUser (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1322834810 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1322834809} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1633219308} + 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: 50.5, y: 0} + m_SizeDelta: {x: -99, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1322834811 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1322834809} + 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: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u8A31\u8AFE\u7BC4\u56F2" +--- !u!222 &1322834812 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1322834809} + m_CullTransparentMesh: 0 +--- !u!1 &1407428956 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1407428958} + - component: {fileID: 1407428959} + m_Layer: 0 + m_Name: PostProcess + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1407428958 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1407428956} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 6 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1407428959 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1407428956} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 8b9a305e18de0c04dbd257a21cd47087, type: 3} + m_Name: + m_EditorClassIdentifier: + sharedProfile: {fileID: 0} + isGlobal: 0 + blendDistance: 0 + weight: 1 + priority: 0 +--- !u!1 &1422965363 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1422965364} + - component: {fileID: 1422965366} + - component: {fileID: 1422965365} + m_Layer: 5 + m_Name: Label + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1422965364 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1422965363} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 153452229} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 9, y: -0.5} + m_SizeDelta: {x: -28, y: -3} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1422965365 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1422965363} + 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: 0 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: PauseSpringBone +--- !u!222 &1422965366 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1422965363} + m_CullTransparentMesh: 0 +--- !u!1 &1434602808 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1434602809} + - component: {fileID: 1434602811} + - component: {fileID: 1434602810} + m_Layer: 5 + m_Name: Copyright + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1434602809 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1434602808} + 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_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 427963461} + m_Father: {fileID: 644517400} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 297, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1434602810 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1434602808} + 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: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: copyright +--- !u!222 &1434602811 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1434602808} + m_CullTransparentMesh: 0 +--- !u!1 &1438613463 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1438613464} + - component: {fileID: 1438613465} + m_Layer: 5 + m_Name: UseUrpMaterial + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1438613464 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1438613463} + 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_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 452923209} + - {fileID: 2090837017} + m_Father: {fileID: 339774397} + m_RootOrder: 19 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 162, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1438613465 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1438613463} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9085046f02f69544eb97fd06b6048fe2, 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: Highlighted + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 452923210} + toggleTransition: 1 + graphic: {fileID: 251940585} + m_Group: {fileID: 0} + onValueChanged: + m_PersistentCalls: + m_Calls: [] + m_IsOn: 0 +--- !u!1 &1476033060 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1476033061} + - component: {fileID: 1476033063} + - component: {fileID: 1476033062} + m_Layer: 5 + m_Name: LicenseType (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1476033061 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1476033060} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1007924636} + 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: 50, y: 0} + m_SizeDelta: {x: -100, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1476033062 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1476033060} + 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: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u30E9\u30A4\u30BB\u30F3\u30B9" +--- !u!222 &1476033063 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1476033060} + m_CullTransparentMesh: 0 +--- !u!1 &1557052149 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1557052150} + - component: {fileID: 1557052152} + - component: {fileID: 1557052151} + m_Layer: 5 + m_Name: _ + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1557052150 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1557052149} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 339774397} + m_RootOrder: 11 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 178, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1557052151 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1557052149} + 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: 1 + 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: +--- !u!222 &1557052152 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1557052149} + m_CullTransparentMesh: 0 +--- !u!1 &1621794410 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1621794411} + - component: {fileID: 1621794413} + - component: {fileID: 1621794412} + m_Layer: 5 + m_Name: '_Model_ ' + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1621794411 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1621794410} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 339774397} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 178, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1621794412 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1621794410} + 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: 1 + 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: "\u30E2\u30C7\u30EB\n" +--- !u!222 &1621794413 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1621794410} + m_CullTransparentMesh: 0 +--- !u!1 &1629460656 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1629460662} + - component: {fileID: 1629460661} + - component: {fileID: 1629460658} + - component: {fileID: 1629460663} + - component: {fileID: 1629460664} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &1629460658 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1629460656} + m_Enabled: 1 +--- !u!20 &1629460661 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1629460656} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.05 + far clip plane: 100 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 1 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &1629460662 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1629460656} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 241398689} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1629460663 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1629460656} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a79441f348de89743a2939f4d699eac1, type: 3} + m_Name: + m_EditorClassIdentifier: + m_RenderShadows: 1 + m_RequiresDepthTextureOption: 2 + m_RequiresOpaqueTextureOption: 2 + m_CameraType: 0 + m_Cameras: [] + m_RendererIndex: -1 + m_VolumeLayerMask: + serializedVersion: 2 + m_Bits: 1 + m_VolumeTrigger: {fileID: 0} + m_VolumeFrameworkUpdateModeOption: 2 + m_RenderPostProcessing: 0 + m_Antialiasing: 0 + m_AntialiasingQuality: 2 + m_StopNaN: 0 + m_Dithering: 0 + m_ClearDepth: 1 + m_AllowXRRendering: 1 + m_RequiresDepthTexture: 0 + m_RequiresColorTexture: 0 + m_Version: 2 +--- !u!114 &1629460664 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1629460656} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 93dcf1b2cc4d917489620707e78e9f27, type: 3} + m_Name: + m_EditorClassIdentifier: + RotateSpeed: 0.7 + GrabSpeed: 0.7 + DollySpeed: 1 +--- !u!1 &1633219307 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1633219308} + - component: {fileID: 1633219310} + - component: {fileID: 1633219309} + m_Layer: 5 + m_Name: AllowedUser + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1633219308 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1633219307} + 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_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1322834810} + m_Father: {fileID: 644517400} + m_RootOrder: 9 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 297, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1633219309 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1633219307} + 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: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u8A31\u8AFE\u7BC4\u56F2" +--- !u!222 &1633219310 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1633219307} + m_CullTransparentMesh: 0 +--- !u!1 &1636340563 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1636340564} + - component: {fileID: 1636340566} + - component: {fileID: 1636340565} + m_Layer: 5 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1636340564 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1636340563} + 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_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1111491927} + m_Father: {fileID: 644517400} + 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, y: 0} + m_SizeDelta: {x: 297, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1636340565 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1636340563} + 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: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u30BF\u30A4\u30C8\u30EB" +--- !u!222 &1636340566 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1636340563} + m_CullTransparentMesh: 0 +--- !u!1 &1761414315 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1761414316} + - component: {fileID: 1761414318} + - component: {fileID: 1761414317} + m_Layer: 5 + m_Name: _ + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1761414316 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1761414315} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 644517400} + m_RootOrder: 14 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 297, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1761414317 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1761414315} + 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: 1 + 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: +--- !u!222 &1761414318 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1761414315} + m_CullTransparentMesh: 0 +--- !u!1 &1767669910 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1767669911} + - component: {fileID: 1767669913} + - component: {fileID: 1767669912} + m_Layer: 5 + m_Name: Label + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1767669911 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1767669910} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1311520909} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 9, y: -0.5} + m_SizeDelta: {x: -28, y: -3} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1767669912 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1767669910} + 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: 0 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: BVH +--- !u!222 &1767669913 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1767669910} + m_CullTransparentMesh: 0 +--- !u!1 &1767706906 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1767706907} + - component: {fileID: 1767706908} + m_Layer: 5 + m_Name: ShowBoxMan + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1767706907 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1767706906} + 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_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 826167456} + - {fileID: 642985708} + m_Father: {fileID: 339774397} + m_RootOrder: 12 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 160, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1767706908 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1767706906} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9085046f02f69544eb97fd06b6048fe2, 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: 826167457} + toggleTransition: 1 + graphic: {fileID: 1987265556} + m_Group: {fileID: 0} + onValueChanged: + m_PersistentCalls: + m_Calls: [] + m_IsOn: 1 +--- !u!1 &1767738853 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1767738854} + - component: {fileID: 1767738855} + m_Layer: 5 + m_Name: EnableAutoExpression + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1767738854 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1767738853} + 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_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 62367395} + - {fileID: 1037763549} + m_Father: {fileID: 339774397} + m_RootOrder: 17 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 162, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1767738855 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1767738853} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9085046f02f69544eb97fd06b6048fe2, 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: Highlighted + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 62367396} + toggleTransition: 1 + graphic: {fileID: 1189866558} + m_Group: {fileID: 0} + onValueChanged: + m_PersistentCalls: + m_Calls: [] + m_IsOn: 1 +--- !u!1 &1787938562 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1787938566} + - component: {fileID: 1787938565} + - component: {fileID: 1787938564} + - component: {fileID: 1787938563} + - component: {fileID: 1787938567} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1787938563 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1787938562} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!114 &1787938564 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1787938562} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 0 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 800, y: 600} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 + m_PresetInfoIsWorld: 0 +--- !u!223 &1787938565 +Canvas: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1787938562} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 0 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_AdditionalShaderChannelsFlag: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!224 &1787938566 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1787938562} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 124675794} + m_Father: {fileID: 0} + 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, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!114 &1787938567 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1787938562} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 46079dccaf3b7ac4ebbba728f1971ed0, type: 3} + m_Name: + m_EditorClassIdentifier: + m_version: {fileID: 1268276256} + m_openModel: {fileID: 2009818433} + m_openMotion: {fileID: 168425996} + m_pastePose: {fileID: 1307084564} + m_reconstructSprngBone: {fileID: 2144476968} + m_resetSpringBone: {fileID: 1194499281} + m_showBoxMan: {fileID: 1767706908} + m_enableLipSync: {fileID: 935566650} + m_enableAutoBlink: {fileID: 634488422} + m_enableAutoExpression: {fileID: 1767738855} + m_useUrpMaterial: {fileID: 1438613465} + m_useAsync: {fileID: 602093299} + m_target: {fileID: 802105000} + m_motion: {fileID: 4900000, guid: 487929d3039a63544a0825523ac6a8ab, type: 3} + m_texts: + m_textModelTitle: {fileID: 1111491925} + m_textModelVersion: {fileID: 1045380263} + m_textModelAuthor: {fileID: 854014595} + m_textModelCopyright: {fileID: 427963462} + m_textModelContact: {fileID: 587234270} + m_textModelReference: {fileID: 1181308133} + m_thumbnail: {fileID: 800895694} + m_textPermissionAllowed: {fileID: 1322834811} + m_textPermissionViolent: {fileID: 1242458544} + m_textPermissionSexual: {fileID: 933018279} + m_textPermissionCommercial: {fileID: 852999696} + m_textPermissionOther: {fileID: 1289294209} + m_textDistributionLicense: {fileID: 1476033062} + m_textDistributionOther: {fileID: 1104290798} + m_ui: + ToggleMotionTPose: {fileID: 1791103380} + ToggleMotionBVH: {fileID: 1311520910} + ToggleMotion: {fileID: 224350194} + Iteration: 32 +--- !u!1 &1791103378 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1791103379} + - component: {fileID: 1791103380} + m_Layer: 5 + m_Name: TPose + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1791103379 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1791103378} + 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_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1166391799} + - {fileID: 1140410864} + m_Father: {fileID: 339774397} + m_RootOrder: 9 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 162, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1791103380 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1791103378} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9085046f02f69544eb97fd06b6048fe2, 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: Highlighted + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 1166391800} + toggleTransition: 1 + graphic: {fileID: 488934506} + m_Group: {fileID: 224350194} + onValueChanged: + m_PersistentCalls: + m_Calls: [] + m_IsOn: 0 +--- !u!1 &1866921957 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1866921958} + - component: {fileID: 1866921960} + - component: {fileID: 1866921959} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1866921958 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1866921957} + 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_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1307737655} + m_Father: {fileID: 1311520909} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 10, y: -10} + m_SizeDelta: {x: 20, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1866921959 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1866921957} + 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 &1866921960 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1866921957} + m_CullTransparentMesh: 0 +--- !u!1 &1904789318 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1904789319} + - component: {fileID: 1904789321} + - component: {fileID: 1904789320} + m_Layer: 5 + m_Name: Label + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1904789319 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904789318} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 935566651} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 9, y: -0.5} + m_SizeDelta: {x: -28, y: -3} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1904789320 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904789318} + 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: 0 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Enable AIUEO +--- !u!222 &1904789321 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1904789318} + m_CullTransparentMesh: 0 +--- !u!1 &1922159875 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1922159876} + - component: {fileID: 1922159878} + - component: {fileID: 1922159877} + m_Layer: 5 + m_Name: Contact + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1922159876 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1922159875} + 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_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 587234269} + m_Father: {fileID: 644517400} + m_RootOrder: 5 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 297, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1922159877 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1922159875} + 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: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u9023\u7D61\u5148" +--- !u!222 &1922159878 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1922159875} + m_CullTransparentMesh: 0 +--- !u!1 &1923525314 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1923525315} + - component: {fileID: 1923525317} + - component: {fileID: 1923525316} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1923525315 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1923525314} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 168425995} + 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 &1923525316 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1923525314} + 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: 'Open Motion + +' +--- !u!222 &1923525317 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1923525314} + m_CullTransparentMesh: 0 +--- !u!1 &1954133884 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1954133885} + - component: {fileID: 1954133887} + - component: {fileID: 1954133886} + m_Layer: 5 + m_Name: Label + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1954133885 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1954133884} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 602093298} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 9, y: -0.5} + m_SizeDelta: {x: -28, y: -3} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1954133886 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1954133884} + 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: 0 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Use Async +--- !u!222 &1954133887 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1954133884} + m_CullTransparentMesh: 0 +--- !u!1 &1963417398 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1963417399} + - component: {fileID: 1963417401} + - component: {fileID: 1963417400} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1963417399 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1963417398} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 2009818432} + 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 &1963417400 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1963417398} + 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: 'Open Model + +' +--- !u!222 &1963417401 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1963417398} + m_CullTransparentMesh: 0 +--- !u!1 &1987265554 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1987265555} + - component: {fileID: 1987265557} + - component: {fileID: 1987265556} + m_Layer: 5 + m_Name: Checkmark + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1987265555 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1987265554} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 826167456} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 20, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1987265556 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1987265554} + 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: 10901, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 0 + 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 &1987265557 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1987265554} + m_CullTransparentMesh: 1 +--- !u!1 &2009818431 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2009818432} + - component: {fileID: 2009818435} + - component: {fileID: 2009818434} + - component: {fileID: 2009818433} + m_Layer: 5 + m_Name: OpenModel + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2009818432 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2009818431} + 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_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1963417399} + m_Father: {fileID: 339774397} + 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, y: 0} + m_SizeDelta: {x: 162, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &2009818433 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2009818431} + 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: Highlighted + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 2009818434} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!114 &2009818434 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2009818431} + 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 &2009818435 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2009818431} + m_CullTransparentMesh: 0 +--- !u!1 &2010083453 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2010083454} + - component: {fileID: 2010083456} + - component: {fileID: 2010083455} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2010083454 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2010083453} + 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_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 188310739} + m_Father: {fileID: 634488421} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 10, y: -10} + m_SizeDelta: {x: 20, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &2010083455 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2010083453} + 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 &2010083456 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2010083453} + m_CullTransparentMesh: 0 +--- !u!1 &2090837016 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2090837017} + - component: {fileID: 2090837019} + - component: {fileID: 2090837018} + m_Layer: 5 + m_Name: Label + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2090837017 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2090837016} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1438613464} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 9, y: -0.5} + m_SizeDelta: {x: -28, y: -3} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &2090837018 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2090837016} + 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: 0 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Use URP Material +--- !u!222 &2090837019 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2090837016} + m_CullTransparentMesh: 0 +--- !u!1 &2105159131 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2105159132} + - component: {fileID: 2105159134} + - component: {fileID: 2105159133} + m_Layer: 5 + m_Name: Version + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2105159132 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2105159131} + 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_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1045380262} + m_Father: {fileID: 644517400} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 297, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &2105159133 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2105159131} + 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: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "\u30D0\u30FC\u30B8\u30E7\u30F3" +--- !u!222 &2105159134 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2105159131} + m_CullTransparentMesh: 0 +--- !u!1 &2141451816 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2141451818} + - component: {fileID: 2141451817} + - component: {fileID: 2141451819} + m_Layer: 0 + m_Name: Directional Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &2141451817 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2141451816} + m_Enabled: 1 + serializedVersion: 10 + m_Type: 1 + m_Shape: 0 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1 + m_Range: 10 + m_SpotAngle: 30 + m_InnerSpotAngle: 21.80208 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_CullingMatrixOverride: + e00: 1 + e01: 0 + e02: 0 + e03: 0 + e10: 0 + e11: 1 + e12: 0 + e13: 0 + e20: 0 + e21: 0 + e22: 1 + e23: 0 + e30: 0 + e31: 0 + e32: 0 + e33: 1 + m_UseCullingMatrixOverride: 0 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingLayerMask: 1 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} + m_UseBoundingSphereOverride: 0 + m_UseViewFrustumForShadowCasterCull: 1 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &2141451818 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2141451816} + m_LocalRotation: {x: -0.109381616, y: -0.8754262, z: 0.40821788, w: -0.23456965} + m_LocalPosition: {x: 0, y: 3, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 50, y: -210, z: 0} +--- !u!114 &2141451819 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2141451816} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 474bcb49853aa07438625e644c072ee6, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Version: 1 + m_UsePipelineSettings: 1 + m_AdditionalLightsShadowResolutionTier: 2 + m_LightLayerMask: 1 + m_CustomShadowLayers: 0 + m_ShadowLayerMask: 1 + m_LightCookieSize: {x: 1, y: 1} + m_LightCookieOffset: {x: 0, y: 0} +--- !u!1 &2144476966 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2144476967} + - component: {fileID: 2144476970} + - component: {fileID: 2144476969} + - component: {fileID: 2144476968} + m_Layer: 5 + m_Name: ReconstcutSpringBone + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2144476967 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2144476966} + 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_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1215781542} + m_Father: {fileID: 339774397} + m_RootOrder: 5 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 162, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &2144476968 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2144476966} + 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: Highlighted + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 2144476969} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!114 &2144476969 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2144476966} + 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 &2144476970 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2144476966} + m_CullTransparentMesh: 0 diff --git a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewer.unity.meta b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewer.unity.meta new file mode 100644 index 000000000..f7831efd4 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewer.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: bedad7250033c0b49ac1e7db4d7ee63e +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewerUI.cs b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewerUI.cs new file mode 100644 index 000000000..7bf02069a --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewerUI.cs @@ -0,0 +1,628 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading; +using UniGLTF; +using UnityEngine; +using UnityEngine.UI; + + +namespace UniVRM10.Cloth.Viewer +{ + public class ClothViewerUI : MonoBehaviour + { + [SerializeField] + Text m_version = default; + + [Header("UI")] + [SerializeField] + Button m_openModel = default; + + [SerializeField] + Button m_openMotion = default; + + [SerializeField] + Button m_pastePose = default; + + [SerializeField] + Button m_reconstructSprngBone = default; + + [SerializeField] + Button m_resetSpringBone = default; + + [SerializeField] + Toggle m_showBoxMan = default; + + [SerializeField] + Toggle m_enableLipSync = default; + + [SerializeField] + Toggle m_enableAutoBlink = default; + + [SerializeField] + Toggle m_enableAutoExpression = default; + + [SerializeField] + Toggle m_useAsync = default; + + [SerializeField] + GameObject m_target = default; + + [SerializeField] + TextAsset m_motion; + + GameObject Root = default; + + IVrm10Animation m_src = default; + public IVrm10Animation Motion + { + get { return m_src; } + set + { + if (m_src != null) + { + m_src.Dispose(); + } + m_src = value; + + TPose = new Vrm10TPose(m_src.ControlRig.Item1.GetRawHipsPosition()); + } + } + + public IVrm10Animation TPose; + + private CancellationTokenSource _cancellationTokenSource; + + [Serializable] + class TextFields + { + [SerializeField] + Text m_textModelTitle = default; + [SerializeField] + Text m_textModelVersion = default; + [SerializeField] + Text m_textModelAuthor = default; + [SerializeField] + Text m_textModelCopyright = default; + [SerializeField] + Text m_textModelContact = default; + [SerializeField] + Text m_textModelReference = default; + [SerializeField] + RawImage m_thumbnail = default; + + [SerializeField, Header("CharacterPermission")] + Text m_textPermissionAllowed = default; + [SerializeField] + Text m_textPermissionViolent = default; + [SerializeField] + Text m_textPermissionSexual = default; + [SerializeField] + Text m_textPermissionCommercial = default; + [SerializeField] + Text m_textPermissionOther = default; + + [SerializeField, Header("DistributionLicense")] + Text m_textDistributionLicense = default; + [SerializeField] + Text m_textDistributionOther = default; + + public void Reset(ObjectMap map) + { + m_textModelTitle = map.Get("Title (1)"); + m_textModelVersion = map.Get("Version (1)"); + m_textModelAuthor = map.Get("Author (1)"); + m_textModelCopyright = map.Get("Copyright (1)"); + m_textModelContact = map.Get("Contact (1)"); + m_textModelReference = map.Get("Reference (1)"); + m_textPermissionAllowed = map.Get("AllowedUser (1)"); + m_textPermissionViolent = map.Get("Violent (1)"); + m_textPermissionSexual = map.Get("Sexual (1)"); + m_textPermissionCommercial = map.Get("Commercial (1)"); + m_textPermissionOther = map.Get("Other (1)"); + m_textDistributionLicense = map.Get("LicenseType (1)"); + m_textDistributionOther = map.Get("OtherLicense (1)"); + m_thumbnail = map.Get("RawImage"); + } + + public void Start() + { + m_textModelTitle.text = ""; + m_textModelVersion.text = ""; + m_textModelAuthor.text = ""; + m_textModelCopyright.text = ""; + m_textModelContact.text = ""; + m_textModelReference.text = ""; + + m_textPermissionAllowed.text = ""; + m_textPermissionViolent.text = ""; + m_textPermissionSexual.text = ""; + m_textPermissionCommercial.text = ""; + m_textPermissionOther.text = ""; + + m_textDistributionLicense.text = ""; + m_textDistributionOther.text = ""; + } + + public void UpdateMeta(Texture2D thumbnail, UniGLTF.Extensions.VRMC_vrm.Meta meta, Migration.Vrm0Meta meta0) + { + m_thumbnail.texture = thumbnail; + + if (meta != null) + { + m_textModelTitle.text = meta.Name; + m_textModelVersion.text = meta.Version; + m_textModelAuthor.text = meta.Authors[0]; + m_textModelCopyright.text = meta.CopyrightInformation; + m_textModelContact.text = meta.ContactInformation; + if (meta.References != null && meta.References.Count > 0) + { + m_textModelReference.text = meta.References[0]; + } + m_textPermissionAllowed.text = meta.AvatarPermission.ToString(); + m_textPermissionViolent.text = meta.AllowExcessivelyViolentUsage.ToString(); + m_textPermissionSexual.text = meta.AllowExcessivelySexualUsage.ToString(); + m_textPermissionCommercial.text = meta.CommercialUsage.ToString(); + // m_textPermissionOther.text = meta.OtherPermissionUrl; + + // m_textDistributionLicense.text = meta.ModificationLicense.ToString(); + m_textDistributionOther.text = meta.OtherLicenseUrl; + } + + if (meta0 != null) + { + m_textModelTitle.text = meta0.title; + m_textModelVersion.text = meta0.version; + m_textModelAuthor.text = meta0.author; + m_textModelContact.text = meta0.contactInformation; + m_textModelReference.text = meta0.reference; + m_textPermissionAllowed.text = meta0.allowedUser.ToString(); + m_textPermissionViolent.text = meta0.violentUsage.ToString(); + m_textPermissionSexual.text = meta0.sexualUsage.ToString(); + m_textPermissionCommercial.text = meta0.commercialUsage.ToString(); + m_textPermissionOther.text = meta0.otherPermissionUrl; + // m_textDistributionLicense.text = meta0.ModificationLicense.ToString(); + m_textDistributionOther.text = meta0.otherLicenseUrl; + } + } + } + [SerializeField] + TextFields m_texts = default; + + [Serializable] + class UIFields + { + [SerializeField] + Toggle ToggleMotionTPose = default; + + [SerializeField] + Toggle ToggleMotionBVH = default; + + [SerializeField] + ToggleGroup ToggleMotion = default; + + public void Reset(ObjectMap map) + { + ToggleMotionTPose = map.Get("TPose"); + ToggleMotionBVH = map.Get("BVH"); + ToggleMotion = map.Get("_Motion_"); + } + + public bool IsTPose + { + get => ToggleMotion.ActiveToggles().FirstOrDefault() == ToggleMotionTPose; + set + { + ToggleMotionTPose.isOn = value; + ToggleMotionBVH.isOn = !value; + } + } + } + [SerializeField] + UIFields m_ui = default; + + class ObjectMap + { + Dictionary _map = new(); + public IReadOnlyDictionary Objects => _map; + + public ObjectMap(GameObject root) + { + foreach (var x in root.GetComponentsInChildren()) + { + _map[x.name] = x.gameObject; + } + } + + public T Get(string name) where T : Component + { + return _map[name].GetComponent(); + } + } + + private void Reset() + { + var map = new ObjectMap(gameObject); + m_openModel = map.Get public class RotateParticleSpringboneRuntime : IVrm10SpringBoneRuntime { - Action _setup; - - public RotateParticleSpringboneRuntime(Action setup) - { - _setup = setup; - } + RotateParticleSystem _system; public void Dispose() { } - public Task InitializeAsync(Vrm10Instance instance, IAwaitCaller awaitCaller) + public async Task InitializeAsync(Vrm10Instance instance, IAwaitCaller awaitCaller) { - if (_setup != null) - { - _setup(instance); - } - var system = instance.GetComponent(); - system.Initialize(); + await awaitCaller.NextFrame(); + // if (_setup != null) + // { + // _setup(instance); + // } - return Task.CompletedTask; + var animator = instance.GetComponent(); + if (animator == null) + { + Debug.LogWarning("no animator"); + return; + } + + var avatar = animator.avatar; + if (!avatar.isHuman) + { + Debug.LogWarning("not humanoid"); + return; + } + + _system = new RotateParticleSystem(); + _system.Env.DragForce = 0.6f; + _system.Env.Stiffness = 0.07f; + + foreach (var (group, head, tail, radius) in Capsules) + { + _system.AddColliderIfNotExists(group, + animator.GetBoneTransform(head), animator.GetBoneTransform(tail), radius); + } + + // skirt + { + if (TryAddGroup(CollisionGroupMask.Group01, "Skirt", animator, HumanBodyBones.Hips, new[] { "skirt", "スカート", "スカート" }, StrandConnectionType.ClothLoop, + out var g)) + { + _system._strandGroups.Add(g); + } + } + { + if (TryAddGroupChildChild(CollisionGroupMask.Group01, "Skirt", animator, HumanBodyBones.Hips, new[] { "skirt", "スカート", "スカート" }, new string[] { }, StrandConnectionType.ClothLoop, false, + out var g)) + { + _system._strandGroups.Add(g); + } + } + { + if (TryAddGroup(CollisionGroupMask.Group02, "髪", animator, HumanBodyBones.Head, new[] { "髪", "hair" }, StrandConnectionType.Strand, + out var g)) + { + _system._strandGroups.Add(g); + } + } + { + if (TryAddGroup(CollisionGroupMask.Group01, "裾", animator, HumanBodyBones.Hips, new[] { "裾" }, StrandConnectionType.Cloth, + out var g)) + { + _system._strandGroups.Add(g); + } + } + { + if (TryAddGroupChildChild(CollisionGroupMask.Group02, "左袖", animator, HumanBodyBones.LeftUpperArm, new[] { "袖" }, new[] { "ひじ袖" }, StrandConnectionType.ClothLoop, + false, + out var g)) + { + _system._strandGroups.Add(g); + } + } + { + if (TryAddGroupChildChild(CollisionGroupMask.Group02, "左ひじ袖", animator, HumanBodyBones.LeftLowerArm, new[] { "袖" }, new string[] { }, StrandConnectionType.ClothLoop, + false, + out var g)) + { + _system._strandGroups.Add(g); + } + } + { + if (TryAddGroupChildChild(CollisionGroupMask.Group02, "右袖", animator, HumanBodyBones.RightUpperArm, new[] { "袖" }, new[] { "ひじ袖" }, StrandConnectionType.ClothLoop, + false, + out var g)) + { + _system._strandGroups.Add(g); + } + } + { + if (TryAddGroupChildChild(CollisionGroupMask.Group02, "右ひじ袖", animator, HumanBodyBones.RightLowerArm, new[] { "袖" }, new string[] { }, StrandConnectionType.ClothLoop, + false, + out var g)) + { + _system._strandGroups.Add(g); + } + } + { + if (TryAddGroup(CollisionGroupMask.Group01 | CollisionGroupMask.Group02, "マント", animator, HumanBodyBones.Chest, new[] { "マント" }, StrandConnectionType.Cloth, + out var g)) + { + _system._strandGroups.Add(g); + } + } + + _system.Initialize(); + } + + static (string group, HumanBodyBones head, HumanBodyBones tail, float radius)[] Capsules = new[] + { + ("Leg", HumanBodyBones.LeftUpperLeg, HumanBodyBones.LeftLowerLeg, 0.06f), + ("Leg", HumanBodyBones.LeftLowerLeg, HumanBodyBones.LeftFoot, 0.05f), + ("Leg", HumanBodyBones.RightUpperLeg, HumanBodyBones.RightLowerLeg, 0.06f), + ("Leg", HumanBodyBones.RightLowerLeg, HumanBodyBones.RightFoot, 0.05f), + + ("Arm", HumanBodyBones.LeftUpperArm, HumanBodyBones.LeftLowerArm, 0.03f), + ("Arm", HumanBodyBones.LeftLowerArm, HumanBodyBones.LeftHand, 0.03f), + ("Arm", HumanBodyBones.LeftHand, HumanBodyBones.LeftMiddleProximal, 0.02f), + ("Arm", HumanBodyBones.RightUpperArm, HumanBodyBones.RightLowerArm, 0.03f), + ("Arm", HumanBodyBones.RightLowerArm, HumanBodyBones.RightHand, 0.03f), + ("Arm", HumanBodyBones.RightHand, HumanBodyBones.RightMiddleProximal, 0.02f), + }; + + // T GetOrAddComponent() where T : Component + // { + // var t = GetComponent(); + // if (t != null) + // { + // return t; + // } + // return gameObject.AddComponent(); + // } + + bool TryAddGroup(CollisionGroupMask mask, string name, Animator animator, HumanBodyBones humanBone, string[] targets, StrandConnectionType type, + out StrandGroup group) + { + var bone = animator.GetBoneTransform(humanBone); + if (bone == null) + { + Debug.LogWarning($"{humanBone} not found"); + group = default; + return false; + } + + List transforms = new(); + foreach (Transform child in bone) + { + foreach (var target in targets) + { + if (child.name.ToLower().Contains(target.ToLower())) + { + transforms.Add(child); + break; + } + } + } + if (transforms.Count == 0) + { + // Debug.LogWarning($"{string.Join(',', targets)} not found"); + group = default; + return false; + } + + group = new StrandGroup + { + Name = name, + CollisionMask = mask, + DefaultStrandRaius = 0.02f, + Connection = type + }; + group.Roots.AddRange(transforms); + + // sort + group.Roots.Sort(new TransformSort(bone.position)); + return true; + } + + bool TryAddGroupChildChild(CollisionGroupMask mask, string name, Animator animator, HumanBodyBones humanBone, + string[] targets, string[] excludes, + StrandConnectionType type, + bool sort, + out StrandGroup group) + { + var bone = animator.GetBoneTransform(humanBone); + if (bone == null) + { + Debug.LogWarning($"{humanBone} not found"); + group = default; + return false; + } + + List transforms = new(); + foreach (Transform child in bone) + { + foreach (Transform childchild in child) + { + if (excludes.Any(x => childchild.name.ToLower().Contains(x.ToLower()))) + { + continue; + } + + foreach (var target in targets) + { + if (childchild.name.ToLower().Contains(target.ToLower())) + { + transforms.Add(childchild); + break; + } + } + } + } + if (transforms.Count == 0) + { + // Debug.LogWarning($"{string.Join(',', targets)} not found"); + group = default; + return false; + } + + group = new StrandGroup + { + Name = name, + CollisionMask = mask, + DefaultStrandRaius = 0.02f, + Connection = type + }; + group.Roots.AddRange(transforms); + + // sort + if (sort) + { + group.Roots.Sort(new TransformSort(bone.position)); + } + return true; } public void Process() { + _system.Process(Time.deltaTime); } public bool ReconstructSpringBone() diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntimeProvider.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntimeProvider.cs new file mode 100644 index 000000000..456d245ef --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntimeProvider.cs @@ -0,0 +1,13 @@ +using UnityEngine; +using UniVRM10; + +namespace RotateParticle +{ + public class RotateParticleSpringboneRuntimeProvider : MonoBehaviour, IVrm10SpringBoneRuntimeProvider + { + public IVrm10SpringBoneRuntime CreateSpringBoneRuntime() + { + return new RotateParticleSpringboneRuntime(); + } + } +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/HumanoidAutoSetup.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntimeProvider.cs.meta similarity index 83% rename from Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/HumanoidAutoSetup.cs.meta rename to Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntimeProvider.cs.meta index 7bc096b42..f1db90b56 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/HumanoidAutoSetup.cs.meta +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntimeProvider.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: f2c23a62e016b3244b286404bc339540 +guid: de8d095eee60f134ebd9ccaa9efcc01e MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs index e0f8ef2d7..437507c16 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs @@ -7,8 +7,8 @@ using UnityEngine; namespace RotateParticle { - [DisallowMultipleComponent] - public class RotateParticleSystem : MonoBehaviour + [Serializable] + public class RotateParticleSystem { // TODO: param to _strandGroups [SerializeField] @@ -24,7 +24,6 @@ namespace RotateParticle public float _clothFactor = 0.5f; // runtime - bool _initialized = false; List _strands = new List(); public ParticleList _list = new(); public List<(SpringConstraint, ClothRectCollision)> _clothRects = new(); @@ -176,7 +175,6 @@ namespace RotateParticle public void Initialize() { - _initialized = true; foreach (var g in _strandGroups) { if (g.Roots?.Count == 0) @@ -205,14 +203,6 @@ namespace RotateParticle } } - void Start() - { - if (!_initialized) - { - Initialize(); - } - } - /// /// すべての Particle を Init 状態にする。 /// Verlet の Prev を現在地に更新する(速度0)。 @@ -225,15 +215,6 @@ namespace RotateParticle } } - public void Update() - { - if (Time.deltaTime == 0) - { - return; - } - Process(Time.deltaTime); - } - public void Process(float deltaTime) { using var profile = new ProfileSample("RotateParticle"); @@ -345,7 +326,7 @@ namespace RotateParticle } } - void OnDrawGizmos() + public void DrawGizmos() { _list.DrawGizmos(); From c2b398f0e4cea017cf08ea8a474253448eccdc13 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Fri, 15 Nov 2024 00:10:15 +0900 Subject: [PATCH 020/113] add component Warp and Cloth --- .../ClothSample/RotateParticle/Editor.meta | 8 +++ .../RotateParticle/Editor/Converter.cs | 52 ++++++++++++++++++ .../RotateParticle/Editor/Converter.cs.meta | 11 ++++ .../Editor/RotateParticle.Editor.asmdef | 17 ++++++ .../Editor/RotateParticle.Editor.asmdef.meta | 7 +++ .../ClothSample/RotateParticle/README.md | 8 +++ .../ClothSample/RotateParticle/README.md.meta | 7 +++ .../RotateParticle/Runtime/Components.meta | 8 +++ .../Runtime/Components/Cloth.cs | 18 +++++++ .../Runtime/Components/Cloth.cs.meta | 11 ++++ .../RotateParticle/Runtime/Components/Warp.cs | 53 +++++++++++++++++++ .../Runtime/Components/Warp.cs.meta | 11 ++++ .../{ => Runtime}/RotateParticle.asmdef | 0 .../{ => Runtime}/RotateParticle.asmdef.meta | 0 .../RotateParticleSpringboneRuntime.cs | 4 ++ .../ClothSample/RotateParticle/Scenes.meta | 2 +- 16 files changed, 216 insertions(+), 1 deletion(-) create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Editor.meta create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/Converter.cs create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/Converter.cs.meta create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/RotateParticle.Editor.asmdef create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/RotateParticle.Editor.asmdef.meta create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/README.md create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/README.md.meta create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components.meta create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Cloth.cs create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Cloth.cs.meta create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Warp.cs create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Warp.cs.meta rename Assets/VRM10_Samples/ClothSample/RotateParticle/{ => Runtime}/RotateParticle.asmdef (100%) rename Assets/VRM10_Samples/ClothSample/RotateParticle/{ => Runtime}/RotateParticle.asmdef.meta (100%) diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor.meta new file mode 100644 index 000000000..03d25d893 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 78593d828a6c64142bffa9e5b8e514dc +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/Converter.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/Converter.cs new file mode 100644 index 000000000..5f2153c65 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/Converter.cs @@ -0,0 +1,52 @@ +using UnityEditor; +using UnityEngine; +using UniVRM10; + + +namespace RotateParticle.Components +{ + public static class Converter + { + const string FROM_VRM10_MENU = "GameObject/CreateRotateParticleFromVrm10"; + + [MenuItem(FROM_VRM10_MENU, true)] + public static bool IsFromVrm10() + { + var go = Selection.activeGameObject; + if (go == null) + { + return false; + } + return go.GetComponent() != null; + } + + [MenuItem(FROM_VRM10_MENU, false)] + public static void FromVrm10() + { + var go = Selection.activeGameObject; + var instance = go.GetComponent(); + + foreach (var spring in instance.SpringBone.Springs) + { + if (spring.Joints == null || spring.Joints[0] == null) + { + continue; + } + + var root = spring.Joints[0].gameObject; + if (root == null) + { + continue; + } + + if (root.GetComponent() != null) + { + continue; + } + + UnityEditor.Undo.IncrementCurrentGroup(); + UnityEditor.Undo.SetCurrentGroupName("VRM10SpringBoneColliderGroup.Separate"); + } + } + } +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/Converter.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/Converter.cs.meta new file mode 100644 index 000000000..ebca8bc25 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/Converter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 80a9e5abcd0197a46b50bcd2a1c62561 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/RotateParticle.Editor.asmdef b/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/RotateParticle.Editor.asmdef new file mode 100644 index 000000000..c91fbf05f --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/RotateParticle.Editor.asmdef @@ -0,0 +1,17 @@ +{ + "name": "RotateParticle.Editor", + "rootNamespace": "", + "references": [ + "GUID:308b348fb80d89d42a9620951b0f60db", + "GUID:e47c917724578cc43b5506c17a27e9a0" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/RotateParticle.Editor.asmdef.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/RotateParticle.Editor.asmdef.meta new file mode 100644 index 000000000..62edd5f6b --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/RotateParticle.Editor.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: a3dafcb1fb23ff148bbc17714d01144c +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/README.md b/Assets/VRM10_Samples/ClothSample/RotateParticle/README.md new file mode 100644 index 000000000..f3a7508fb --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/README.md @@ -0,0 +1,8 @@ +# cloth 実装メモ + +## component + +設定置き場。布を構成する縦糸(Warp)と、縦糸を横に連結した四角格子(Cloth)の2段階とする + +### Warp + diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/README.md.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/README.md.meta new file mode 100644 index 000000000..612da64ba --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/README.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 3c501aa9d3818bf419f0bcb53c59e91d +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components.meta new file mode 100644 index 000000000..72a1bab69 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7a8d83c5cee1b1349a818b15bfe48c35 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Cloth.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Cloth.cs new file mode 100644 index 000000000..77b9db313 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Cloth.cs @@ -0,0 +1,18 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + + +namespace RotateParticle.Components +{ + [AddComponentMenu("RotateParticle/Cloth")] + [DisallowMultipleComponent] + public class Cloth : MonoBehaviour + { + [SerializeField] + public bool Loop = false; + + [SerializeField] + public List Warps = new(); + } +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Cloth.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Cloth.cs.meta new file mode 100644 index 000000000..595c6ac67 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Cloth.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: eb08bedf8ccf007488d5907f401f289d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Warp.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Warp.cs new file mode 100644 index 000000000..3be388f61 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Warp.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using UnityEngine; + + +namespace RotateParticle.Components +{ + [AddComponentMenu("RotateParticle/Warp")] + [DisallowMultipleComponent] + public class Warp : MonoBehaviour + { + [Serializable] + public class ParticleSettings + { + } + + /// + /// VRM10SpringBoneJoint に相当する + /// + [Serializable] + public class Particle + { + public bool useInheritSettings; + public ParticleSettings OverrideSettings; + } + + [SerializeField] + ParticleSettings BaseSettings; + + /// + /// null のときは world root ではなく model root で処理 + /// + [SerializeField] + Transform Center; + + /// + /// 枝分かれ不可 + /// + [SerializeField] + List Particles = new List(); + + void Reset() + { + Debug.Log("Warp.Reset"); + } + + void OnValidate() + { + // 枝分かれを削除 + Debug.Log("Warp.OnValidate"); + } + } +} diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Warp.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Warp.cs.meta new file mode 100644 index 000000000..c52669e6f --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Warp.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6d9e9d5010d025b4c9cdfb03eb8b1b0b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/RotateParticle.asmdef b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticle.asmdef similarity index 100% rename from Assets/VRM10_Samples/ClothSample/RotateParticle/RotateParticle.asmdef rename to Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticle.asmdef diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/RotateParticle.asmdef.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticle.asmdef.meta similarity index 100% rename from Assets/VRM10_Samples/ClothSample/RotateParticle/RotateParticle.asmdef.meta rename to Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticle.asmdef.meta diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs index 88250ecbe..248c29b81 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs @@ -274,5 +274,9 @@ namespace RotateParticle public void SetModelLevel(Transform modelRoot, BlittableModelLevel modelSettings) { } + + public void DrawGizmos() + { + } } } \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Scenes.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Scenes.meta index 20e52fe13..1f1f7737a 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Scenes.meta +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Scenes.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: cfa6b58a8a8571e478cf6bac4a00a23d +guid: d81d1a51508391a468106bec0350d41b folderAsset: yes DefaultImporter: externalObjects: {} From 5a0e2be6c67906feb5593f443345777c992d3d6b Mon Sep 17 00:00:00 2001 From: ousttrue Date: Fri, 15 Nov 2024 02:27:38 +0900 Subject: [PATCH 021/113] Converter.FromVrm10 --- .../RotateParticle/Editor/Converter.cs | 43 ++++++++++++++++--- .../RotateParticle/Runtime/Components/Warp.cs | 26 ++++++++--- 2 files changed, 58 insertions(+), 11 deletions(-) diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/Converter.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/Converter.cs index 5f2153c65..f229e82d9 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/Converter.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/Converter.cs @@ -1,3 +1,4 @@ +using System.Linq; using UnityEditor; using UnityEngine; using UniVRM10; @@ -20,12 +21,21 @@ namespace RotateParticle.Components return go.GetComponent() != null; } + /// + /// instance.SpringBone.Springs を rotate particle で置き換える。 + /// UNDO 可能。 + /// [MenuItem(FROM_VRM10_MENU, false)] public static void FromVrm10() { var go = Selection.activeGameObject; var instance = go.GetComponent(); + Undo.IncrementCurrentGroup(); + Undo.SetCurrentGroupName(FROM_VRM10_MENU); + var undo = Undo.GetCurrentGroup(); + + Undo.RegisterCompleteObjectUndo(instance, "RegisterCompleteObjectUndo"); foreach (var spring in instance.SpringBone.Springs) { if (spring.Joints == null || spring.Joints[0] == null) @@ -33,20 +43,43 @@ namespace RotateParticle.Components continue; } - var root = spring.Joints[0].gameObject; - if (root == null) + var root_joint = spring.Joints[0].gameObject; + if (root_joint == null) { continue; } - if (root.GetComponent() != null) + if (root_joint.GetComponent() != null) { continue; } - UnityEditor.Undo.IncrementCurrentGroup(); - UnityEditor.Undo.SetCurrentGroupName("VRM10SpringBoneColliderGroup.Separate"); + var warp = Undo.AddComponent(root_joint); + var joints = spring.Joints.Where(x => x != null).ToArray(); + for (int i = 0; i < joints.Length; ++i) + { + var joint = joints[i]; + warp.Particles.Add(new Warp.Particle + { + OverrideSettings = new Warp.ParticleSettings + { + DragForce = joint.m_dragForce, + GravityDir = joint.m_gravityDir, + GravityPower = joint.m_gravityPower, + StiffnessForce = joint.m_stiffnessForce, + // breaking change from vrm-1.0 + HitRadius = i > 0 ? joints[i - 1].m_jointRadius : joints[i].m_jointRadius, + }, + }); + Undo.DestroyObjectImmediate(joint); + } + spring.Joints.Clear(); } + instance.SpringBone.Springs.Clear(); + + Undo.RegisterFullObjectHierarchyUndo(go, "RegisterFullObjectHierarchyUndo"); + + Undo.CollapseUndoOperations(undo); } } } \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Warp.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Warp.cs index 3be388f61..e2e585130 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Warp.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Warp.cs @@ -12,6 +12,20 @@ namespace RotateParticle.Components [Serializable] public class ParticleSettings { + [SerializeField] + public float StiffnessForce = 1.0f; + + [SerializeField] + public float GravityPower = 0; + + [SerializeField] + public Vector3 GravityDir = new Vector3(0, -1.0f, 0); + + [SerializeField, Range(0, 1)] + public float DragForce = 0.4f; + + [SerializeField] + public float HitRadius = 0.02f; } /// @@ -25,29 +39,29 @@ namespace RotateParticle.Components } [SerializeField] - ParticleSettings BaseSettings; + public ParticleSettings BaseSettings; /// /// null のときは world root ではなく model root で処理 /// [SerializeField] - Transform Center; + public Transform Center; /// /// 枝分かれ不可 /// [SerializeField] - List Particles = new List(); + public List Particles = new List(); void Reset() { - Debug.Log("Warp.Reset"); + // Debug.Log("Warp.Reset"); } void OnValidate() { - // 枝分かれを削除 - Debug.Log("Warp.OnValidate"); + // TODO: 枝分かれを削除 + // Debug.Log("Warp.OnValidate"); } } } From 894b00b80581949e57d5cbede4234db4e6c29c67 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Fri, 15 Nov 2024 17:32:58 +0900 Subject: [PATCH 022/113] RotateParticleRuntimeProvider --- ...=> RotateParticleRuntimeProviderEditor.cs} | 50 ++++++++++++------- ...tateParticleRuntimeProviderEditor.cs.meta} | 0 .../Components/{Cloth.cs => RectCloth.cs} | 4 +- .../{Cloth.cs.meta => RectCloth.cs.meta} | 0 .../RotateParticleRuntimeProvider.cs | 29 +++++++++++ .../RotateParticleRuntimeProvider.cs.meta} | 0 .../RotateParticle/Runtime/Components/Warp.cs | 5 ++ ...RotateParticleSpringboneRuntimeProvider.cs | 13 ----- 8 files changed, 69 insertions(+), 32 deletions(-) rename Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/{Converter.cs => RotateParticleRuntimeProviderEditor.cs} (61%) rename Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/{Converter.cs.meta => RotateParticleRuntimeProviderEditor.cs.meta} (100%) rename Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/{Cloth.cs => RectCloth.cs} (75%) rename Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/{Cloth.cs.meta => RectCloth.cs.meta} (100%) create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RotateParticleRuntimeProvider.cs rename Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/{RotateParticleSpringboneRuntimeProvider.cs.meta => Components/RotateParticleRuntimeProvider.cs.meta} (100%) delete mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntimeProvider.cs diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/Converter.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/RotateParticleRuntimeProviderEditor.cs similarity index 61% rename from Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/Converter.cs rename to Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/RotateParticleRuntimeProviderEditor.cs index f229e82d9..708c651a4 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/Converter.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/RotateParticleRuntimeProviderEditor.cs @@ -6,9 +6,10 @@ using UniVRM10; namespace RotateParticle.Components { - public static class Converter + [CustomEditor(typeof(RotateParticleRuntimeProvider))] + public class RotateParticleRuntimeProviderEditor : Editor { - const string FROM_VRM10_MENU = "GameObject/CreateRotateParticleFromVrm10"; + const string FROM_VRM10_MENU = "Replace VRM10 Springs to RotateParticle Warps"; [MenuItem(FROM_VRM10_MENU, true)] public static bool IsFromVrm10() @@ -21,20 +22,8 @@ namespace RotateParticle.Components return go.GetComponent() != null; } - /// - /// instance.SpringBone.Springs を rotate particle で置き換える。 - /// UNDO 可能。 - /// - [MenuItem(FROM_VRM10_MENU, false)] - public static void FromVrm10() + static void FromVrm10(Vrm10Instance instance) { - var go = Selection.activeGameObject; - var instance = go.GetComponent(); - - Undo.IncrementCurrentGroup(); - Undo.SetCurrentGroupName(FROM_VRM10_MENU); - var undo = Undo.GetCurrentGroup(); - Undo.RegisterCompleteObjectUndo(instance, "RegisterCompleteObjectUndo"); foreach (var spring in instance.SpringBone.Springs) { @@ -77,9 +66,36 @@ namespace RotateParticle.Components } instance.SpringBone.Springs.Clear(); - Undo.RegisterFullObjectHierarchyUndo(go, "RegisterFullObjectHierarchyUndo"); + Undo.RegisterFullObjectHierarchyUndo(instance.gameObject, "RegisterFullObjectHierarchyUndo"); - Undo.CollapseUndoOperations(undo); + } + + public override void OnInspectorGUI() + { + var provider = target as RotateParticleRuntimeProvider; + if (provider == null) + { + return; + } + var instance = provider.GetComponent(); + using (new EditorGUI.DisabledScope(instance == null)) + { + if (GUILayout.Button("Replace VRM10 Springs to RotateParticle Warps")) + { + Undo.IncrementCurrentGroup(); + Undo.SetCurrentGroupName(FROM_VRM10_MENU); + var undo = Undo.GetCurrentGroup(); + + FromVrm10(instance); + + Undo.RegisterCompleteObjectUndo(provider, "RegisterCompleteObjectUndo"); + provider.Reset(); + + Undo.CollapseUndoOperations(undo); + } + } + + base.OnInspectorGUI(); } } } \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/Converter.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/RotateParticleRuntimeProviderEditor.cs.meta similarity index 100% rename from Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/Converter.cs.meta rename to Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/RotateParticleRuntimeProviderEditor.cs.meta diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Cloth.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RectCloth.cs similarity index 75% rename from Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Cloth.cs rename to Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RectCloth.cs index 77b9db313..078ad3abf 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Cloth.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RectCloth.cs @@ -5,9 +5,9 @@ using UnityEngine; namespace RotateParticle.Components { - [AddComponentMenu("RotateParticle/Cloth")] + [AddComponentMenu("RotateParticle/RectCloth")] [DisallowMultipleComponent] - public class Cloth : MonoBehaviour + public class RectCloth : MonoBehaviour { [SerializeField] public bool Loop = false; diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Cloth.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RectCloth.cs.meta similarity index 100% rename from Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Cloth.cs.meta rename to Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RectCloth.cs.meta diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RotateParticleRuntimeProvider.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RotateParticleRuntimeProvider.cs new file mode 100644 index 000000000..56f1b3ed3 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RotateParticleRuntimeProvider.cs @@ -0,0 +1,29 @@ +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using UniVRM10; + +namespace RotateParticle.Components +{ + [AddComponentMenu("RotateParticle/RotateParticleRuntimeProvider")] + [DisallowMultipleComponent] + public class RotateParticleRuntimeProvider : MonoBehaviour, IVrm10SpringBoneRuntimeProvider + { + [SerializeField] + public List Warps = new(); + + [SerializeField] + public List Cloths = new(); + + public IVrm10SpringBoneRuntime CreateSpringBoneRuntime() + { + return new RotateParticleSpringboneRuntime(); + } + + public void Reset() + { + Warps = GetComponentsInChildren().ToList(); + Cloths = GetComponentsInChildren().ToList(); + } + } +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntimeProvider.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RotateParticleRuntimeProvider.cs.meta similarity index 100% rename from Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntimeProvider.cs.meta rename to Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RotateParticleRuntimeProvider.cs.meta diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Warp.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Warp.cs index e2e585130..6c0e3ea7d 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Warp.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Warp.cs @@ -63,5 +63,10 @@ namespace RotateParticle.Components // TODO: 枝分かれを削除 // Debug.Log("Warp.OnValidate"); } + + internal List ToList() + { + throw new NotImplementedException(); + } } } diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntimeProvider.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntimeProvider.cs deleted file mode 100644 index 456d245ef..000000000 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntimeProvider.cs +++ /dev/null @@ -1,13 +0,0 @@ -using UnityEngine; -using UniVRM10; - -namespace RotateParticle -{ - public class RotateParticleSpringboneRuntimeProvider : MonoBehaviour, IVrm10SpringBoneRuntimeProvider - { - public IVrm10SpringBoneRuntime CreateSpringBoneRuntime() - { - return new RotateParticleSpringboneRuntime(); - } - } -} \ No newline at end of file From bcf1991259fa9608d4ed75a2b17222d2f9627351 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Fri, 15 Nov 2024 18:49:06 +0900 Subject: [PATCH 023/113] useInheritSettings --- .../RotateParticleRuntimeProviderEditor.cs | 32 +++++++---- .../RotateParticle/Runtime/Components/Warp.cs | 55 +++++++++++++++++-- 2 files changed, 73 insertions(+), 14 deletions(-) diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/RotateParticleRuntimeProviderEditor.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/RotateParticleRuntimeProviderEditor.cs index 708c651a4..93d1b972c 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/RotateParticleRuntimeProviderEditor.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/RotateParticleRuntimeProviderEditor.cs @@ -48,18 +48,30 @@ namespace RotateParticle.Components for (int i = 0; i < joints.Length; ++i) { var joint = joints[i]; - warp.Particles.Add(new Warp.Particle + var settings = new Warp.ParticleSettings { - OverrideSettings = new Warp.ParticleSettings + DragForce = joint.m_dragForce, + GravityDir = joint.m_gravityDir, + GravityPower = joint.m_gravityPower, + StiffnessForce = joint.m_stiffnessForce, + }; + if (i == 0) + { + settings.HitRadius = joints[0].m_jointRadius; + warp.BaseSettings = settings; + } + else + { + // breaking change from vrm-1.0 + settings.HitRadius = joints[i - 1].m_jointRadius; + var useInheritSettings = warp.BaseSettings.Equals(settings); + warp.Particles.Add(new Warp.Particle { - DragForce = joint.m_dragForce, - GravityDir = joint.m_gravityDir, - GravityPower = joint.m_gravityPower, - StiffnessForce = joint.m_stiffnessForce, - // breaking change from vrm-1.0 - HitRadius = i > 0 ? joints[i - 1].m_jointRadius : joints[i].m_jointRadius, - }, - }); + useInheritSettings = useInheritSettings, + OverrideSettings = settings, + Transform = joint.transform, + }); + } Undo.DestroyObjectImmediate(joint); } spring.Joints.Clear(); diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Warp.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Warp.cs index 6c0e3ea7d..fc4d3f71d 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Warp.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Warp.cs @@ -10,7 +10,7 @@ namespace RotateParticle.Components public class Warp : MonoBehaviour { [Serializable] - public class ParticleSettings + public class ParticleSettings : IEquatable { [SerializeField] public float StiffnessForce = 1.0f; @@ -26,6 +26,27 @@ namespace RotateParticle.Components [SerializeField] public float HitRadius = 0.02f; + + public override bool Equals(object obj) // Object.Equals(Object)のオーバーライド + { + return Equals(obj as ParticleSettings); + } + + public bool Equals(ParticleSettings other) + { + return + StiffnessForce == other.StiffnessForce + && GravityPower == other.GravityPower + && GravityDir == other.GravityDir + && DragForce == other.DragForce + && HitRadius == other.HitRadius + ; + } + + public override int GetHashCode() + { + return GravityDir.GetHashCode(); + } } /// @@ -34,8 +55,14 @@ namespace RotateParticle.Components [Serializable] public class Particle { - public bool useInheritSettings; - public ParticleSettings OverrideSettings; + public bool useInheritSettings = true; + public ParticleSettings OverrideSettings = new(); + public Transform Transform; + + public ParticleSettings GetSettings(ParticleSettings baseSettings) + { + return useInheritSettings ? baseSettings : OverrideSettings; + } } [SerializeField] @@ -68,5 +95,25 @@ namespace RotateParticle.Components { throw new NotImplementedException(); } + + public void OnDrawGizmosSelected() + { + Gizmos.DrawSphere(transform.position, BaseSettings.HitRadius); + + Transform prev = transform; + foreach (var p in Particles) + { + if (p != null && p.Transform != null) + { + Gizmos.DrawWireSphere(p.Transform.position, p.GetSettings(BaseSettings).HitRadius); + + if (prev != null) + { + Gizmos.DrawLine(prev.position, p.Transform.position); + } + } + prev = p.Transform; + } + } } -} +} \ No newline at end of file From 77188fb14807f482ba7817cc7e84566c236fbd86 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Fri, 15 Nov 2024 20:12:31 +0900 Subject: [PATCH 024/113] RotateParticleSystem use Warp --- .../ClothSample/ClothViewer/ClothGuess.cs | 198 ++++++++++++++++ .../ClothGuess.cs.meta} | 2 +- .../ClothViewer/ClothViewer.asmdef | 3 +- .../ClothViewer/HumanoidCollider.cs | 34 +++ .../ClothViewer/HumanoidCollider.cs.meta | 11 + .../Runtime/CollisionGroupMask.cs} | 34 +-- .../Runtime/CollisionGroupMask.cs.meta | 11 + .../Runtime/Components/RectCloth.cs | 2 +- .../RotateParticle/Runtime/ParticleList.cs | 43 ++-- .../RotateParticleSpringboneRuntime.cs | 217 +----------------- .../Runtime/RotateParticleSystem.cs | 103 ++++----- .../ClothSample/SphereTriangle/README.md | 3 + .../ClothSample/SphereTriangle/README.md.meta | 7 + 13 files changed, 339 insertions(+), 329 deletions(-) create mode 100644 Assets/VRM10_Samples/ClothSample/ClothViewer/ClothGuess.cs rename Assets/VRM10_Samples/ClothSample/{SphereTriangle/StrandGroup.cs.meta => ClothViewer/ClothGuess.cs.meta} (83%) create mode 100644 Assets/VRM10_Samples/ClothSample/ClothViewer/HumanoidCollider.cs create mode 100644 Assets/VRM10_Samples/ClothSample/ClothViewer/HumanoidCollider.cs.meta rename Assets/VRM10_Samples/ClothSample/{SphereTriangle/StrandGroup.cs => RotateParticle/Runtime/CollisionGroupMask.cs} (62%) create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/CollisionGroupMask.cs.meta create mode 100644 Assets/VRM10_Samples/ClothSample/SphereTriangle/README.md create mode 100644 Assets/VRM10_Samples/ClothSample/SphereTriangle/README.md.meta diff --git a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothGuess.cs b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothGuess.cs new file mode 100644 index 000000000..9afa7cfae --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothGuess.cs @@ -0,0 +1,198 @@ +using System.Collections.Generic; +using System.Linq; +using RotateParticle; +using RotateParticle.Components; +using SphereTriangle; +using UnityEngine; + + +namespace UniVRM10.Cloth.Viewer +{ + public static class ClothGuess + { + public enum StrandConnectionType + { + Cloth, + ClothLoop, + Strand, + } + + public static void Guess(RotateParticleSystem _system, Animator animator) + { + // skirt + { + if (TryAddGroup(animator, HumanBodyBones.Hips, + new[] { "skirt", "スカート", "スカート" }, out var g)) + { + _system._warps.AddRange(g); + // StrandConnectionType.ClothLoop + } + } + { + if (TryAddGroupChildChild(animator, HumanBodyBones.Hips, + new[] { "skirt", "スカート", "スカート" }, new string[] { }, out var g)) + { + _system._warps.AddRange(g); + // StrandConnectionType.ClothLoop, + } + } + { + if (TryAddGroup(animator, HumanBodyBones.Head, + new[] { "髪", "hair" }, out var g)) + { + _system._warps.AddRange(g); + // StrandConnectionType.Strand, + } + } + { + if (TryAddGroup(animator, HumanBodyBones.Hips, + new[] { "裾" }, out var g)) + { + _system._warps.AddRange(g); + // StrandConnectionType.Cloth, + } + } + { + if (TryAddGroupChildChild(animator, HumanBodyBones.LeftUpperArm, + new[] { "袖" }, new[] { "ひじ袖" }, out var g)) + { + _system._warps.AddRange(g); + // StrandConnectionType.ClothLoop, + } + } + { + if (TryAddGroupChildChild(animator, HumanBodyBones.LeftLowerArm, + new[] { "袖" }, new string[] { }, out var g)) + { + _system._warps.AddRange(g); + // StrandConnectionType.ClothLoop, + } + } + { + if (TryAddGroupChildChild(animator, HumanBodyBones.RightUpperArm, + new[] { "袖" }, new[] { "ひじ袖" }, out var g)) + { + _system._warps.AddRange(g); + // , StrandConnectionType.ClothLoop + } + } + { + if (TryAddGroupChildChild(animator, HumanBodyBones.RightLowerArm, + new[] { "袖" }, new string[] { }, out var g)) + { + _system._warps.AddRange(g); + // StrandConnectionType.ClothLoop, false, + } + } + { + if (TryAddGroup(animator, HumanBodyBones.Chest, new[] { "マント" }, + out var g)) + { + _system._warps.AddRange(g); + // StrandConnectionType.Cloth, + } + } + + } + + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + static bool TryAddGroupChildChild( + Animator animator, HumanBodyBones humanBone, + string[] targets, string[] excludes, + out List group) + { + var bone = animator.GetBoneTransform(humanBone); + if (bone == null) + { + Debug.LogWarning($"{humanBone} not found"); + group = default; + return false; + } + + List transforms = new(); + foreach (Transform child in bone) + { + foreach (Transform childchild in child) + { + if (excludes.Any(x => childchild.name.ToLower().Contains(x.ToLower()))) + { + continue; + } + + foreach (var target in targets) + { + if (childchild.name.ToLower().Contains(target.ToLower())) + { + var warp = childchild.gameObject.AddComponent(); + // Name = name, + // CollisionMask = mask, + warp.BaseSettings.HitRadius = 0.02f; + // Connection = type + transforms.Add(warp); + break; + } + } + } + } + if (transforms.Count == 0) + { + // Debug.LogWarning($"{string.Join(',', targets)} not found"); + group = default; + return false; + } + + group = transforms; + return true; + } + + static bool TryAddGroup(Animator animator, HumanBodyBones humanBone, string[] targets, + out List group) + { + var bone = animator.GetBoneTransform(humanBone); + if (bone == null) + { + Debug.LogWarning($"{humanBone} not found"); + group = default; + return false; + } + + List transforms = new(); + foreach (Transform child in bone) + { + foreach (var target in targets) + { + if (child.name.ToLower().Contains(target.ToLower())) + { + var warp = child.gameObject.AddComponent(); + // CollisionMask = mask, + warp.BaseSettings.HitRadius = 0.02f; + // Connection = type + transforms.Add(warp); + break; + } + } + } + if (transforms.Count == 0) + { + // Debug.LogWarning($"{string.Join(',', targets)} not found"); + group = default; + return false; + } + + group = transforms; + return true; + } + } +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/StrandGroup.cs.meta b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothGuess.cs.meta similarity index 83% rename from Assets/VRM10_Samples/ClothSample/SphereTriangle/StrandGroup.cs.meta rename to Assets/VRM10_Samples/ClothSample/ClothViewer/ClothGuess.cs.meta index 4dbbe515d..2ac6006fa 100644 --- a/Assets/VRM10_Samples/ClothSample/SphereTriangle/StrandGroup.cs.meta +++ b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothGuess.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: efab592ca762fea46adb3c38b41e65d0 +guid: 8ad944ee2631d2b4eb6a33e6bbcd349f MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewer.asmdef b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewer.asmdef index 75b04563e..7d155e41b 100644 --- a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewer.asmdef +++ b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewer.asmdef @@ -6,7 +6,8 @@ "GUID:8d76e605759c3f64a957d63ef96ada7c", "GUID:1cd941934d098654fa21a13f28346412", "GUID:e47c917724578cc43b5506c17a27e9a0", - "GUID:308b348fb80d89d42a9620951b0f60db" + "GUID:308b348fb80d89d42a9620951b0f60db", + "GUID:0138a2c7639266f45b948ea162125de5" ], "includePlatforms": [], "excludePlatforms": [], diff --git a/Assets/VRM10_Samples/ClothSample/ClothViewer/HumanoidCollider.cs b/Assets/VRM10_Samples/ClothSample/ClothViewer/HumanoidCollider.cs new file mode 100644 index 000000000..a09e16c99 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/ClothViewer/HumanoidCollider.cs @@ -0,0 +1,34 @@ +using System.Collections; +using System.Collections.Generic; +using RotateParticle; +using UnityEngine; + +namespace UniVRM10.Cloth.Viewer +{ + public static class HumanCollider + { + static (string group, HumanBodyBones head, HumanBodyBones tail, float radius)[] Capsules = new[] + { + ("Leg", HumanBodyBones.LeftUpperLeg, HumanBodyBones.LeftLowerLeg, 0.06f), + ("Leg", HumanBodyBones.LeftLowerLeg, HumanBodyBones.LeftFoot, 0.05f), + ("Leg", HumanBodyBones.RightUpperLeg, HumanBodyBones.RightLowerLeg, 0.06f), + ("Leg", HumanBodyBones.RightLowerLeg, HumanBodyBones.RightFoot, 0.05f), + + ("Arm", HumanBodyBones.LeftUpperArm, HumanBodyBones.LeftLowerArm, 0.03f), + ("Arm", HumanBodyBones.LeftLowerArm, HumanBodyBones.LeftHand, 0.03f), + ("Arm", HumanBodyBones.LeftHand, HumanBodyBones.LeftMiddleProximal, 0.02f), + ("Arm", HumanBodyBones.RightUpperArm, HumanBodyBones.RightLowerArm, 0.03f), + ("Arm", HumanBodyBones.RightLowerArm, HumanBodyBones.RightHand, 0.03f), + ("Arm", HumanBodyBones.RightHand, HumanBodyBones.RightMiddleProximal, 0.02f), + }; + + public static void AddColliders(RotateParticleSystem _system, Animator animator) + { + foreach (var (group, head, tail, radius) in Capsules) + { + _system.AddColliderIfNotExists(group, + animator.GetBoneTransform(head), animator.GetBoneTransform(tail), radius); + } + } + } +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/ClothViewer/HumanoidCollider.cs.meta b/Assets/VRM10_Samples/ClothSample/ClothViewer/HumanoidCollider.cs.meta new file mode 100644 index 000000000..ab43b935a --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/ClothViewer/HumanoidCollider.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e6fd7b5b1e402644088796a17d7c2df9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/StrandGroup.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/CollisionGroupMask.cs similarity index 62% rename from Assets/VRM10_Samples/ClothSample/SphereTriangle/StrandGroup.cs rename to Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/CollisionGroupMask.cs index c4392467b..e2a3204f9 100644 --- a/Assets/VRM10_Samples/ClothSample/SphereTriangle/StrandGroup.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/CollisionGroupMask.cs @@ -1,16 +1,5 @@ -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace SphereTriangle +namespace RotateParticle { - public enum StrandConnectionType - { - Cloth, - ClothLoop, - Strand, - } - [System.Flags] public enum CollisionGroupMask : uint { @@ -49,25 +38,4 @@ namespace SphereTriangle Group32 = 0x80000000, All = uint.MaxValue, } - - [Serializable] - public class StrandGroup - { - [SerializeField] - public string Name; - - [SerializeField] - public CollisionGroupMask CollisionMask; - - [SerializeField] - public StrandConnectionType Connection; - - [SerializeField] - public List Roots = new List(); - - [SerializeField] - [Range(0.001f, 0.5f)] - public float DefaultStrandRaius = 0.05f; - - } } \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/CollisionGroupMask.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/CollisionGroupMask.cs.meta new file mode 100644 index 000000000..8672185ef --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/CollisionGroupMask.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7ac7f1d83935aa84b9e80739be4ae02b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RectCloth.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RectCloth.cs index 078ad3abf..dda267afb 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RectCloth.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RectCloth.cs @@ -10,7 +10,7 @@ namespace RotateParticle.Components public class RectCloth : MonoBehaviour { [SerializeField] - public bool Loop = false; + public bool LoopIsClosed = false; [SerializeField] public List Warps = new(); diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleList.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleList.cs index de7babbed..ca5af0133 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleList.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleList.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using SphereTriangle; +using RotateParticle.Components; using UnityEngine; @@ -12,35 +12,28 @@ namespace RotateParticle public List _particles = new(); public List _particleTransforms = new(); - public Strand MakeParticleStrand(SimulationEnv env, Transform t, float radius, CollisionGroupMask mask) + public Strand MakeParticleStrand(SimulationEnv env, Warp warp, CollisionGroupMask mask) { var strand = new Strand(mask); - _MakeParticlesRecursive(strand, env, 0, t, radius, null); + + // root kinematic + var particle_index = _MakeAParticle(null, env, warp.transform, 0, 0, strand.CollisionMask); + var joint = _particles[particle_index]; + strand.Particles.Add(joint); + + foreach (var particle in warp.Particles) + { + var child_index = _MakeAParticle(joint, env, particle.Transform, + particle.GetSettings(warp.BaseSettings).HitRadius, 1, strand.CollisionMask); + var child = _particles[child_index]; + joint.Children.Add(child); + joint = child; + } + return strand; } - RotateParticle _MakeParticlesRecursive(Strand strand, SimulationEnv env, int child_index, Transform t, float radius, RotateParticle parent) - { - var mass = parent == null ? 0 : 1; - if (child_index > 0) - { - // 枝分かれ動かない - mass = 0; - } - - var particle_index = _MakeAParticle(env, t, radius, parent, mass, strand.CollisionMask); - var joint = _particles[particle_index]; - strand.Particles.Add(joint); - for (int i = 0; i < t.childCount; ++i) - { - var child = t.GetChild(i); - var child_joint = _MakeParticlesRecursive(strand, env, i, child, radius, joint); - joint.Children.Add(child_joint); - } - return joint; - } - - int _MakeAParticle(SimulationEnv env, Transform t, float radius, RotateParticle parent, float mass, CollisionGroupMask collisionMask) + int _MakeAParticle(RotateParticle parent, SimulationEnv env, Transform t, float radius, float mass, CollisionGroupMask collisionMask) { var index = _particles.Count; _particleTransforms.Add(t); diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs index 248c29b81..f8c04ca7b 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs @@ -1,19 +1,13 @@ -using System; -using System.Collections.Generic; -using System.Linq; using System.Threading.Tasks; -using SphereTriangle; +using RotateParticle.Components; using UniGLTF; using UniGLTF.SpringBoneJobs.Blittables; using UnityEngine; using UniVRM10; + namespace RotateParticle { - /// - /// SpcriptedImporter 経由の import 向け。 - /// NativeArray の確保や DontDestroyOnLoad を回避。 - /// public class RotateParticleSpringboneRuntime : IVrm10SpringBoneRuntime { RotateParticleSystem _system; @@ -24,12 +18,6 @@ namespace RotateParticle public async Task InitializeAsync(Vrm10Instance instance, IAwaitCaller awaitCaller) { - await awaitCaller.NextFrame(); - // if (_setup != null) - // { - // _setup(instance); - // } - var animator = instance.GetComponent(); if (animator == null) { @@ -48,211 +36,16 @@ namespace RotateParticle _system.Env.DragForce = 0.6f; _system.Env.Stiffness = 0.07f; - foreach (var (group, head, tail, radius) in Capsules) + foreach (var warp in instance.GetComponentsInChildren()) { - _system.AddColliderIfNotExists(group, - animator.GetBoneTransform(head), animator.GetBoneTransform(tail), radius); - } + _system._warps.Add(warp); - // skirt - { - if (TryAddGroup(CollisionGroupMask.Group01, "Skirt", animator, HumanBodyBones.Hips, new[] { "skirt", "スカート", "スカート" }, StrandConnectionType.ClothLoop, - out var g)) - { - _system._strandGroups.Add(g); - } - } - { - if (TryAddGroupChildChild(CollisionGroupMask.Group01, "Skirt", animator, HumanBodyBones.Hips, new[] { "skirt", "スカート", "スカート" }, new string[] { }, StrandConnectionType.ClothLoop, false, - out var g)) - { - _system._strandGroups.Add(g); - } - } - { - if (TryAddGroup(CollisionGroupMask.Group02, "髪", animator, HumanBodyBones.Head, new[] { "髪", "hair" }, StrandConnectionType.Strand, - out var g)) - { - _system._strandGroups.Add(g); - } - } - { - if (TryAddGroup(CollisionGroupMask.Group01, "裾", animator, HumanBodyBones.Hips, new[] { "裾" }, StrandConnectionType.Cloth, - out var g)) - { - _system._strandGroups.Add(g); - } - } - { - if (TryAddGroupChildChild(CollisionGroupMask.Group02, "左袖", animator, HumanBodyBones.LeftUpperArm, new[] { "袖" }, new[] { "ひじ袖" }, StrandConnectionType.ClothLoop, - false, - out var g)) - { - _system._strandGroups.Add(g); - } - } - { - if (TryAddGroupChildChild(CollisionGroupMask.Group02, "左ひじ袖", animator, HumanBodyBones.LeftLowerArm, new[] { "袖" }, new string[] { }, StrandConnectionType.ClothLoop, - false, - out var g)) - { - _system._strandGroups.Add(g); - } - } - { - if (TryAddGroupChildChild(CollisionGroupMask.Group02, "右袖", animator, HumanBodyBones.RightUpperArm, new[] { "袖" }, new[] { "ひじ袖" }, StrandConnectionType.ClothLoop, - false, - out var g)) - { - _system._strandGroups.Add(g); - } - } - { - if (TryAddGroupChildChild(CollisionGroupMask.Group02, "右ひじ袖", animator, HumanBodyBones.RightLowerArm, new[] { "袖" }, new string[] { }, StrandConnectionType.ClothLoop, - false, - out var g)) - { - _system._strandGroups.Add(g); - } - } - { - if (TryAddGroup(CollisionGroupMask.Group01 | CollisionGroupMask.Group02, "マント", animator, HumanBodyBones.Chest, new[] { "マント" }, StrandConnectionType.Cloth, - out var g)) - { - _system._strandGroups.Add(g); - } + await awaitCaller.NextFrame(); } _system.Initialize(); } - static (string group, HumanBodyBones head, HumanBodyBones tail, float radius)[] Capsules = new[] - { - ("Leg", HumanBodyBones.LeftUpperLeg, HumanBodyBones.LeftLowerLeg, 0.06f), - ("Leg", HumanBodyBones.LeftLowerLeg, HumanBodyBones.LeftFoot, 0.05f), - ("Leg", HumanBodyBones.RightUpperLeg, HumanBodyBones.RightLowerLeg, 0.06f), - ("Leg", HumanBodyBones.RightLowerLeg, HumanBodyBones.RightFoot, 0.05f), - - ("Arm", HumanBodyBones.LeftUpperArm, HumanBodyBones.LeftLowerArm, 0.03f), - ("Arm", HumanBodyBones.LeftLowerArm, HumanBodyBones.LeftHand, 0.03f), - ("Arm", HumanBodyBones.LeftHand, HumanBodyBones.LeftMiddleProximal, 0.02f), - ("Arm", HumanBodyBones.RightUpperArm, HumanBodyBones.RightLowerArm, 0.03f), - ("Arm", HumanBodyBones.RightLowerArm, HumanBodyBones.RightHand, 0.03f), - ("Arm", HumanBodyBones.RightHand, HumanBodyBones.RightMiddleProximal, 0.02f), - }; - - // T GetOrAddComponent() where T : Component - // { - // var t = GetComponent(); - // if (t != null) - // { - // return t; - // } - // return gameObject.AddComponent(); - // } - - bool TryAddGroup(CollisionGroupMask mask, string name, Animator animator, HumanBodyBones humanBone, string[] targets, StrandConnectionType type, - out StrandGroup group) - { - var bone = animator.GetBoneTransform(humanBone); - if (bone == null) - { - Debug.LogWarning($"{humanBone} not found"); - group = default; - return false; - } - - List transforms = new(); - foreach (Transform child in bone) - { - foreach (var target in targets) - { - if (child.name.ToLower().Contains(target.ToLower())) - { - transforms.Add(child); - break; - } - } - } - if (transforms.Count == 0) - { - // Debug.LogWarning($"{string.Join(',', targets)} not found"); - group = default; - return false; - } - - group = new StrandGroup - { - Name = name, - CollisionMask = mask, - DefaultStrandRaius = 0.02f, - Connection = type - }; - group.Roots.AddRange(transforms); - - // sort - group.Roots.Sort(new TransformSort(bone.position)); - return true; - } - - bool TryAddGroupChildChild(CollisionGroupMask mask, string name, Animator animator, HumanBodyBones humanBone, - string[] targets, string[] excludes, - StrandConnectionType type, - bool sort, - out StrandGroup group) - { - var bone = animator.GetBoneTransform(humanBone); - if (bone == null) - { - Debug.LogWarning($"{humanBone} not found"); - group = default; - return false; - } - - List transforms = new(); - foreach (Transform child in bone) - { - foreach (Transform childchild in child) - { - if (excludes.Any(x => childchild.name.ToLower().Contains(x.ToLower()))) - { - continue; - } - - foreach (var target in targets) - { - if (childchild.name.ToLower().Contains(target.ToLower())) - { - transforms.Add(childchild); - break; - } - } - } - } - if (transforms.Count == 0) - { - // Debug.LogWarning($"{string.Join(',', targets)} not found"); - group = default; - return false; - } - - group = new StrandGroup - { - Name = name, - CollisionMask = mask, - DefaultStrandRaius = 0.02f, - Connection = type - }; - group.Roots.AddRange(transforms); - - // sort - if (sort) - { - group.Roots.Sort(new TransformSort(bone.position)); - } - return true; - } - public void Process() { _system.Process(Time.deltaTime); diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs index 437507c16..5a7ce3184 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs @@ -15,7 +15,7 @@ namespace RotateParticle public SimulationEnv Env = new(); [SerializeField] - public List _strandGroups = new List(); + public List _warps = new(); [SerializeField] public List _colliderGroups = new(); @@ -96,22 +96,53 @@ namespace RotateParticle HashSet _clothUsedParticles = new(); public void InitializeCloth( - StrandGroup g, + Components.RectCloth g, ParticleList list, List strands, List<(SpringConstraint, ClothRectCollision)> clothRects) { - if (g.Connection == StrandConnectionType.Cloth || g.Connection == StrandConnectionType.ClothLoop) + for (int i = 1; i < strands.Count; ++i) { - for (int i = 1; i < strands.Count; ++i) + var s0 = strands[i - 1]; + var s1 = strands[i]; + for (int j = 1; j < s0.Particles.Count && j < s1.Particles.Count; ++j) { - var s0 = strands[i - 1]; - var s1 = strands[i]; + // d x x c + // | | + // a x-x b + var a = s0.Particles[j]; + var b = s1.Particles[j]; + var c = s1.Particles[j - 1]; + var d = s0.Particles[j - 1]; + _clothUsedParticles.Add(a.Init.Index); + _clothUsedParticles.Add(b.Init.Index); + _clothUsedParticles.Add(c.Init.Index); + _clothUsedParticles.Add(d.Init.Index); + if (i % 2 == 1) + { + // 互い違いに + // abcd to badc + (a, b) = (b, a); + (c, d) = (d, c); + } + clothRects.Add(( + new SpringConstraint( + list._particles[a.Init.Index], + list._particles[b.Init.Index]), + new ClothRectCollision( + a.Init.Index, b.Init.Index, c.Init.Index, d.Init.Index))); + } + } + + if (strands.Count >= 3) + { + if (g.LoopIsClosed) + { + var i = strands.Count; + var s0 = strands.Last(); + var s1 = strands.First(); for (int j = 1; j < s0.Particles.Count && j < s1.Particles.Count; ++j) { - // d x x c - // | | - // a x-x b var a = s0.Particles[j]; var b = s1.Particles[j]; var c = s1.Particles[j - 1]; @@ -132,42 +163,9 @@ namespace RotateParticle list._particles[a.Init.Index], list._particles[b.Init.Index]), new ClothRectCollision( - a.Init.Index, b.Init.Index, c.Init.Index, d.Init.Index))); - } - } - if (strands.Count >= 3) - { - if (g.Connection == StrandConnectionType.ClothLoop) - { - var i = strands.Count; - var s0 = strands.Last(); - var s1 = strands.First(); - for (int j = 1; j < s0.Particles.Count && j < s1.Particles.Count; ++j) - { - var a = s0.Particles[j]; - var b = s1.Particles[j]; - var c = s1.Particles[j - 1]; - var d = s0.Particles[j - 1]; - _clothUsedParticles.Add(a.Init.Index); - _clothUsedParticles.Add(b.Init.Index); - _clothUsedParticles.Add(c.Init.Index); - _clothUsedParticles.Add(d.Init.Index); - if (i % 2 == 1) - { - // 互い違いに - // abcd to badc - (a, b) = (b, a); - (c, d) = (d, c); - } - clothRects.Add(( - new SpringConstraint( - list._particles[a.Init.Index], - list._particles[b.Init.Index]), - new ClothRectCollision( - a.Init.Index, b.Init.Index, c.Init.Index, d.Init.Index - ) - )); - } + a.Init.Index, b.Init.Index, c.Init.Index, d.Init.Index + ) + )); } } } @@ -175,20 +173,13 @@ namespace RotateParticle public void Initialize() { - foreach (var g in _strandGroups) + foreach (var g in _warps) { - if (g.Roots?.Count == 0) - { - continue; - } var strands = new List(); - foreach (var root in g.Roots) - { - var strand = _list.MakeParticleStrand(Env, root, g.DefaultStrandRaius, g.CollisionMask); - strands.Add(strand); - } + var strand = _list.MakeParticleStrand(Env, g, default); + strands.Add(strand); - InitializeCloth(g, _list, strands, _clothRects); + // InitializeCloth(g, _list, strands, _clothRects); _strands.AddRange(strands); } diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/README.md b/Assets/VRM10_Samples/ClothSample/SphereTriangle/README.md new file mode 100644 index 000000000..b2c397a77 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/SphereTriangle/README.md @@ -0,0 +1,3 @@ +# SphereTriangle + +球と三角形の衝突判定に関する補助ライブラリー \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/README.md.meta b/Assets/VRM10_Samples/ClothSample/SphereTriangle/README.md.meta new file mode 100644 index 000000000..7135b4e26 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/SphereTriangle/README.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 08a7b8ca5ff1079449b681d78a8f9c34 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: From 29474d17c705abba00603ae4e40da598d8f23fd3 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Fri, 15 Nov 2024 21:13:57 +0900 Subject: [PATCH 025/113] InitializeCloth --- .../Runtime/Components/RectCloth.cs | 58 ++++++++++++++++++- .../RotateParticle/Runtime/ParticleList.cs | 1 + .../RotateParticleSpringboneRuntime.cs | 11 +++- .../Runtime/RotateParticleSystem.cs | 41 ++++++++----- 4 files changed, 92 insertions(+), 19 deletions(-) diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RectCloth.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RectCloth.cs index dda267afb..cf5208cba 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RectCloth.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RectCloth.cs @@ -1,4 +1,3 @@ -using System.Collections; using System.Collections.Generic; using UnityEngine; @@ -14,5 +13,62 @@ namespace RotateParticle.Components [SerializeField] public List Warps = new(); + + void Reset() + { + for (int i = 0; i < transform.childCount; ++i) + { + var child = transform.GetChild(i); + if (child.TryGetComponent(out var warp)) + { + Warps.Add(warp); + } + } + } + + public void OnDrawGizmosSelected() + { + if (Warps.Count == 0) + { + return; + } + + // Gizmos.color = Color.red; + Gizmos.color = new Color(1, 0.5f, 0); + for (int i = 0; i < Warps.Count; ++i) + { + if (i + 1 == Warps.Count) + { + if (LoopIsClosed) + { + DrawWeft(Warps[i], Warps[0]); + } + } + else + { + DrawWeft(Warps[i], Warps[i + 1]); + } + } + } + + void DrawWeft(Warp w0, Warp w1) + { + if (w0 == null || w1 == null) + { + return; + } + + Gizmos.DrawLine(w0.transform.position, w1.transform.position); + + for (int i = 0; i < w0.Particles.Count && i < w1.Particles.Count; ++i) + { + var p0 = w0.Particles[i]; + var p1 = w1.Particles[i]; + if (p0 != null && p0.Transform != null && p1 != null && p1.Transform != null) + { + Gizmos.DrawLine(p0.Transform.position, p1.Transform.position); + } + } + } } } \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleList.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleList.cs index ca5af0133..dcf4f91d6 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleList.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleList.cs @@ -26,6 +26,7 @@ namespace RotateParticle var child_index = _MakeAParticle(joint, env, particle.Transform, particle.GetSettings(warp.BaseSettings).HitRadius, 1, strand.CollisionMask); var child = _particles[child_index]; + strand.Particles.Add(child); joint.Children.Add(child); joint = child; } diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs index f8c04ca7b..5454c075f 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs @@ -39,15 +39,20 @@ namespace RotateParticle foreach (var warp in instance.GetComponentsInChildren()) { _system._warps.Add(warp); - - await awaitCaller.NextFrame(); } + foreach (var cloth in instance.GetComponentsInChildren()) + { + _system._cloths.Add(cloth); + } + + await awaitCaller.NextFrame(); _system.Initialize(); } public void Process() { + if (_system == null) return; _system.Process(Time.deltaTime); } @@ -70,6 +75,8 @@ namespace RotateParticle public void DrawGizmos() { + if (_system == null) return; + _system.DrawGizmos(); } } } \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs index 5a7ce3184..509f73c49 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using RotateParticle.Components; using SphereTriangle; using UnityEngine; @@ -15,7 +16,10 @@ namespace RotateParticle public SimulationEnv Env = new(); [SerializeField] - public List _warps = new(); + public List _warps = new(); + + [SerializeField] + public List _cloths = new(); [SerializeField] public List _colliderGroups = new(); @@ -96,15 +100,15 @@ namespace RotateParticle HashSet _clothUsedParticles = new(); public void InitializeCloth( - Components.RectCloth g, + RectCloth cloth, ParticleList list, - List strands, - List<(SpringConstraint, ClothRectCollision)> clothRects) + List<(SpringConstraint, ClothRectCollision)> clothRects, + Dictionary strandMap) { - for (int i = 1; i < strands.Count; ++i) + for (int i = 1; i < cloth.Warps.Count; ++i) { - var s0 = strands[i - 1]; - var s1 = strands[i]; + var s0 = strandMap[cloth.Warps[i - 1]]; + var s1 = strandMap[cloth.Warps[i]]; for (int j = 1; j < s0.Particles.Count && j < s1.Particles.Count; ++j) { // d x x c @@ -134,13 +138,13 @@ namespace RotateParticle } } - if (strands.Count >= 3) + if (cloth.Warps.Count >= 3) { - if (g.LoopIsClosed) + if (cloth.LoopIsClosed) { - var i = strands.Count; - var s0 = strands.Last(); - var s1 = strands.First(); + var i = cloth.Warps.Count; + var s0 = strandMap[cloth.Warps.Last()]; + var s1 = strandMap[cloth.Warps.First()]; for (int j = 1; j < s0.Particles.Count && j < s1.Particles.Count; ++j) { var a = s0.Particles[j]; @@ -173,14 +177,19 @@ namespace RotateParticle public void Initialize() { - foreach (var g in _warps) + var strandMap = new Dictionary(); + foreach (var warp in _warps) { var strands = new List(); - var strand = _list.MakeParticleStrand(Env, g, default); + var strand = _list.MakeParticleStrand(Env, warp, default); strands.Add(strand); - - // InitializeCloth(g, _list, strands, _clothRects); _strands.AddRange(strands); + strandMap.Add(warp, strand); + } + + foreach (var cloth in _cloths) + { + InitializeCloth(cloth, _list, _clothRects, strandMap); } _newPos = new(_list._particles.Count); From 19f8b077022da70b9345a2b02724816b12dc4f5e Mon Sep 17 00:00:00 2001 From: ousttrue Date: Fri, 15 Nov 2024 21:35:50 +0900 Subject: [PATCH 026/113] mv --- .../ClothSample/ClothViewer/ClothViewer.asmdef | 3 +-- .../RotateParticle/Runtime/RotateParticle.asmdef | 1 - .../Runtime}/SphereTriangle.meta | 0 .../Runtime}/SphereTriangle/CapsuleInfo.cs | 0 .../Runtime}/SphereTriangle/CapsuleInfo.cs.meta | 0 .../Runtime}/SphereTriangle/ClothRectCollision.cs | 0 .../SphereTriangle/ClothRectCollision.cs.meta | 0 .../Runtime}/SphereTriangle/ColliderGroup.cs | 0 .../Runtime}/SphereTriangle/ColliderGroup.cs.meta | 0 .../Runtime}/SphereTriangle/FrameRate.cs | 0 .../Runtime}/SphereTriangle/FrameRate.cs.meta | 0 .../Runtime}/SphereTriangle/LineDistanceGizmo.cs | 0 .../SphereTriangle/LineDistanceGizmo.cs.meta | 0 .../Runtime}/SphereTriangle/LineSegment.cs | 0 .../Runtime}/SphereTriangle/LineSegment.cs.meta | 0 .../Runtime}/SphereTriangle/PositionList.cs | 0 .../Runtime}/SphereTriangle/PositionList.cs.meta | 0 .../Runtime}/SphereTriangle/ProfileSample.cs | 0 .../Runtime}/SphereTriangle/ProfileSample.cs.meta | 0 .../Runtime}/SphereTriangle/README.md | 0 .../Runtime}/SphereTriangle/README.md.meta | 0 .../SphereTriangle/SphereCapsuleCollider.cs | 0 .../SphereTriangle/SphereCapsuleCollider.cs.meta | 0 .../Runtime}/SphereTriangle/TransformSort.cs | 0 .../Runtime}/SphereTriangle/TransformSort.cs.meta | 0 .../Runtime}/SphereTriangle/Triangle.cs | 0 .../Runtime}/SphereTriangle/Triangle.cs.meta | 0 .../TriangleCapsuleCollisionSolver.cs | 0 .../TriangleCapsuleCollisionSolver.cs.meta | 0 .../SphereTriangle/TriangleCapsuleGizmo.cs | 0 .../SphereTriangle/TriangleCapsuleGizmo.cs.meta | 0 .../SphereTriangle/SphereTriangle.asmdef | 14 -------------- .../SphereTriangle/SphereTriangle.asmdef.meta | 7 ------- 33 files changed, 1 insertion(+), 24 deletions(-) rename Assets/VRM10_Samples/ClothSample/{ => RotateParticle/Runtime}/SphereTriangle.meta (100%) rename Assets/VRM10_Samples/ClothSample/{ => RotateParticle/Runtime}/SphereTriangle/CapsuleInfo.cs (100%) rename Assets/VRM10_Samples/ClothSample/{ => RotateParticle/Runtime}/SphereTriangle/CapsuleInfo.cs.meta (100%) rename Assets/VRM10_Samples/ClothSample/{ => RotateParticle/Runtime}/SphereTriangle/ClothRectCollision.cs (100%) rename Assets/VRM10_Samples/ClothSample/{ => RotateParticle/Runtime}/SphereTriangle/ClothRectCollision.cs.meta (100%) rename Assets/VRM10_Samples/ClothSample/{ => RotateParticle/Runtime}/SphereTriangle/ColliderGroup.cs (100%) rename Assets/VRM10_Samples/ClothSample/{ => RotateParticle/Runtime}/SphereTriangle/ColliderGroup.cs.meta (100%) rename Assets/VRM10_Samples/ClothSample/{ => RotateParticle/Runtime}/SphereTriangle/FrameRate.cs (100%) rename Assets/VRM10_Samples/ClothSample/{ => RotateParticle/Runtime}/SphereTriangle/FrameRate.cs.meta (100%) rename Assets/VRM10_Samples/ClothSample/{ => RotateParticle/Runtime}/SphereTriangle/LineDistanceGizmo.cs (100%) rename Assets/VRM10_Samples/ClothSample/{ => RotateParticle/Runtime}/SphereTriangle/LineDistanceGizmo.cs.meta (100%) rename Assets/VRM10_Samples/ClothSample/{ => RotateParticle/Runtime}/SphereTriangle/LineSegment.cs (100%) rename Assets/VRM10_Samples/ClothSample/{ => RotateParticle/Runtime}/SphereTriangle/LineSegment.cs.meta (100%) rename Assets/VRM10_Samples/ClothSample/{ => RotateParticle/Runtime}/SphereTriangle/PositionList.cs (100%) rename Assets/VRM10_Samples/ClothSample/{ => RotateParticle/Runtime}/SphereTriangle/PositionList.cs.meta (100%) rename Assets/VRM10_Samples/ClothSample/{ => RotateParticle/Runtime}/SphereTriangle/ProfileSample.cs (100%) rename Assets/VRM10_Samples/ClothSample/{ => RotateParticle/Runtime}/SphereTriangle/ProfileSample.cs.meta (100%) rename Assets/VRM10_Samples/ClothSample/{ => RotateParticle/Runtime}/SphereTriangle/README.md (100%) rename Assets/VRM10_Samples/ClothSample/{ => RotateParticle/Runtime}/SphereTriangle/README.md.meta (100%) rename Assets/VRM10_Samples/ClothSample/{ => RotateParticle/Runtime}/SphereTriangle/SphereCapsuleCollider.cs (100%) rename Assets/VRM10_Samples/ClothSample/{ => RotateParticle/Runtime}/SphereTriangle/SphereCapsuleCollider.cs.meta (100%) rename Assets/VRM10_Samples/ClothSample/{ => RotateParticle/Runtime}/SphereTriangle/TransformSort.cs (100%) rename Assets/VRM10_Samples/ClothSample/{ => RotateParticle/Runtime}/SphereTriangle/TransformSort.cs.meta (100%) rename Assets/VRM10_Samples/ClothSample/{ => RotateParticle/Runtime}/SphereTriangle/Triangle.cs (100%) rename Assets/VRM10_Samples/ClothSample/{ => RotateParticle/Runtime}/SphereTriangle/Triangle.cs.meta (100%) rename Assets/VRM10_Samples/ClothSample/{ => RotateParticle/Runtime}/SphereTriangle/TriangleCapsuleCollisionSolver.cs (100%) rename Assets/VRM10_Samples/ClothSample/{ => RotateParticle/Runtime}/SphereTriangle/TriangleCapsuleCollisionSolver.cs.meta (100%) rename Assets/VRM10_Samples/ClothSample/{ => RotateParticle/Runtime}/SphereTriangle/TriangleCapsuleGizmo.cs (100%) rename Assets/VRM10_Samples/ClothSample/{ => RotateParticle/Runtime}/SphereTriangle/TriangleCapsuleGizmo.cs.meta (100%) delete mode 100644 Assets/VRM10_Samples/ClothSample/SphereTriangle/SphereTriangle.asmdef delete mode 100644 Assets/VRM10_Samples/ClothSample/SphereTriangle/SphereTriangle.asmdef.meta diff --git a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewer.asmdef b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewer.asmdef index 7d155e41b..75b04563e 100644 --- a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewer.asmdef +++ b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewer.asmdef @@ -6,8 +6,7 @@ "GUID:8d76e605759c3f64a957d63ef96ada7c", "GUID:1cd941934d098654fa21a13f28346412", "GUID:e47c917724578cc43b5506c17a27e9a0", - "GUID:308b348fb80d89d42a9620951b0f60db", - "GUID:0138a2c7639266f45b948ea162125de5" + "GUID:308b348fb80d89d42a9620951b0f60db" ], "includePlatforms": [], "excludePlatforms": [], diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticle.asmdef b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticle.asmdef index 2e4dac009..9bfc3647a 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticle.asmdef +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticle.asmdef @@ -2,7 +2,6 @@ "name": "RotateParticle", "rootNamespace": "", "references": [ - "GUID:0138a2c7639266f45b948ea162125de5", "GUID:3e5d614bc16b50d41bd94c8d7444ca46", "GUID:e47c917724578cc43b5506c17a27e9a0", "GUID:8d76e605759c3f64a957d63ef96ada7c" diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle.meta similarity index 100% rename from Assets/VRM10_Samples/ClothSample/SphereTriangle.meta rename to Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle.meta diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/CapsuleInfo.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/CapsuleInfo.cs similarity index 100% rename from Assets/VRM10_Samples/ClothSample/SphereTriangle/CapsuleInfo.cs rename to Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/CapsuleInfo.cs diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/CapsuleInfo.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/CapsuleInfo.cs.meta similarity index 100% rename from Assets/VRM10_Samples/ClothSample/SphereTriangle/CapsuleInfo.cs.meta rename to Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/CapsuleInfo.cs.meta diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/ClothRectCollision.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/ClothRectCollision.cs similarity index 100% rename from Assets/VRM10_Samples/ClothSample/SphereTriangle/ClothRectCollision.cs rename to Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/ClothRectCollision.cs diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/ClothRectCollision.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/ClothRectCollision.cs.meta similarity index 100% rename from Assets/VRM10_Samples/ClothSample/SphereTriangle/ClothRectCollision.cs.meta rename to Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/ClothRectCollision.cs.meta diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/ColliderGroup.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/ColliderGroup.cs similarity index 100% rename from Assets/VRM10_Samples/ClothSample/SphereTriangle/ColliderGroup.cs rename to Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/ColliderGroup.cs diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/ColliderGroup.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/ColliderGroup.cs.meta similarity index 100% rename from Assets/VRM10_Samples/ClothSample/SphereTriangle/ColliderGroup.cs.meta rename to Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/ColliderGroup.cs.meta diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/FrameRate.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/FrameRate.cs similarity index 100% rename from Assets/VRM10_Samples/ClothSample/SphereTriangle/FrameRate.cs rename to Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/FrameRate.cs diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/FrameRate.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/FrameRate.cs.meta similarity index 100% rename from Assets/VRM10_Samples/ClothSample/SphereTriangle/FrameRate.cs.meta rename to Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/FrameRate.cs.meta diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/LineDistanceGizmo.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/LineDistanceGizmo.cs similarity index 100% rename from Assets/VRM10_Samples/ClothSample/SphereTriangle/LineDistanceGizmo.cs rename to Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/LineDistanceGizmo.cs diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/LineDistanceGizmo.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/LineDistanceGizmo.cs.meta similarity index 100% rename from Assets/VRM10_Samples/ClothSample/SphereTriangle/LineDistanceGizmo.cs.meta rename to Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/LineDistanceGizmo.cs.meta diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/LineSegment.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/LineSegment.cs similarity index 100% rename from Assets/VRM10_Samples/ClothSample/SphereTriangle/LineSegment.cs rename to Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/LineSegment.cs diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/LineSegment.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/LineSegment.cs.meta similarity index 100% rename from Assets/VRM10_Samples/ClothSample/SphereTriangle/LineSegment.cs.meta rename to Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/LineSegment.cs.meta diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/PositionList.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/PositionList.cs similarity index 100% rename from Assets/VRM10_Samples/ClothSample/SphereTriangle/PositionList.cs rename to Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/PositionList.cs diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/PositionList.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/PositionList.cs.meta similarity index 100% rename from Assets/VRM10_Samples/ClothSample/SphereTriangle/PositionList.cs.meta rename to Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/PositionList.cs.meta diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/ProfileSample.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/ProfileSample.cs similarity index 100% rename from Assets/VRM10_Samples/ClothSample/SphereTriangle/ProfileSample.cs rename to Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/ProfileSample.cs diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/ProfileSample.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/ProfileSample.cs.meta similarity index 100% rename from Assets/VRM10_Samples/ClothSample/SphereTriangle/ProfileSample.cs.meta rename to Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/ProfileSample.cs.meta diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/README.md b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/README.md similarity index 100% rename from Assets/VRM10_Samples/ClothSample/SphereTriangle/README.md rename to Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/README.md diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/README.md.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/README.md.meta similarity index 100% rename from Assets/VRM10_Samples/ClothSample/SphereTriangle/README.md.meta rename to Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/README.md.meta diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/SphereCapsuleCollider.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/SphereCapsuleCollider.cs similarity index 100% rename from Assets/VRM10_Samples/ClothSample/SphereTriangle/SphereCapsuleCollider.cs rename to Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/SphereCapsuleCollider.cs diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/SphereCapsuleCollider.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/SphereCapsuleCollider.cs.meta similarity index 100% rename from Assets/VRM10_Samples/ClothSample/SphereTriangle/SphereCapsuleCollider.cs.meta rename to Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/SphereCapsuleCollider.cs.meta diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/TransformSort.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/TransformSort.cs similarity index 100% rename from Assets/VRM10_Samples/ClothSample/SphereTriangle/TransformSort.cs rename to Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/TransformSort.cs diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/TransformSort.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/TransformSort.cs.meta similarity index 100% rename from Assets/VRM10_Samples/ClothSample/SphereTriangle/TransformSort.cs.meta rename to Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/TransformSort.cs.meta diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/Triangle.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/Triangle.cs similarity index 100% rename from Assets/VRM10_Samples/ClothSample/SphereTriangle/Triangle.cs rename to Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/Triangle.cs diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/Triangle.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/Triangle.cs.meta similarity index 100% rename from Assets/VRM10_Samples/ClothSample/SphereTriangle/Triangle.cs.meta rename to Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/Triangle.cs.meta diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/TriangleCapsuleCollisionSolver.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/TriangleCapsuleCollisionSolver.cs similarity index 100% rename from Assets/VRM10_Samples/ClothSample/SphereTriangle/TriangleCapsuleCollisionSolver.cs rename to Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/TriangleCapsuleCollisionSolver.cs diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/TriangleCapsuleCollisionSolver.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/TriangleCapsuleCollisionSolver.cs.meta similarity index 100% rename from Assets/VRM10_Samples/ClothSample/SphereTriangle/TriangleCapsuleCollisionSolver.cs.meta rename to Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/TriangleCapsuleCollisionSolver.cs.meta diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/TriangleCapsuleGizmo.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/TriangleCapsuleGizmo.cs similarity index 100% rename from Assets/VRM10_Samples/ClothSample/SphereTriangle/TriangleCapsuleGizmo.cs rename to Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/TriangleCapsuleGizmo.cs diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/TriangleCapsuleGizmo.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/TriangleCapsuleGizmo.cs.meta similarity index 100% rename from Assets/VRM10_Samples/ClothSample/SphereTriangle/TriangleCapsuleGizmo.cs.meta rename to Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/TriangleCapsuleGizmo.cs.meta diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/SphereTriangle.asmdef b/Assets/VRM10_Samples/ClothSample/SphereTriangle/SphereTriangle.asmdef deleted file mode 100644 index 835b18877..000000000 --- a/Assets/VRM10_Samples/ClothSample/SphereTriangle/SphereTriangle.asmdef +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "SphereTriangle", - "rootNamespace": "", - "references": [], - "includePlatforms": [], - "excludePlatforms": [], - "allowUnsafeCode": false, - "overrideReferences": false, - "precompiledReferences": [], - "autoReferenced": false, - "defineConstraints": [], - "versionDefines": [], - "noEngineReferences": false -} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/SphereTriangle/SphereTriangle.asmdef.meta b/Assets/VRM10_Samples/ClothSample/SphereTriangle/SphereTriangle.asmdef.meta deleted file mode 100644 index 6281600a3..000000000 --- a/Assets/VRM10_Samples/ClothSample/SphereTriangle/SphereTriangle.asmdef.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 0138a2c7639266f45b948ea162125de5 -AssemblyDefinitionImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: From f2ad450dd564764feb9822a54d6dbb6d029842fe Mon Sep 17 00:00:00 2001 From: ousttrue Date: Sat, 16 Nov 2024 01:10:27 +0900 Subject: [PATCH 027/113] HumanoidCollider, ClothGuess --- .../ClothSample/ClothViewer/ClothGuess.cs | 55 ++++++++++-------- .../ClothSample/ClothViewer/ClothViewerUI.cs | 56 ++++++++++++------- .../ClothViewer/HumanoidCollider.cs | 50 ++++++++++++++++- .../RotateParticle/Runtime/Components/Warp.cs | 24 +++++++- .../RotateParticleSpringboneRuntime.cs | 12 ++++ .../Runtime/RotateParticleSystem.cs | 48 ++-------------- 6 files changed, 151 insertions(+), 94 deletions(-) diff --git a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothGuess.cs b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothGuess.cs index 9afa7cfae..c1e18ddeb 100644 --- a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothGuess.cs +++ b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothGuess.cs @@ -17,82 +17,84 @@ namespace UniVRM10.Cloth.Viewer Strand, } - public static void Guess(RotateParticleSystem _system, Animator animator) + public static void Guess(Animator animator) { // skirt { if (TryAddGroup(animator, HumanBodyBones.Hips, new[] { "skirt", "スカート", "スカート" }, out var g)) { - _system._warps.AddRange(g); - // StrandConnectionType.ClothLoop + var c = g[0].gameObject.AddComponent(); + c.Warps = g; + c.LoopIsClosed = true; } } { if (TryAddGroupChildChild(animator, HumanBodyBones.Hips, new[] { "skirt", "スカート", "スカート" }, new string[] { }, out var g)) { - _system._warps.AddRange(g); - // StrandConnectionType.ClothLoop, + var c = g[0].gameObject.AddComponent(); + c.Warps = g; + c.LoopIsClosed = true; } } { if (TryAddGroup(animator, HumanBodyBones.Head, new[] { "髪", "hair" }, out var g)) { - _system._warps.AddRange(g); - // StrandConnectionType.Strand, } } { if (TryAddGroup(animator, HumanBodyBones.Hips, new[] { "裾" }, out var g)) { - _system._warps.AddRange(g); - // StrandConnectionType.Cloth, + var c = g[0].gameObject.AddComponent(); + c.Warps = g; } } { if (TryAddGroupChildChild(animator, HumanBodyBones.LeftUpperArm, new[] { "袖" }, new[] { "ひじ袖" }, out var g)) { - _system._warps.AddRange(g); - // StrandConnectionType.ClothLoop, + var c = g[0].gameObject.AddComponent(); + c.Warps = g; + c.LoopIsClosed = true; } } { if (TryAddGroupChildChild(animator, HumanBodyBones.LeftLowerArm, new[] { "袖" }, new string[] { }, out var g)) { - _system._warps.AddRange(g); - // StrandConnectionType.ClothLoop, + var c = g[0].gameObject.AddComponent(); + c.Warps = g; + c.LoopIsClosed = true; } } { if (TryAddGroupChildChild(animator, HumanBodyBones.RightUpperArm, new[] { "袖" }, new[] { "ひじ袖" }, out var g)) { - _system._warps.AddRange(g); - // , StrandConnectionType.ClothLoop + var c = g[0].gameObject.AddComponent(); + c.Warps = g; + c.LoopIsClosed = true; } } { if (TryAddGroupChildChild(animator, HumanBodyBones.RightLowerArm, new[] { "袖" }, new string[] { }, out var g)) { - _system._warps.AddRange(g); - // StrandConnectionType.ClothLoop, false, + var c = g[0].gameObject.AddComponent(); + c.Warps = g; } } { if (TryAddGroup(animator, HumanBodyBones.Chest, new[] { "マント" }, out var g)) { - _system._warps.AddRange(g); - // StrandConnectionType.Cloth, + var c = g[0].gameObject.AddComponent(); + c.Warps = g; } } - } /// @@ -139,6 +141,7 @@ namespace UniVRM10.Cloth.Viewer // Name = name, // CollisionMask = mask, warp.BaseSettings.HitRadius = 0.02f; + warp.AddParticleRecursive(); // Connection = type transforms.Add(warp); break; @@ -176,10 +179,14 @@ namespace UniVRM10.Cloth.Viewer if (child.name.ToLower().Contains(target.ToLower())) { var warp = child.gameObject.AddComponent(); - // CollisionMask = mask, - warp.BaseSettings.HitRadius = 0.02f; - // Connection = type - transforms.Add(warp); + if (warp != null) + { + // CollisionMask = mask, + warp.BaseSettings.HitRadius = 0.02f; + warp.AddParticleRecursive(); + // Connection = type + transforms.Add(warp); + } break; } } diff --git a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewerUI.cs b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewerUI.cs index 6eb19872c..63bb170a0 100644 --- a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewerUI.cs +++ b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewerUI.cs @@ -494,8 +494,8 @@ namespace UniVRM10.Cloth.Viewer { return; } - var system = m_loaded.Instance.GetComponent(); - system.ResetParticle(); + // var system = m_loaded.Instance.GetComponent(); + // system.ResetParticle(); } void OnResetStrandPoseClicked() @@ -514,27 +514,27 @@ namespace UniVRM10.Cloth.Viewer void ResetStrandPose(Action setPose, int iteration, float timeDelta, int finish) { - var system = m_loaded.Instance.GetComponent(); + // var system = m_loaded.Instance.GetComponent(); - // init - setPose(0); - system.ResetParticle(); + // // init + // setPose(0); + // system.ResetParticle(); - // lerp - var t = 0.0f; - var d = 1.0f / iteration; - for (int i = 0; i < iteration; ++i, t += d) - { - setPose(t); - system.Process(timeDelta); - } + // // lerp + // var t = 0.0f; + // var d = 1.0f / iteration; + // for (int i = 0; i < iteration; ++i, t += d) + // { + // setPose(t); + // system.Process(timeDelta); + // } - // finish - setPose(1.0f); - for (int i = 0; i < finish; ++i) - { - system.Process(timeDelta); - } + // // finish + // setPose(1.0f); + // for (int i = 0; i < finish; ++i) + // { + // system.Process(timeDelta); + // } } static IMaterialDescriptorGenerator GetVrmMaterialDescriptorGenerator(bool useUrp) @@ -549,6 +549,20 @@ namespace UniVRM10.Cloth.Viewer } } + void OnInit(RotateParticle.RotateParticleSystem system, Vrm10Instance vrm) + { + var animator = vrm.GetComponent(); + HumanoidCollider.AddColliders(system, animator); + try + { + ClothGuess.Guess(animator); + } + catch (Exception ex) + { + Debug.LogException(ex); + } + } + async void LoadModel(string path) { // cleanup @@ -567,7 +581,7 @@ namespace UniVRM10.Cloth.Viewer awaitCaller: m_useAsync.enabled ? (IAwaitCaller)new RuntimeOnlyAwaitCaller() : (IAwaitCaller)new ImmediateCaller(), materialGenerator: GetVrmMaterialDescriptorGenerator(true), vrmMetaInformationCallback: m_texts.UpdateMeta, - springboneRuntime: new RotateParticle.RotateParticleSpringboneRuntime()); + springboneRuntime: new RotateParticle.RotateParticleSpringboneRuntime(OnInit)); if (cancellationToken.IsCancellationRequested) { UnityObjectDestroyer.DestroyRuntimeOrEditor(vrm10Instance.gameObject); diff --git a/Assets/VRM10_Samples/ClothSample/ClothViewer/HumanoidCollider.cs b/Assets/VRM10_Samples/ClothSample/ClothViewer/HumanoidCollider.cs index a09e16c99..1994c261a 100644 --- a/Assets/VRM10_Samples/ClothSample/ClothViewer/HumanoidCollider.cs +++ b/Assets/VRM10_Samples/ClothSample/ClothViewer/HumanoidCollider.cs @@ -1,11 +1,12 @@ using System.Collections; using System.Collections.Generic; using RotateParticle; +using SphereTriangle; using UnityEngine; namespace UniVRM10.Cloth.Viewer { - public static class HumanCollider + public static class HumanoidCollider { static (string group, HumanBodyBones head, HumanBodyBones tail, float radius)[] Capsules = new[] { @@ -22,13 +23,56 @@ namespace UniVRM10.Cloth.Viewer ("Arm", HumanBodyBones.RightHand, HumanBodyBones.RightMiddleProximal, 0.02f), }; - public static void AddColliders(RotateParticleSystem _system, Animator animator) + public static void AddColliders(RotateParticleSystem system, Animator animator) { foreach (var (group, head, tail, radius) in Capsules) { - _system.AddColliderIfNotExists(group, + AddColliderIfNotExists(system._colliderGroups, group, animator.GetBoneTransform(head), animator.GetBoneTransform(tail), radius); } } + + static void AddColliderIfNotExists(List _colliderGroups, string groupName, Transform head, Transform tail, float radius) + { + ColliderGroup group = default; + foreach (var g in _colliderGroups) + { + if (g.Name == groupName) + { + group = g; + break; + } + } + if (group == null) + { + group = new ColliderGroup { Name = groupName }; + _colliderGroups.Add(group); + } + + foreach (var collider in group.Colliders) + { + if (collider.transform == head) + { + return; + } + } + + var c = GetOrAddComponent(head.gameObject); + c.Tail = tail; + c.Radius = radius; + // c.GizmoColor = GetGizmoColor(group); + group.Colliders.Add(c); + } + + static T GetOrAddComponent(GameObject o) where T : Component + { + var t = o.GetComponent(); + if (t != null) + { + return t; + } + return o.AddComponent(); + } + } } \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Warp.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Warp.cs index fc4d3f71d..d47f438d3 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Warp.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Warp.cs @@ -66,7 +66,7 @@ namespace RotateParticle.Components } [SerializeField] - public ParticleSettings BaseSettings; + public ParticleSettings BaseSettings = new(); /// /// null のときは world root ではなく model root で処理 @@ -82,7 +82,27 @@ namespace RotateParticle.Components void Reset() { - // Debug.Log("Warp.Reset"); + // Debug.Log("Warp.Reset"); + } + + public void AddParticleRecursive() + { + if (transform.childCount > 0) + { + AddParticleRecursive(transform.GetChild(0)); + } + } + + public void AddParticleRecursive(Transform t) + { + Particles.Add(new Particle + { + Transform = t, + }); + if (t.childCount > 0) + { + AddParticleRecursive(t.GetChild(0)); + } } void OnValidate() diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs index 5454c075f..63acfb025 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs @@ -1,3 +1,4 @@ +using System; using System.Threading.Tasks; using RotateParticle.Components; using UniGLTF; @@ -11,6 +12,12 @@ namespace RotateParticle public class RotateParticleSpringboneRuntime : IVrm10SpringBoneRuntime { RotateParticleSystem _system; + Action _onInit; + + public RotateParticleSpringboneRuntime(Action onInit = null) + { + _onInit = onInit; + } public void Dispose() { @@ -36,6 +43,11 @@ namespace RotateParticle _system.Env.DragForce = 0.6f; _system.Env.Stiffness = 0.07f; + if (_onInit != null) + { + _onInit(_system, instance); + } + foreach (var warp in instance.GetComponentsInChildren()) { _system._warps.Add(warp); diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs index 509f73c49..c53272aca 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs @@ -55,48 +55,6 @@ namespace RotateParticle return Color.gray; } - public void AddColliderIfNotExists(string groupName, Transform head, Transform tail, float radius) - { - ColliderGroup group = default; - foreach (var g in _colliderGroups) - { - if (g.Name == groupName) - { - group = g; - break; - } - } - if (group == null) - { - group = new ColliderGroup { Name = groupName }; - _colliderGroups.Add(group); - } - - foreach (var collider in group.Colliders) - { - if (collider.transform == head) - { - return; - } - } - - var c = GetOrAddComponent(head.gameObject); - c.Tail = tail; - c.Radius = radius; - c.GizmoColor = GetGizmoColor(group); - group.Colliders.Add(c); - } - - static T GetOrAddComponent(GameObject o) where T : Component - { - var t = o.GetComponent(); - if (t != null) - { - return t; - } - return o.AddComponent(); - } - HashSet _clothUsedParticles = new(); public void InitializeCloth( @@ -265,7 +223,8 @@ namespace RotateParticle { using var prof = new ProfileSample("Collision: Cloth"); // 頂点 abcd は同じ CollisionMask - if (_list._particles[rect._a].Init.CollisionMask.HasFlag((CollisionGroupMask)(i + 1))) + // TODO: + // if (_list._particles[rect._a].Init.CollisionMask.HasFlag((CollisionGroupMask)(i + 1))) { // cloth rect.Collide(_newPos, g.Colliders); @@ -288,7 +247,8 @@ namespace RotateParticle } // 紐の当たり判定 - if (particle.Init.CollisionMask.HasFlag((CollisionGroupMask)(i + 1))) + // TODO: + // if (particle.Init.CollisionMask.HasFlag((CollisionGroupMask)(i + 1))) { var p = _newPos.Get(j); foreach (var c in g.Colliders) From a249fc7f375fe18dc4b2b54d32cdaf2156d941f2 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Sat, 16 Nov 2024 02:44:56 +0900 Subject: [PATCH 028/113] SphereCapsuleCollider._vrm --- .../ClothSample/ClothViewer/ClothViewerUI.cs | 2 +- .../ClothViewer/HumanoidCollider.cs | 22 +++--- .../Runtime/SphereTriangle/CapsuleInfo.cs | 32 ++++----- .../SphereTriangle/ClothRectCollision.cs | 24 +++---- .../SphereTriangle/LineDistanceGizmo.cs | 14 ++-- .../SphereTriangle/SphereCapsuleCollider.cs | 69 +++++++++---------- .../SphereTriangle/TriangleCapsuleGizmo.cs | 4 +- 7 files changed, 85 insertions(+), 82 deletions(-) diff --git a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewerUI.cs b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewerUI.cs index 63bb170a0..98aee7693 100644 --- a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewerUI.cs +++ b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewerUI.cs @@ -552,7 +552,7 @@ namespace UniVRM10.Cloth.Viewer void OnInit(RotateParticle.RotateParticleSystem system, Vrm10Instance vrm) { var animator = vrm.GetComponent(); - HumanoidCollider.AddColliders(system, animator); + HumanoidCollider.AddColliders(system._colliderGroups, animator); try { ClothGuess.Guess(animator); diff --git a/Assets/VRM10_Samples/ClothSample/ClothViewer/HumanoidCollider.cs b/Assets/VRM10_Samples/ClothSample/ClothViewer/HumanoidCollider.cs index 1994c261a..4cc67093d 100644 --- a/Assets/VRM10_Samples/ClothSample/ClothViewer/HumanoidCollider.cs +++ b/Assets/VRM10_Samples/ClothSample/ClothViewer/HumanoidCollider.cs @@ -23,16 +23,19 @@ namespace UniVRM10.Cloth.Viewer ("Arm", HumanBodyBones.RightHand, HumanBodyBones.RightMiddleProximal, 0.02f), }; - public static void AddColliders(RotateParticleSystem system, Animator animator) + public static void AddColliders(List _colliderGroups, Animator animator) { foreach (var (group, head, tail, radius) in Capsules) { - AddColliderIfNotExists(system._colliderGroups, group, - animator.GetBoneTransform(head), animator.GetBoneTransform(tail), radius); + AddColliderIfNotExists(_colliderGroups, group, + animator.GetBoneTransform(head), + animator.GetBoneTransform(tail), + radius); } } - static void AddColliderIfNotExists(List _colliderGroups, string groupName, Transform head, Transform tail, float radius) + static void AddColliderIfNotExists(List _colliderGroups, string groupName, + Transform head, Transform tail, float radius) { ColliderGroup group = default; foreach (var g in _colliderGroups) @@ -51,15 +54,18 @@ namespace UniVRM10.Cloth.Viewer foreach (var collider in group.Colliders) { - if (collider.transform == head) + if (collider._vrm.transform == head) { return; } } - var c = GetOrAddComponent(head.gameObject); - c.Tail = tail; - c.Radius = radius; + var vrmCollider = head.gameObject.AddComponent(); + vrmCollider.Radius = radius; + vrmCollider.ColliderType = VRM10SpringBoneColliderTypes.Capsule; + vrmCollider.Tail = head.worldToLocalMatrix.MultiplyPoint(tail.position); + + var c = new SphereCapsuleCollider(vrmCollider); // c.GizmoColor = GetGizmoColor(group); group.Colliders.Add(c); } diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/CapsuleInfo.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/CapsuleInfo.cs index 4b151ebf9..cde732b02 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/CapsuleInfo.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/CapsuleInfo.cs @@ -32,31 +32,31 @@ namespace SphereTriangle { Collider = collider; Triangle = t; - var headDistance = t.Plane.GetDistanceToPoint(collider.transform.position); - var tailDistance = t.Plane.GetDistanceToPoint(collider.Tail.position); + var headDistance = t.Plane.GetDistanceToPoint(collider.HeadWorldPosition); + var tailDistance = t.Plane.GetDistanceToPoint(collider.TailWorldPosition); if (headDistance <= tailDistance) { Reverse = false; MinDistance = headDistance; MaxDistance = tailDistance; - MinOnPlane = t.Plane.ClosestPointOnPlane(collider.transform.position); - MaxOnPlane = t.Plane.ClosestPointOnPlane(collider.Tail.position); - MinClamp = collider.transform.position; - MaxClamp = collider.Tail.position; - MinPos = collider.transform.position; - MaxPos = collider.Tail.position; + MinOnPlane = t.Plane.ClosestPointOnPlane(collider.HeadWorldPosition); + MaxOnPlane = t.Plane.ClosestPointOnPlane(collider.TailWorldPosition); + MinClamp = collider.HeadWorldPosition; + MaxClamp = collider.TailWorldPosition; + MinPos = collider.HeadWorldPosition; + MaxPos = collider.TailWorldPosition; } else { Reverse = true; MaxDistance = headDistance; MinDistance = tailDistance; - MaxOnPlane = t.Plane.ClosestPointOnPlane(collider.transform.position); - MinOnPlane = t.Plane.ClosestPointOnPlane(collider.Tail.position); - MaxClamp = collider.transform.position; - MinClamp = collider.Tail.position; - MaxPos = collider.transform.position; - MinPos = collider.Tail.position; + MaxOnPlane = t.Plane.ClosestPointOnPlane(collider.HeadWorldPosition); + MinOnPlane = t.Plane.ClosestPointOnPlane(collider.TailWorldPosition); + MaxClamp = collider.HeadWorldPosition; + MinClamp = collider.TailWorldPosition; + MaxPos = collider.HeadWorldPosition; + MinPos = collider.TailWorldPosition; } // Intersect @@ -100,11 +100,11 @@ namespace SphereTriangle public void DrawGizmo() { Gizmos.color = Color.blue; - Gizmos.DrawLine(Reverse ? Collider.Tail.position : Collider.transform.position, MinOnPlane); + Gizmos.DrawLine(Reverse ? Collider.TailWorldPosition : Collider.HeadWorldPosition, MinOnPlane); Gizmos.DrawWireSphere(MinOnPlane, 0.01f); Gizmos.color = Color.blue; - Gizmos.DrawLine(Reverse ? Collider.transform.position : Collider.Tail.position, MaxOnPlane); + Gizmos.DrawLine(Reverse ? Collider.HeadWorldPosition : Collider.TailWorldPosition, MaxOnPlane); Gizmos.DrawWireSphere(MaxOnPlane, 0.01f); Gizmos.color = Color.magenta; diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/ClothRectCollision.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/ClothRectCollision.cs index b61537bdb..d1a63d4a5 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/ClothRectCollision.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/ClothRectCollision.cs @@ -60,8 +60,8 @@ namespace SphereTriangle { foreach (var collider in g.Colliders) { - var p = t.Plane.ClosestPointOnPlane(collider.transform.position); - var dot = Vector3.Dot(t.Plane.normal, collider.transform.position - p); + var p = t.Plane.ClosestPointOnPlane(collider.HeadWorldPosition); + var dot = Vector3.Dot(t.Plane.normal, collider.HeadWorldPosition - p); _initialColliderNormalSide[collider] = dot; } } @@ -126,8 +126,8 @@ namespace SphereTriangle continue; } - var p = _triangle0.Plane.ClosestPointOnPlane(collider.transform.position); - var dot = Vector3.Dot(_triangle0.Plane.normal, collider.transform.position - p); + var p = _triangle0.Plane.ClosestPointOnPlane(collider.HeadWorldPosition); + var dot = Vector3.Dot(_triangle0.Plane.normal, collider.HeadWorldPosition - p); if (_initialColliderNormalSide[collider] * dot < 0) { // 片側 @@ -162,19 +162,13 @@ namespace SphereTriangle /// static bool TryCollide(TriangleCapsuleCollisionSolver solver, SphereCapsuleCollider collider, in Triangle t, out LineSegment l) { - if (collider.Tail == null) - { - using var profile = new ProfileSample("Sphere"); - // sphere - return TryCollideSphere(t, collider.transform.position, collider.Radius, out l); - } - else + if (collider.IsCapsule) { // capsule TriangleCapsuleCollisionSolver.Result result = default; using (new ProfileSample("Capsule: Collide")) { - result = solver.Collide(t, collider, new(collider.transform.position, collider.Tail.position), collider.Radius); + result = solver.Collide(t, collider, new(collider.HeadWorldPosition, collider.TailWorldPosition), collider.Radius); } using (new ProfileSample("Capsule: TryGetClosest")) { @@ -182,6 +176,12 @@ namespace SphereTriangle return type.HasValue; } } + else + { + // sphere + using var profile = new ProfileSample("Sphere"); + return TryCollideSphere(t, collider.HeadWorldPosition, collider.Radius, out l); + } } /// diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/LineDistanceGizmo.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/LineDistanceGizmo.cs index f555b5bba..6b7bdd469 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/LineDistanceGizmo.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/LineDistanceGizmo.cs @@ -17,10 +17,10 @@ namespace SphereTriangle public void OnDrawGizmos() { - if (LineA?.Tail != null && LineB?.Tail != null) + if (LineA.IsCapsule && LineB.IsCapsule) { - var a = new LineSegment(LineA.transform.position, LineA.Tail.position); - var b = new LineSegment(LineB.transform.position, LineB.Tail.position); + var a = new LineSegment(LineA.HeadWorldPosition, LineA.TailWorldPosition); + var b = new LineSegment(LineB.HeadWorldPosition, LineB.TailWorldPosition); var (s, t) = LineSegment.CalcClosest(a, b); var a_s = a.GetPoint(s); var b_t = b.GetPoint(t); @@ -30,11 +30,11 @@ namespace SphereTriangle Gizmos.color = Color.gray; if (s < 0) { - Gizmos.DrawLine(LineA.transform.position, a_s); + Gizmos.DrawLine(LineA.HeadWorldPosition, a_s); } else if (s > 1) { - Gizmos.DrawLine(LineA.Tail.position, a_s); + Gizmos.DrawLine(LineA.TailWorldPosition, a_s); } else { @@ -42,11 +42,11 @@ namespace SphereTriangle } if (t < 0) { - Gizmos.DrawLine(LineB.transform.position, b_t); + Gizmos.DrawLine(LineB.HeadWorldPosition, b_t); } else if (t > 1) { - Gizmos.DrawLine(LineB.transform.position, b_t); + Gizmos.DrawLine(LineB.HeadWorldPosition, b_t); } else { diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/SphereCapsuleCollider.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/SphereCapsuleCollider.cs index 2908963f8..4eaf61794 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/SphereCapsuleCollider.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/SphereCapsuleCollider.cs @@ -1,44 +1,41 @@ using UnityEngine; +using UniVRM10; namespace SphereTriangle { - [DisallowMultipleComponent] - public class SphereCapsuleCollider : MonoBehaviour + public class SphereCapsuleCollider { - [SerializeField, Range(0.01f, 1f)] - public float Radius = 0.05f; - - public Transform Tail; - - public Ray? HeadTailRay => Tail == null ? null : new Ray { origin = transform.position, direction = (Tail.position - transform.position) }; - - public float CapsuleLength => Tail == null ? 0 : Vector3.Distance(Tail.position, transform.position); - - + public readonly VRM10SpringBoneCollider _vrm; public Color GizmoColor = Color.yellow; public bool SolidGizmo = false; - public Bounds GetBounds() - { - if (Tail == null) - { - return new Bounds(transform.position, new Vector3(Radius, Radius, Radius)); - } + public float Radius => _vrm.Radius; + public bool IsCapsule => _vrm.ColliderType == VRM10SpringBoneColliderTypes.Capsule; + public Vector3 HeadWorldPosition => _vrm.transform.TransformPoint(_vrm.Offset); + public Vector3 TailWorldPosition => _vrm.transform.TransformPoint(_vrm.TailOrNormal); + public Ray? HeadTailRay => IsCapsule ? new Ray { origin = HeadWorldPosition, direction = TailWorldPosition - HeadWorldPosition } : null; + public float CapsuleLength => !IsCapsule ? 0 : Vector3.Distance(TailWorldPosition, HeadWorldPosition); - var h = transform.position; - var t = Tail.position; - var d = h - t; - var aabb = new Bounds((h + t) * 0.5f, new Vector3(Mathf.Abs(d.x), Mathf.Abs(d.y), Mathf.Abs(d.z))); - aabb.Expand(Radius * 2); - return aabb; + public SphereCapsuleCollider(VRM10SpringBoneCollider vrmCollider) + { + _vrm = vrmCollider; } - public void Reset() + public Bounds GetBounds() { - if (transform.childCount > 0) + if (IsCapsule) { - Tail = transform.GetChild(0); + var h = HeadWorldPosition; + var t = TailWorldPosition; + var d = h - t; + var aabb = new Bounds((h + t) * 0.5f, new Vector3(Mathf.Abs(d.x), Mathf.Abs(d.y), Mathf.Abs(d.z))); + aabb.Expand(_vrm.Radius * 2); + return aabb; + } + else + { + return new Bounds(HeadWorldPosition, new Vector3(_vrm.Radius, _vrm.Radius, _vrm.Radius)); } } @@ -117,13 +114,13 @@ namespace SphereTriangle /// public bool TryCollide(in Vector3 p, float radius, out LineSegment resolved) { - if (Tail != null) + if (IsCapsule) { - return TryCollideCapsuleAndSphere(transform.position, Tail.position, this.Radius, p, radius, out resolved); + return TryCollideCapsuleAndSphere(HeadWorldPosition, TailWorldPosition, this.Radius, p, radius, out resolved); } else { - return TryCollideSphereAndSphere(transform.position, this.Radius, p, radius, out resolved); + return TryCollideSphereAndSphere(HeadWorldPosition, this.Radius, p, radius, out resolved); } } @@ -148,21 +145,21 @@ namespace SphereTriangle if (SolidGizmo) { Gizmos.color = Color.white; - Gizmos.DrawSphere(transform.position, Radius); + Gizmos.DrawSphere(HeadWorldPosition, Radius); } Gizmos.color = GizmoColor; - if (transform.parent) + if (_vrm.transform.parent != null) { - Gizmos.DrawLine(transform.parent.position, transform.position); + Gizmos.DrawLine(HeadWorldPosition, HeadWorldPosition); } - if (Tail != null) + if (IsCapsule) { - DrawCapsuleGizmo(transform.position, Tail.position, Radius); + DrawCapsuleGizmo(HeadWorldPosition, TailWorldPosition, Radius); } else { - Gizmos.DrawWireSphere(transform.position, Radius); + Gizmos.DrawWireSphere(HeadWorldPosition, Radius); } #if AABB_DEBUG diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/TriangleCapsuleGizmo.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/TriangleCapsuleGizmo.cs index f73cd67d4..40f20711c 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/TriangleCapsuleGizmo.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/TriangleCapsuleGizmo.cs @@ -35,8 +35,8 @@ namespace SphereTriangle if (C == null) return; var t = new Triangle(transform.position, B.position, C.position); - if (Capsule?.Tail == null) return; - var capsule = new LineSegment(Capsule.transform.position, Capsule.Tail.position); + if (!Capsule.IsCapsule) return; + var capsule = new LineSegment(Capsule.HeadWorldPosition, Capsule.TailWorldPosition); _solver.BeginFrame(); var result = _solver.Collide(t, Capsule, capsule, Capsule.Radius); From 07327797216aa83d2303534e648ec784df253db5 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Sat, 16 Nov 2024 04:03:47 +0900 Subject: [PATCH 029/113] SphereCapsuleCollider to VRM10SpringBoneCollider --- .../SpringBone/VRM10SpringBoneCollider.cs | 24 +++ .../ClothSample/ClothViewer/ClothViewerUI.cs | 6 +- .../ClothViewer/HumanoidCollider.cs | 58 ++---- .../RotateParticleRuntimeProvider.cs | 13 +- .../RotateParticleSpringboneRuntime.cs | 8 + .../Runtime/RotateParticleSystem.cs | 120 +++++++++++- .../Runtime/SphereTriangle/CapsuleInfo.cs | 5 +- .../SphereTriangle/ClothRectCollision.cs | 21 +-- .../Runtime/SphereTriangle/ColliderGroup.cs | 3 +- .../SphereTriangle/LineDistanceGizmo.cs | 9 +- .../SphereTriangle/SphereCapsuleCollider.cs | 173 ------------------ .../SphereCapsuleCollider.cs.meta | 11 -- .../Runtime/SphereTriangle/Triangle.cs | 45 +++++ .../TriangleCapsuleCollisionSolver.cs | 5 +- .../SphereTriangle/TriangleCapsuleGizmo.cs | 5 +- 15 files changed, 256 insertions(+), 250 deletions(-) delete mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/SphereCapsuleCollider.cs delete mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/SphereCapsuleCollider.cs.meta diff --git a/Assets/VRM10/Runtime/Components/SpringBone/VRM10SpringBoneCollider.cs b/Assets/VRM10/Runtime/Components/SpringBone/VRM10SpringBoneCollider.cs index 482707acc..a63d513fd 100644 --- a/Assets/VRM10/Runtime/Components/SpringBone/VRM10SpringBoneCollider.cs +++ b/Assets/VRM10/Runtime/Components/SpringBone/VRM10SpringBoneCollider.cs @@ -28,12 +28,36 @@ namespace UniVRM10 public Vector3 Normal = Vector3.up; + public Vector3 HeadWorldPosition => transform.TransformPoint(Offset); + public Vector3 TailWorldPosition => transform.TransformPoint(TailOrNormal); public Vector3 TailOrNormal => ColliderType == VRM10SpringBoneColliderTypes.Plane ? Normal : Tail; public static int SelectedGuid; public bool IsSelected => GetInstanceID() == SelectedGuid; + public Bounds GetBounds() + { + switch (ColliderType) + { + case VRM10SpringBoneColliderTypes.Capsule: + { + var h = HeadWorldPosition; + var t = TailWorldPosition; + var d = h - t; + var aabb = new Bounds((h + t) * 0.5f, new Vector3(Mathf.Abs(d.x), Mathf.Abs(d.y), Mathf.Abs(d.z))); + aabb.Expand(Radius * 2); + return aabb; + } + + case VRM10SpringBoneColliderTypes.Sphere: + return new Bounds(HeadWorldPosition, new Vector3(Radius, Radius, Radius)); + + default: + throw new NotImplementedException(); + } + } + void OnDrawGizmosSelected() { DrawGizmos(); diff --git a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewerUI.cs b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewerUI.cs index 98aee7693..15c8b982b 100644 --- a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewerUI.cs +++ b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewerUI.cs @@ -552,7 +552,11 @@ namespace UniVRM10.Cloth.Viewer void OnInit(RotateParticle.RotateParticleSystem system, Vrm10Instance vrm) { var animator = vrm.GetComponent(); - HumanoidCollider.AddColliders(system._colliderGroups, animator); + if (vrm.SpringBone.ColliderGroups.Count == 0) + { + HumanoidCollider.AddColliders(animator); + } + try { ClothGuess.Guess(animator); diff --git a/Assets/VRM10_Samples/ClothSample/ClothViewer/HumanoidCollider.cs b/Assets/VRM10_Samples/ClothSample/ClothViewer/HumanoidCollider.cs index 4cc67093d..f10d943d0 100644 --- a/Assets/VRM10_Samples/ClothSample/ClothViewer/HumanoidCollider.cs +++ b/Assets/VRM10_Samples/ClothSample/ClothViewer/HumanoidCollider.cs @@ -23,51 +23,31 @@ namespace UniVRM10.Cloth.Viewer ("Arm", HumanBodyBones.RightHand, HumanBodyBones.RightMiddleProximal, 0.02f), }; - public static void AddColliders(List _colliderGroups, Animator animator) + public static void AddColliders(Animator animator) { - foreach (var (group, head, tail, radius) in Capsules) - { - AddColliderIfNotExists(_colliderGroups, group, - animator.GetBoneTransform(head), - animator.GetBoneTransform(tail), - radius); - } - } + Dictionary map = new(); - static void AddColliderIfNotExists(List _colliderGroups, string groupName, - Transform head, Transform tail, float radius) - { - ColliderGroup group = default; - foreach (var g in _colliderGroups) + foreach (var (group, _head, _tail, radius) in Capsules) { - if (g.Name == groupName) + if (!map.ContainsKey(group)) { - group = g; - break; + var g = animator.gameObject.AddComponent(); + map.Add(group, g); + } + + + var head = animator.GetBoneTransform(_head); + var vrmCollider = head.gameObject.AddComponent(); + if (vrmCollider != null) + { + vrmCollider.Radius = radius; + vrmCollider.ColliderType = VRM10SpringBoneColliderTypes.Capsule; + var tail = animator.GetBoneTransform(_tail); + vrmCollider.Tail = head.worldToLocalMatrix.MultiplyPoint(tail.position); + + map[group].Colliders.Add(vrmCollider); } } - if (group == null) - { - group = new ColliderGroup { Name = groupName }; - _colliderGroups.Add(group); - } - - foreach (var collider in group.Colliders) - { - if (collider._vrm.transform == head) - { - return; - } - } - - var vrmCollider = head.gameObject.AddComponent(); - vrmCollider.Radius = radius; - vrmCollider.ColliderType = VRM10SpringBoneColliderTypes.Capsule; - vrmCollider.Tail = head.worldToLocalMatrix.MultiplyPoint(tail.position); - - var c = new SphereCapsuleCollider(vrmCollider); - // c.GizmoColor = GetGizmoColor(group); - group.Colliders.Add(c); } static T GetOrAddComponent(GameObject o) where T : Component diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RotateParticleRuntimeProvider.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RotateParticleRuntimeProvider.cs index 56f1b3ed3..5ee13cbde 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RotateParticleRuntimeProvider.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RotateParticleRuntimeProvider.cs @@ -15,9 +15,11 @@ namespace RotateParticle.Components [SerializeField] public List Cloths = new(); + IVrm10SpringBoneRuntime m_runtime; public IVrm10SpringBoneRuntime CreateSpringBoneRuntime() { - return new RotateParticleSpringboneRuntime(); + m_runtime = new RotateParticleSpringboneRuntime(); + return m_runtime; } public void Reset() @@ -25,5 +27,14 @@ namespace RotateParticle.Components Warps = GetComponentsInChildren().ToList(); Cloths = GetComponentsInChildren().ToList(); } + + void OnDrawGizmos() + { + if (m_runtime == null) + { + return; + } + m_runtime.DrawGizmos(); + } } } \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs index 63acfb025..4561decad 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs @@ -58,6 +58,14 @@ namespace RotateParticle _system._cloths.Add(cloth); } + foreach (var g in instance.SpringBone.ColliderGroups) + { + foreach (var vrmCollider in g.Colliders) + { + _system.AddColliderIfNotExists(g.name, vrmCollider); + } + } + await awaitCaller.NextFrame(); _system.Initialize(); } diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs index c53272aca..9a23efd70 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs @@ -4,6 +4,7 @@ using System.Linq; using RotateParticle.Components; using SphereTriangle; using UnityEngine; +using UniVRM10; namespace RotateParticle @@ -254,7 +255,7 @@ namespace RotateParticle foreach (var c in g.Colliders) { // strand - if (c != null && c.TryCollide(p, particle.Init.Radius, out var resolved)) + if (c != null && TryCollide(c, p, particle.Init.Radius, out var resolved)) { _newPos.CollisionMove(particle.Init.Index, resolved, c.Radius); } @@ -286,6 +287,123 @@ namespace RotateParticle } } + public ColliderGroup GetOrAddColliderGroup(string groupName) + { + foreach (var g in _colliderGroups) + { + if (g.Name == groupName) + { + return g; + } + } + + var group = new ColliderGroup { Name = groupName }; + _colliderGroups.Add(group); + return group; + } + + public void AddColliderIfNotExists(string groupName, + VRM10SpringBoneCollider c) + { + var group = GetOrAddColliderGroup(groupName); + + foreach (var collider in group.Colliders) + { + if (collider == c) + { + return; + } + } + + // c.GizmoColor = GetGizmoColor(group); + group.Colliders.Add(c); + } + + /// + /// collide sphere a and sphere b. + /// move sphere b to resolved if collide. + /// + /// + /// + /// + /// + /// + /// + static bool TryCollideSphereAndSphere( + in Vector3 from, float ra, + in Vector3 to, float rb, + out LineSegment resolved + ) + { + var d = Vector3.Distance(from, to); + if (d > (ra + rb)) + { + resolved = default; + return false; + } + Vector3 normal = (to - from).normalized; + resolved = new(from, from + normal * (d - rb)); + return true; + } + + /// + /// collide capsule and sphere b. + /// move sphere b to resolved if collide. + /// + /// + /// + /// + /// + /// + static bool TryCollideCapsuleAndSphere( + in Vector3 capsuleHead, + in Vector3 capsuleTail, + float capsuleRadius, + in Vector3 b, + float rb, + out LineSegment resolved + ) + { + var P = (capsuleTail - capsuleHead).normalized; + var Q = b - capsuleHead; + var dot = Vector3.Dot(P, Q); + if (dot <= 0) + { + // head側半球の球判定 + return TryCollideSphereAndSphere(capsuleHead, capsuleRadius, b, rb, out resolved); + } + + var t = dot / P.magnitude; + if (t >= 1.0f) + { + // tail側半球の球判定 + return TryCollideSphereAndSphere(capsuleTail, capsuleRadius, b, rb, out resolved); + } + + // head-tail上の m_transform.position との最近点 + var p = capsuleHead + P * t; + return TryCollideSphereAndSphere(p, capsuleRadius, b, rb, out resolved); + } + + /// + /// collision for strand + /// + /// + /// + /// + /// + public bool TryCollide(UniVRM10.VRM10SpringBoneCollider c, in Vector3 p, float radius, out LineSegment resolved) + { + if (c.ColliderType == UniVRM10.VRM10SpringBoneColliderTypes.Capsule) + { + return TryCollideCapsuleAndSphere(c.HeadWorldPosition, c.TailWorldPosition, c.Radius, p, radius, out resolved); + } + else + { + return TryCollideSphereAndSphere(c.HeadWorldPosition, c.Radius, p, radius, out resolved); + } + } + public void DrawGizmos() { _list.DrawGizmos(); diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/CapsuleInfo.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/CapsuleInfo.cs index cde732b02..9da7d551e 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/CapsuleInfo.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/CapsuleInfo.cs @@ -1,10 +1,11 @@ using UnityEngine; +using UniVRM10; namespace SphereTriangle { struct CapsuleInfo { - public SphereCapsuleCollider Collider; + public VRM10SpringBoneCollider Collider; public Triangle Triangle; public Vector3 MinOnPlane; @@ -28,7 +29,7 @@ namespace SphereTriangle public bool Intersected; - public CapsuleInfo(in Triangle t, SphereCapsuleCollider collider) + public CapsuleInfo(in Triangle t, VRM10SpringBoneCollider collider) { Collider = collider; Triangle = t; diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/ClothRectCollision.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/ClothRectCollision.cs index d1a63d4a5..fa26fdeca 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/ClothRectCollision.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/ClothRectCollision.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using UnityEngine; +using UniVRM10; namespace SphereTriangle { @@ -23,7 +24,7 @@ namespace SphereTriangle TriangleCapsuleCollisionSolver _s1 = new(); // 各コライダーが初期姿勢で三角形ABCの法線の正か負のどちらにあるのかを記録する - Dictionary _initialColliderNormalSide = new(); + Dictionary _initialColliderNormalSide = new(); /// /// two triangles @@ -81,7 +82,7 @@ namespace SphereTriangle return GetBoundsFrom4(list.Get(_a), list.Get(_b), list.Get(_c), list.Get(_d)); } - public void Collide(PositionList list, IReadOnlyCollection colliders) + public void Collide(PositionList list, IReadOnlyCollection colliders) { using (new ProfileSample("Rect: Prepare")) { @@ -160,9 +161,9 @@ namespace SphereTriangle /// /// /// - static bool TryCollide(TriangleCapsuleCollisionSolver solver, SphereCapsuleCollider collider, in Triangle t, out LineSegment l) + static bool TryCollide(TriangleCapsuleCollisionSolver solver, VRM10SpringBoneCollider collider, in Triangle t, out LineSegment l) { - if (collider.IsCapsule) + if (collider.ColliderType == VRM10SpringBoneColliderTypes.Capsule) { // capsule TriangleCapsuleCollisionSolver.Result result = default; @@ -207,15 +208,9 @@ namespace SphereTriangle return true; } - // p を三辺に投影し t を得る - // var proj = triangle.Project(p); - // if (proj.TryGetClosest(collider, out var x)) - // { - // // 最近点の距離 - // // TODO: - // return new LineSegment(collider, x); - // } - throw new System.NotImplementedException(); + var closestPoint = triangle.GetClosest(collider); + l = new LineSegment(collider, closestPoint); + return true; } public void DrawGizmos() diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/ColliderGroup.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/ColliderGroup.cs index 401d4d866..989942dae 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/ColliderGroup.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/ColliderGroup.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using UnityEngine; +using UniVRM10; namespace SphereTriangle { @@ -11,6 +12,6 @@ namespace SphereTriangle public string Name; [SerializeField] - public List Colliders = new List(); + public List Colliders = new(); } } \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/LineDistanceGizmo.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/LineDistanceGizmo.cs index 6b7bdd469..963e6f0b8 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/LineDistanceGizmo.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/LineDistanceGizmo.cs @@ -1,23 +1,24 @@ using UnityEngine; +using UniVRM10; namespace SphereTriangle { public class LineDistanceGizmo : MonoBehaviour { - public SphereCapsuleCollider LineA; - public SphereCapsuleCollider LineB; + public VRM10SpringBoneCollider LineA; + public VRM10SpringBoneCollider LineB; void Reset() { if (LineA == null) { - LineA = GetComponent(); + LineA = GetComponent(); } } public void OnDrawGizmos() { - if (LineA.IsCapsule && LineB.IsCapsule) + if (LineA.ColliderType == VRM10SpringBoneColliderTypes.Capsule && LineB.ColliderType == VRM10SpringBoneColliderTypes.Capsule) { var a = new LineSegment(LineA.HeadWorldPosition, LineA.TailWorldPosition); var b = new LineSegment(LineB.HeadWorldPosition, LineB.TailWorldPosition); diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/SphereCapsuleCollider.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/SphereCapsuleCollider.cs deleted file mode 100644 index 4eaf61794..000000000 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/SphereCapsuleCollider.cs +++ /dev/null @@ -1,173 +0,0 @@ -using UnityEngine; -using UniVRM10; - - -namespace SphereTriangle -{ - public class SphereCapsuleCollider - { - public readonly VRM10SpringBoneCollider _vrm; - public Color GizmoColor = Color.yellow; - public bool SolidGizmo = false; - - public float Radius => _vrm.Radius; - public bool IsCapsule => _vrm.ColliderType == VRM10SpringBoneColliderTypes.Capsule; - public Vector3 HeadWorldPosition => _vrm.transform.TransformPoint(_vrm.Offset); - public Vector3 TailWorldPosition => _vrm.transform.TransformPoint(_vrm.TailOrNormal); - public Ray? HeadTailRay => IsCapsule ? new Ray { origin = HeadWorldPosition, direction = TailWorldPosition - HeadWorldPosition } : null; - public float CapsuleLength => !IsCapsule ? 0 : Vector3.Distance(TailWorldPosition, HeadWorldPosition); - - public SphereCapsuleCollider(VRM10SpringBoneCollider vrmCollider) - { - _vrm = vrmCollider; - } - - public Bounds GetBounds() - { - if (IsCapsule) - { - var h = HeadWorldPosition; - var t = TailWorldPosition; - var d = h - t; - var aabb = new Bounds((h + t) * 0.5f, new Vector3(Mathf.Abs(d.x), Mathf.Abs(d.y), Mathf.Abs(d.z))); - aabb.Expand(_vrm.Radius * 2); - return aabb; - } - else - { - return new Bounds(HeadWorldPosition, new Vector3(_vrm.Radius, _vrm.Radius, _vrm.Radius)); - } - } - - /// - /// collide sphere a and sphere b. - /// move sphere b to resolved if collide. - /// - /// - /// - /// - /// - /// - /// - static bool TryCollideSphereAndSphere( - in Vector3 from, float ra, - in Vector3 to, float rb, - out LineSegment resolved - ) - { - var d = Vector3.Distance(from, to); - if (d > (ra + rb)) - { - resolved = default; - return false; - } - Vector3 normal = (to - from).normalized; - resolved = new(from, from + normal * (d - rb)); - return true; - } - - /// - /// collide capsule and sphere b. - /// move sphere b to resolved if collide. - /// - /// - /// - /// - /// - /// - static bool TryCollideCapsuleAndSphere( - in Vector3 capsuleHead, - in Vector3 capsuleTail, - float capsuleRadius, - in Vector3 b, - float rb, - out LineSegment resolved - ) - { - var P = (capsuleTail - capsuleHead).normalized; - var Q = b - capsuleHead; - var dot = Vector3.Dot(P, Q); - if (dot <= 0) - { - // head側半球の球判定 - return TryCollideSphereAndSphere(capsuleHead, capsuleRadius, b, rb, out resolved); - } - - var t = dot / P.magnitude; - if (t >= 1.0f) - { - // tail側半球の球判定 - return TryCollideSphereAndSphere(capsuleTail, capsuleRadius, b, rb, out resolved); - } - - // head-tail上の m_transform.position との最近点 - var p = capsuleHead + P * t; - return TryCollideSphereAndSphere(p, capsuleRadius, b, rb, out resolved); - } - - /// - /// collision for strand - /// - /// - /// - /// - /// - public bool TryCollide(in Vector3 p, float radius, out LineSegment resolved) - { - if (IsCapsule) - { - return TryCollideCapsuleAndSphere(HeadWorldPosition, TailWorldPosition, this.Radius, p, radius, out resolved); - } - else - { - return TryCollideSphereAndSphere(HeadWorldPosition, this.Radius, p, radius, out resolved); - } - } - - public static void DrawCapsuleGizmo(Vector3 start, Vector3 end, float radius) - { - var tail = end - start; - var distance = (end - start).magnitude; - Gizmos.matrix = Matrix4x4.TRS(start, Quaternion.FromToRotation(Vector3.forward, tail), Vector3.one); - Gizmos.DrawWireSphere(Vector3.zero, radius); - Gizmos.DrawWireSphere(Vector3.forward * distance, radius); - var capsuleEnd = Vector3.forward * distance; - var offsets = new Vector3[] { new Vector3(-1.0f, 0.0f, 0.0f), new Vector3(0.0f, 1.0f, 0.0f), new Vector3(1.0f, 0.0f, 0.0f), new Vector3(0.0f, -1.0f, 0.0f) }; - for (int i = 0; i < offsets.Length; i++) - { - Gizmos.DrawLine(offsets[i] * radius, capsuleEnd + offsets[i] * radius); - } - Gizmos.matrix = Matrix4x4.identity; - } - - public void OnDrawGizmos() - { - if (SolidGizmo) - { - Gizmos.color = Color.white; - Gizmos.DrawSphere(HeadWorldPosition, Radius); - } - - Gizmos.color = GizmoColor; - if (_vrm.transform.parent != null) - { - Gizmos.DrawLine(HeadWorldPosition, HeadWorldPosition); - } - if (IsCapsule) - { - DrawCapsuleGizmo(HeadWorldPosition, TailWorldPosition, Radius); - } - else - { - Gizmos.DrawWireSphere(HeadWorldPosition, Radius); - } - -#if AABB_DEBUG - Gizmos.matrix = Matrix4x4.identity; - Gizmos.color = Color.magenta; - var aabb = GetBounds(); - Gizmos.DrawWireCube(aabb.center, aabb.size); -#endif - } - } -} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/SphereCapsuleCollider.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/SphereCapsuleCollider.cs.meta deleted file mode 100644 index eb2d57d39..000000000 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/SphereCapsuleCollider.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 4d8072930ebf6d34ea30547c75dfb378 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/Triangle.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/Triangle.cs index 082007891..3b69a018c 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/Triangle.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/Triangle.cs @@ -36,6 +36,10 @@ namespace SphereTriangle public Vector3 b => Points[1]; public Vector3 c => Points[2]; + public LineSegment AB => new LineSegment(a, b); + public LineSegment BC => new LineSegment(b, c); + public LineSegment CA => new LineSegment(c, a); + public Triangle(Vector3 a, Vector3 b, Vector3 c) { Plane = new Plane(a, b, c); @@ -269,6 +273,47 @@ namespace SphereTriangle // }; // } + public Vector3 GetClosest(in Vector3 p) + { + var ab = AB; + var t_ab = ab.Project(p); + var p_ab = ab.GetPoint(t_ab); + var d_ab = Vector3.Distance(p, p_ab); + + var bc = BC; + var t_bc = bc.Project(p); + var p_bc = bc.GetPoint(t_bc); + var d_bc = Vector3.Distance(p, p_bc); + + var ca = CA; + var t_ca = ca.Project(p); + var p_ca = ca.GetPoint(t_ca); + var d_ca = Vector3.Distance(p, p_ca); + + if (d_ab < d_bc) + { + if (d_ab < d_ca) + { + return p_ab; + } + else + { + return p_ca; + } + } + else + { + if (d_bc < d_ca) + { + return p_bc; + } + else + { + return p_ca; + } + } + } + public void DrawGizmos() { #if UNITY_2022_3_OR_NEWER diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/TriangleCapsuleCollisionSolver.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/TriangleCapsuleCollisionSolver.cs index 63d1cee79..0ce7ad4f6 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/TriangleCapsuleCollisionSolver.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/TriangleCapsuleCollisionSolver.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using UnityEngine; +using UniVRM10; namespace SphereTriangle { @@ -129,14 +130,14 @@ namespace SphereTriangle public Result Result; } // 複数コライダーのデバッグ表示のため - public Dictionary collider_status_map = new(); + public Dictionary collider_status_map = new(); public void BeginFrame() { collider_status_map.Clear(); } - public Result Collide(in Triangle t, SphereCapsuleCollider collider, in LineSegment capsule, float radius) + public Result Collide(in Triangle t, VRM10SpringBoneCollider collider, in LineSegment capsule, float radius) { if (collider == null) { diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/TriangleCapsuleGizmo.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/TriangleCapsuleGizmo.cs index 40f20711c..f842d4594 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/TriangleCapsuleGizmo.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/TriangleCapsuleGizmo.cs @@ -1,4 +1,5 @@ using UnityEngine; +using UniVRM10; namespace SphereTriangle @@ -7,7 +8,7 @@ namespace SphereTriangle { public Transform B; public Transform C; - public SphereCapsuleCollider Capsule; + public VRM10SpringBoneCollider Capsule; void Reset() { @@ -35,7 +36,7 @@ namespace SphereTriangle if (C == null) return; var t = new Triangle(transform.position, B.position, C.position); - if (!Capsule.IsCapsule) return; + if (Capsule.ColliderType != VRM10SpringBoneColliderTypes.Capsule) return; var capsule = new LineSegment(Capsule.HeadWorldPosition, Capsule.TailWorldPosition); _solver.BeginFrame(); From 57486cdc664bfbc2d23d7bbb4622dd5ac6a5db34 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Sat, 16 Nov 2024 09:52:49 +0900 Subject: [PATCH 030/113] ColliderGroup to VRM10SpringBoneColliderGroup --- .../Runtime/RotateParticleSystem.cs | 10 +++++----- .../SphereTriangle/ClothRectCollision.cs | 2 +- .../Runtime/SphereTriangle/ColliderGroup.cs | 17 ----------------- .../SphereTriangle/ColliderGroup.cs.meta | 11 ----------- 4 files changed, 6 insertions(+), 34 deletions(-) delete mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/ColliderGroup.cs delete mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/ColliderGroup.cs.meta diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs index 9a23efd70..5a4be00c2 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs @@ -23,7 +23,7 @@ namespace RotateParticle public List _cloths = new(); [SerializeField] - public List _colliderGroups = new(); + public List _colliderGroups = new(); [Range(0, 1)] public float _clothFactor = 0.5f; @@ -43,7 +43,7 @@ namespace RotateParticle Color.magenta, }; - Color GetGizmoColor(ColliderGroup g) + Color GetGizmoColor(VRM10SpringBoneColliderGroup g) { for (int i = 0; i < _colliderGroups.Count; ++i) { @@ -287,7 +287,7 @@ namespace RotateParticle } } - public ColliderGroup GetOrAddColliderGroup(string groupName) + public VRM10SpringBoneColliderGroup GetOrAddColliderGroup(string groupName, GameObject go) { foreach (var g in _colliderGroups) { @@ -297,7 +297,7 @@ namespace RotateParticle } } - var group = new ColliderGroup { Name = groupName }; + var group = go.AddComponent(); _colliderGroups.Add(group); return group; } @@ -305,7 +305,7 @@ namespace RotateParticle public void AddColliderIfNotExists(string groupName, VRM10SpringBoneCollider c) { - var group = GetOrAddColliderGroup(groupName); + var group = GetOrAddColliderGroup(groupName, c.gameObject); foreach (var collider in group.Colliders) { diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/ClothRectCollision.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/ClothRectCollision.cs index fa26fdeca..1c5e56c81 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/ClothRectCollision.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/ClothRectCollision.cs @@ -45,7 +45,7 @@ namespace SphereTriangle _d = d; } - public void InitializeColliderSide(PositionList list, IReadOnlyList colliderGroups) + public void InitializeColliderSide(PositionList list, IReadOnlyList colliderGroups) { var a = list.Get(_a); var b = list.Get(_b); diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/ColliderGroup.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/ColliderGroup.cs deleted file mode 100644 index 989942dae..000000000 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/ColliderGroup.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; -using UniVRM10; - -namespace SphereTriangle -{ - [Serializable] - public class ColliderGroup - { - [SerializeField] - public string Name; - - [SerializeField] - public List Colliders = new(); - } -} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/ColliderGroup.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/ColliderGroup.cs.meta deleted file mode 100644 index c6e6b683c..000000000 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/ColliderGroup.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 07647b77d9934cd42b0bd0ab880ed321 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: From b278c3ab85809793bc86301aa0cfa92232323a0d Mon Sep 17 00:00:00 2001 From: ousttrue Date: Sat, 16 Nov 2024 10:09:30 +0900 Subject: [PATCH 031/113] fix Triangle.GetClosest --- .../ClothSample/ClothViewer/ClothViewerUI.cs | 11 ++++++----- .../RotateParticle/Runtime/RotateParticle.asmdef | 3 ++- .../Runtime/RotateParticleSpringboneRuntime.cs | 11 +++++++++++ .../RotateParticle/Runtime/RotateParticleSystem.cs | 2 +- .../Runtime/SphereTriangle/ClothRectCollision.cs | 7 ++++++- .../RotateParticle/Runtime/SphereTriangle/Triangle.cs | 10 +++++----- 6 files changed, 31 insertions(+), 13 deletions(-) diff --git a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewerUI.cs b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewerUI.cs index 15c8b982b..43de6db2f 100644 --- a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewerUI.cs +++ b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewerUI.cs @@ -341,8 +341,8 @@ namespace UniVRM10.Cloth.Viewer m_openModel.onClick.AddListener(OnOpenModelClicked); m_openMotion.onClick.AddListener(OnOpenMotionClicked); m_pastePose.onClick.AddListener(OnPastePoseClicked); - m_reconstructSprngBone.onClick.AddListener(OnResetStrandInitClicked); - m_resetSpringBone.onClick.AddListener(OnResetStrandPoseClicked); + m_reconstructSprngBone.onClick.AddListener(OnReconstruct); + m_resetSpringBone.onClick.AddListener(OnReset); // load initial bvh if (m_motion != null) @@ -488,7 +488,7 @@ namespace UniVRM10.Cloth.Viewer } } - void OnResetStrandInitClicked() + void OnReconstruct() { if (m_loaded == null) { @@ -498,13 +498,14 @@ namespace UniVRM10.Cloth.Viewer // system.ResetParticle(); } - void OnResetStrandPoseClicked() + void OnReset() { if (m_loaded == null) { return; } - ResetStrandPose(); + m_loaded.Runtime.SpringBone.RestoreInitialTransform(); + // ResetStrandPose(); } void ResetStrandPose() diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticle.asmdef b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticle.asmdef index 9bfc3647a..437ac90b5 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticle.asmdef +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticle.asmdef @@ -4,7 +4,8 @@ "references": [ "GUID:3e5d614bc16b50d41bd94c8d7444ca46", "GUID:e47c917724578cc43b5506c17a27e9a0", - "GUID:8d76e605759c3f64a957d63ef96ada7c" + "GUID:8d76e605759c3f64a957d63ef96ada7c", + "GUID:1cd941934d098654fa21a13f28346412" ], "includePlatforms": [], "excludePlatforms": [], diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs index 4561decad..ddddae5bb 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs @@ -11,6 +11,7 @@ namespace RotateParticle { public class RotateParticleSpringboneRuntime : IVrm10SpringBoneRuntime { + Vrm10Instance _vrm; RotateParticleSystem _system; Action _onInit; @@ -25,6 +26,8 @@ namespace RotateParticle public async Task InitializeAsync(Vrm10Instance instance, IAwaitCaller awaitCaller) { + _vrm = instance; + var animator = instance.GetComponent(); if (animator == null) { @@ -83,6 +86,14 @@ namespace RotateParticle public void RestoreInitialTransform() { + if (_vrm == null) + { + return; + } + foreach (var p in _system._list._particleTransforms) + { + p.transform.localRotation = _vrm.DefaultTransformStates[p.transform].LocalRotation; + } } public void SetJointLevel(Transform joint, BlittableJointMutable jointSettings) diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs index 5a4be00c2..dccac3d86 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs @@ -29,7 +29,7 @@ namespace RotateParticle public float _clothFactor = 0.5f; // runtime - List _strands = new List(); + public List _strands = new List(); public ParticleList _list = new(); public List<(SpringConstraint, ClothRectCollision)> _clothRects = new(); diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/ClothRectCollision.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/ClothRectCollision.cs index 1c5e56c81..2a2a7a488 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/ClothRectCollision.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/ClothRectCollision.cs @@ -208,7 +208,12 @@ namespace SphereTriangle return true; } - var closestPoint = triangle.GetClosest(collider); + var (closestPoint, d) = triangle.GetClosest(collider); + if (d > radius) + { + l = default; + return false; + } l = new LineSegment(collider, closestPoint); return true; } diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/Triangle.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/Triangle.cs index 3b69a018c..ac30e6a6c 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/Triangle.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/Triangle.cs @@ -273,7 +273,7 @@ namespace SphereTriangle // }; // } - public Vector3 GetClosest(in Vector3 p) + public (Vector3, float) GetClosest(in Vector3 p) { var ab = AB; var t_ab = ab.Project(p); @@ -294,22 +294,22 @@ namespace SphereTriangle { if (d_ab < d_ca) { - return p_ab; + return (p_ab, d_ab); } else { - return p_ca; + return (p_ca, d_ca); } } else { if (d_bc < d_ca) { - return p_bc; + return (p_bc, d_bc); } else { - return p_ca; + return (p_ca, d_ca); } } } From e78131413c9acc0538e909542513581a7c1dfaef Mon Sep 17 00:00:00 2001 From: ousttrue Date: Sun, 17 Nov 2024 17:27:22 +0900 Subject: [PATCH 032/113] WIP IRotateParticle --- .../ClothSample/ClothViewer/ClothViewerUI.cs | 75 +++--- .../RotateParticleRuntimeProviderEditor.cs | 8 + .../RotateParticle/Runtime/Components/Warp.cs | 7 +- .../Runtime/IRotateParticleSystem.cs | 15 ++ .../Runtime/IRotateParticleSystem.cs.meta | 11 + .../RotateParticle/Runtime/Jobs.meta | 8 + .../RotateParticle/Runtime/Jobs/FrameInfo.cs | 18 ++ .../Runtime/Jobs/FrameInfo.cs.meta | 11 + .../Runtime/Jobs/RotateParticleJobSystem.cs | 217 ++++++++++++++++++ .../Jobs/RotateParticleJobSystem.cs.meta | 11 + .../RotateParticleSpringboneRuntime.cs | 42 +--- .../Runtime/RotateParticleSystem.cs | 58 +++-- .../SphereTriangle/ClothRectCollision.cs | 30 +-- .../Runtime/SphereTriangle/PositionList.cs | 18 +- .../Runtime/SphereTriangle/Triangle.cs | 25 +- .../TriangleCapsuleCollisionSolver.cs | 16 +- 16 files changed, 437 insertions(+), 133 deletions(-) create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/IRotateParticleSystem.cs create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/IRotateParticleSystem.cs.meta create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs.meta create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/FrameInfo.cs create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/FrameInfo.cs.meta create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs.meta diff --git a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewerUI.cs b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewerUI.cs index 43de6db2f..022f4e1af 100644 --- a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewerUI.cs +++ b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewerUI.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading; +using RotateParticle.Components; using UniGLTF; using UnityEngine; using UnityEngine.UI; @@ -403,22 +404,14 @@ namespace UniVRM10.Cloth.Viewer m_loaded.Runtime.VrmAnimation = Motion; } } - - if (m_loaded != null) - { - if (m_springFrame++ == 0) - { - ResetStrandPose(); - } - } } void OnOpenModelClicked() { -#if UNITY_STANDALONE_WIN - var path = ClothFileDialogForWindows.FileDialog("open VRM", "vrm"); -#elif UNITY_EDITOR +#if UNITY_EDITOR var path = UnityEditor.EditorUtility.OpenFilePanel("Open VRM", "", "vrm"); +#elif UNITY_STANDALONE_WIN + var path = ClothFileDialogForWindows.FileDialog("open VRM", "vrm"); #else var path = Application.dataPath + "/default.vrm"; #endif @@ -494,6 +487,7 @@ namespace UniVRM10.Cloth.Viewer { return; } + m_loaded.Runtime.SpringBone.ReconstructSpringBone(); // var system = m_loaded.Instance.GetComponent(); // system.ResetParticle(); } @@ -508,35 +502,35 @@ namespace UniVRM10.Cloth.Viewer // ResetStrandPose(); } - void ResetStrandPose() - { - ResetStrandPose(MakeSetPose(), 32, 1.0f / 30, 60); - } + // void ResetStrandPose() + // { + // ResetStrandPose(MakeSetPose(), 32, 1.0f / 30, 60); + // } - void ResetStrandPose(Action setPose, int iteration, float timeDelta, int finish) - { - // var system = m_loaded.Instance.GetComponent(); + // void ResetStrandPose(Action setPose, int iteration, float timeDelta, int finish) + // { + // var system = m_loaded.Instance.GetComponent(); - // // init - // setPose(0); - // system.ResetParticle(); + // // init + // setPose(0); + // system.ResetParticle(); - // // lerp - // var t = 0.0f; - // var d = 1.0f / iteration; - // for (int i = 0; i < iteration; ++i, t += d) - // { - // setPose(t); - // system.Process(timeDelta); - // } + // // lerp + // var t = 0.0f; + // var d = 1.0f / iteration; + // for (int i = 0; i < iteration; ++i, t += d) + // { + // setPose(t); + // system.Process(timeDelta); + // } - // // finish - // setPose(1.0f); - // for (int i = 0; i < finish; ++i) - // { - // system.Process(timeDelta); - // } - } + // // finish + // setPose(1.0f); + // for (int i = 0; i < finish; ++i) + // { + // system.Process(timeDelta); + // } + // } static IMaterialDescriptorGenerator GetVrmMaterialDescriptorGenerator(bool useUrp) { @@ -550,7 +544,7 @@ namespace UniVRM10.Cloth.Viewer } } - void OnInit(RotateParticle.RotateParticleSystem system, Vrm10Instance vrm) + void OnInit(RotateParticle.IRotateParticleSystem system, Vrm10Instance vrm) { var animator = vrm.GetComponent(); if (vrm.SpringBone.ColliderGroups.Count == 0) @@ -561,6 +555,13 @@ namespace UniVRM10.Cloth.Viewer try { ClothGuess.Guess(animator); + + var warps = animator.GetComponentsInChildren(); + var colliderGroups = animator.GetComponentsInChildren(); + foreach (var warp in warps) + { + warp.ColliderGroups = colliderGroups.ToList(); + } } catch (Exception ex) { diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/RotateParticleRuntimeProviderEditor.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/RotateParticleRuntimeProviderEditor.cs index 93d1b972c..1affaad8a 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/RotateParticleRuntimeProviderEditor.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/RotateParticleRuntimeProviderEditor.cs @@ -107,6 +107,14 @@ namespace RotateParticle.Components } } + using (new EditorGUI.DisabledScope(instance == null || !Application.isPlaying)) + { + if (GUILayout.Button("RestoreInitialTransform")) + { + instance.Runtime.SpringBone.RestoreInitialTransform(); + } + } + base.OnInspectorGUI(); } } diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Warp.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Warp.cs index d47f438d3..f83bfd4ae 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Warp.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Warp.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using UnityEngine; +using UniVRM10; namespace RotateParticle.Components @@ -27,6 +28,7 @@ namespace RotateParticle.Components [SerializeField] public float HitRadius = 0.02f; + public override bool Equals(object obj) // Object.Equals(Object)のオーバーライド { return Equals(obj as ParticleSettings); @@ -78,7 +80,10 @@ namespace RotateParticle.Components /// 枝分かれ不可 /// [SerializeField] - public List Particles = new List(); + public List Particles = new(); + + [SerializeField] + public List ColliderGroups = new(); void Reset() { diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/IRotateParticleSystem.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/IRotateParticleSystem.cs new file mode 100644 index 000000000..c1d2ec185 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/IRotateParticleSystem.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using RotateParticle.Components; +using UniVRM10; + +namespace RotateParticle +{ + public interface IRotateParticleSystem : IDisposable + { + void Initialize(IEnumerable warps, IEnumerable cloths); + void Process(float deltaTime); + void ResetInitialRotation(); + void DrawGizmos(); + } +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/IRotateParticleSystem.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/IRotateParticleSystem.cs.meta new file mode 100644 index 000000000..8c6010d5b --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/IRotateParticleSystem.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5c151a18a42e3714fbf6f52b128ce3e5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs.meta new file mode 100644 index 000000000..49a000388 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 88171b192ea95594c88871ba5b00d0ef +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/FrameInfo.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/FrameInfo.cs new file mode 100644 index 000000000..0438a3cb1 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/FrameInfo.cs @@ -0,0 +1,18 @@ +using UnityEngine; + +namespace RotateParticle.Jobs +{ + public struct FrameInfo + { + public readonly float DeltaTime; + public readonly float SqDeltaTime; + public readonly Vector3 Force; // += env.External / time.DeltaTime; + + public FrameInfo(float deltaTime, Vector3 force) + { + DeltaTime = deltaTime; + SqDeltaTime = deltaTime * deltaTime; + Force = force; + } + } +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/FrameInfo.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/FrameInfo.cs.meta new file mode 100644 index 000000000..7fe0605f4 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/FrameInfo.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ea8f33e691eb01f4ca5377804f9ce333 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs new file mode 100644 index 000000000..f2b763f4a --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs @@ -0,0 +1,217 @@ +using System; +using System.Collections.Generic; +using RotateParticle.Components; +using UniGLTF.SpringBoneJobs.Blittables; +using Unity.Collections; +using Unity.Jobs; +using UnityEngine; +using UnityEngine.Jobs; +using UniVRM10; + + +namespace RotateParticle.Jobs +{ + public class RotateParticleJobSystem : IRotateParticleSystem + { + readonly Vrm10Instance _vrm; + TransformAccessArray _transformAccessArray; + NativeArray _transforms; + + enum ParticleType + { + // kinematic. not verlet move + Root, + // particle. verlet move + Verlet, + // branch. move same as 1st branch sibling + Branch, + } + + struct ParticleInfo + { + public ParticleType ParticleType; + public int WarpIndex; + public int ParentIndex; + public float DistanceFromParent; + public Quaternion InitRotation; + public Vector3 InitTailLocalPosition; + } + + struct WarpInfo + { + public Vector3 Center; + public float DragForce; + public Quaternion ParentRotation; + public int BranchRootIndex; + public int Start; + public int End; + } + NativeArray _warps; + + NativeArray _particles; + NativeArray _verletPrevOnCenter; + NativeArray _verletCurrent; + NativeArray _verletNext; + + public IList Warps => throw new NotImplementedException(); + + public IList Cloths => throw new NotImplementedException(); + + struct VerletJob : IJobParallelFor + { + [ReadOnly] public FrameInfo Frame; + + [ReadOnly] public NativeArray Warps; + + + [ReadOnly] public NativeArray Particles; + [ReadOnly] public NativeArray PrevPositionsInCenter; + [ReadOnly] public NativeArray CurrentPositions; + [WriteOnly] public NativeArray NextPositions; + public void Execute(int index) + { + var particle = Particles[index]; + if (particle.ParticleType == ParticleType.Root) + { + // kinematic. not move + NextPositions[index] = CurrentPositions[index]; + } + else + { + var warp = Warps[particle.WarpIndex]; + var velocity = CurrentPositions[index] - warp.Center - PrevPositionsInCenter[index]; + velocity *= 1 - warp.DragForce; + NextPositions[index] = CurrentPositions[index] + + velocity + Frame.Force * Frame.SqDeltaTime; + } + } + } + + /// + /// Warp毎に verlet の結果を拘束する + /// 1. 親子間の距離を一定に保つ + /// 2. 移動を親の回転に変換する + /// + struct LocalRotationConstraintJob : IJobParallelFor + { + [ReadOnly] public NativeArray Warps; + [ReadOnly] public NativeArray Particles; + [NativeDisableParallelForRestriction] public NativeArray Positions; + [NativeDisableParallelForRestriction] public NativeArray Rotations; + + public void Execute(int index) + { + var warp = Warps[index]; + for (int i = warp.Start; i < warp.End; ++i) + { + var particle = Particles[i]; + switch (particle.ParticleType) + { + case ParticleType.Root: + break; + + case ParticleType.Verlet: + if (i + 1 < warp.End) + { + var next = Particles[i + 1]; + if (next.ParentIndex == i) + { + /// 1. 親子間の距離を一定に保つ + Positions[i + 1] = CalcPosition(Positions[i + 1], + Positions[i], next.DistanceFromParent); + // 2. 移動を親の回転に変換する + var rest = Rotations[i] * next.InitRotation; + Rotations[i] = rest * Quaternion.FromToRotation( + // 初期状態 + rest * particle.InitTailLocalPosition, + // 現状 + Positions[i + 1] - Positions[i] + ); + } + } + break; + + case ParticleType.Branch: + { + // TODO + break; + } + } + } + } + + static Vector3 CalcPosition(in Vector3 pos, in Vector3 parent, float distance) + { + return pos + (pos - parent).normalized * distance; + } + } + + public RotateParticleJobSystem(Vrm10Instance vrm) + { + _vrm = vrm; + var warps = vrm.GetComponentsInChildren(); + } + + void IDisposable.Dispose() + { + throw new NotImplementedException(); + } + + class LocalRotaionConstraintJOb : IJob + { + public void Execute() + { + + } + } + + JobHandle Schedule( + in FrameInfo info, + TransformAccessArray transformAccessArray + ) + { + JobHandle handle = default; + + // load transform + + // verlet + handle = new VerletJob + { + }.Schedule(_verletCurrent.Length, 128, handle); + + // local rotation constraint + handle = new LocalRotationConstraintJob + { + }.Schedule(_warps.Length, 1, handle); + + // update verlet + + // writeback transform + + return handle; + } + + void IRotateParticleSystem.Initialize(IEnumerable warps, IEnumerable cloths) + { + throw new NotImplementedException(); + } + + void IRotateParticleSystem.Process(float deltaTime) + { + Schedule( + new FrameInfo(deltaTime, Vector3.zero), + _transformAccessArray + ).Complete(); + } + + void IRotateParticleSystem.ResetInitialRotation() + { + throw new NotImplementedException(); + } + + void IRotateParticleSystem.DrawGizmos() + { + throw new NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs.meta new file mode 100644 index 000000000..0e1045cda --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e10706647b096be48917b33c33fbdefa +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs index ddddae5bb..107d9f46f 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs @@ -12,10 +12,12 @@ namespace RotateParticle public class RotateParticleSpringboneRuntime : IVrm10SpringBoneRuntime { Vrm10Instance _vrm; - RotateParticleSystem _system; - Action _onInit; + Action _onInit; - public RotateParticleSpringboneRuntime(Action onInit = null) + + IRotateParticleSystem _system; + + public RotateParticleSpringboneRuntime(Action onInit = null) { _onInit = onInit; } @@ -43,34 +45,16 @@ namespace RotateParticle } _system = new RotateParticleSystem(); - _system.Env.DragForce = 0.6f; - _system.Env.Stiffness = 0.07f; if (_onInit != null) { _onInit(_system, instance); } - foreach (var warp in instance.GetComponentsInChildren()) - { - _system._warps.Add(warp); - } - - foreach (var cloth in instance.GetComponentsInChildren()) - { - _system._cloths.Add(cloth); - } - - foreach (var g in instance.SpringBone.ColliderGroups) - { - foreach (var vrmCollider in g.Colliders) - { - _system.AddColliderIfNotExists(g.name, vrmCollider); - } - } - + var warps = instance.GetComponentsInChildren(); + var cloths = instance.GetComponentsInChildren(); await awaitCaller.NextFrame(); - _system.Initialize(); + _system.Initialize(warps, cloths); } public void Process() @@ -86,14 +70,8 @@ namespace RotateParticle public void RestoreInitialTransform() { - if (_vrm == null) - { - return; - } - foreach (var p in _system._list._particleTransforms) - { - p.transform.localRotation = _vrm.DefaultTransformStates[p.transform].LocalRotation; - } + if (_system == null) return; + _system.ResetInitialRotation(); } public void SetJointLevel(Transform joint, BlittableJointMutable jointSettings) diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs index dccac3d86..1838f2d08 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs @@ -9,23 +9,19 @@ using UniVRM10; namespace RotateParticle { - [Serializable] - public class RotateParticleSystem + public class RotateParticleSystem : IRotateParticleSystem { - // TODO: param to _strandGroups - [SerializeField] - public SimulationEnv Env = new(); + public SimulationEnv Env = new() + { + DragForce = 0.6f, + Stiffness = 0.07f, + }; - [SerializeField] - public List _warps = new(); + readonly List _warps = new(); + readonly List _cloths = new(); - [SerializeField] - public List _cloths = new(); - - [SerializeField] public List _colliderGroups = new(); - [Range(0, 1)] public float _clothFactor = 0.5f; // runtime @@ -58,6 +54,10 @@ namespace RotateParticle HashSet _clothUsedParticles = new(); + void IDisposable.Dispose() + { + } + public void InitializeCloth( RectCloth cloth, ParticleList list, @@ -134,19 +134,27 @@ namespace RotateParticle } } - public void Initialize() + void IRotateParticleSystem.Initialize(IEnumerable warps, IEnumerable cloths) { var strandMap = new Dictionary(); - foreach (var warp in _warps) + foreach (var warp in warps) { var strands = new List(); var strand = _list.MakeParticleStrand(Env, warp, default); strands.Add(strand); _strands.AddRange(strands); strandMap.Add(warp, strand); + + foreach (var g in warp.ColliderGroups) + { + foreach (var c in g.Colliders) + { + AddColliderIfNotExists(g.name, c); + } + } } - foreach (var cloth in _cloths) + foreach (var cloth in cloths) { InitializeCloth(cloth, _list, _clothRects, strandMap); } @@ -166,18 +174,26 @@ namespace RotateParticle /// すべての Particle を Init 状態にする。 /// Verlet の Prev を現在地に更新する(速度0)。 /// - public void ResetParticle() + /// + void IRotateParticleSystem.ResetInitialRotation() { foreach (var strand in _strands) { strand.Reset(_list._particleTransforms); } + // foreach (var p in _system._list._particleTransforms) + // { + // p.transform.localRotation = _vrm.DefaultTransformStates[p.transform].LocalRotation; + // } } - public void Process(float deltaTime) + + void IRotateParticleSystem.Process(float deltaTime) { using var profile = new ProfileSample("RotateParticle"); + _newPos.BoundsCache.Clear(); + using (new ProfileSample("UpdateRoot")) { // @@ -222,7 +238,7 @@ namespace RotateParticle foreach (var (spring, rect) in _clothRects) { - using var prof = new ProfileSample("Collision: Cloth"); + // using var prof = new ProfileSample("Collision: Cloth"); // 頂点 abcd は同じ CollisionMask // TODO: // if (_list._particles[rect._a].Init.CollisionMask.HasFlag((CollisionGroupMask)(i + 1))) @@ -234,7 +250,7 @@ namespace RotateParticle for (int j = 0; j < _list._particles.Count; ++j) { - using var prof = new ProfileSample("Collision: Strand"); + // using var prof = new ProfileSample("Collision: Strand"); if (_clothUsedParticles.Contains(j)) { // 布で処理された @@ -302,7 +318,7 @@ namespace RotateParticle return group; } - public void AddColliderIfNotExists(string groupName, + void AddColliderIfNotExists(string groupName, VRM10SpringBoneCollider c) { var group = GetOrAddColliderGroup(groupName, c.gameObject); @@ -404,7 +420,7 @@ namespace RotateParticle } } - public void DrawGizmos() + void IRotateParticleSystem.DrawGizmos() { _list.DrawGizmos(); diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/ClothRectCollision.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/ClothRectCollision.cs index 2a2a7a488..b5d4f9924 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/ClothRectCollision.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/ClothRectCollision.cs @@ -68,7 +68,7 @@ namespace SphereTriangle } } - Bounds GetBoundsFrom4(in Vector3 a, in Vector3 b, in Vector3 c, in Vector3 d) + public Bounds GetBoundsFrom4(in Vector3 a, in Vector3 b, in Vector3 c, in Vector3 d) { var aabb = new Bounds(a, Vector3.zero); aabb.Encapsulate(b); @@ -77,14 +77,9 @@ namespace SphereTriangle return aabb; } - Bounds GetBounds(PositionList list) + public void Collide(PositionList list, IList colliders) { - return GetBoundsFrom4(list.Get(_a), list.Get(_b), list.Get(_c), list.Get(_d)); - } - - public void Collide(PositionList list, IReadOnlyCollection colliders) - { - using (new ProfileSample("Rect: Prepare")) + // using (new ProfileSample("Rect: Prepare")) { _s0.BeginFrame(); _s1.BeginFrame(); @@ -114,13 +109,14 @@ namespace SphereTriangle } } - using (new ProfileSample("Rect: Collide")) + // using (new ProfileSample("Rect: Collide")) { - var aabb = GetBounds(list); + var aabb = list.GetBounds(this); - foreach (var collider in colliders) + for (int i = 0; i < colliders.Count; ++i) { - using (new ProfileSample("EaryOut")) + var collider = colliders[i]; + // using (new ProfileSample("EaryOut")) { if (!aabb.Intersects(collider.GetBounds())) { @@ -167,11 +163,11 @@ namespace SphereTriangle { // capsule TriangleCapsuleCollisionSolver.Result result = default; - using (new ProfileSample("Capsule: Collide")) + // using (new ProfileSample("Capsule: Collide")) { result = solver.Collide(t, collider, new(collider.HeadWorldPosition, collider.TailWorldPosition), collider.Radius); } - using (new ProfileSample("Capsule: TryGetClosest")) + // using (new ProfileSample("Capsule: TryGetClosest")) { var type = result.TryGetClosest(out l); return type.HasValue; @@ -180,7 +176,7 @@ namespace SphereTriangle else { // sphere - using var profile = new ProfileSample("Sphere"); + // using var profile = new ProfileSample("Sphere"); return TryCollideSphere(t, collider.HeadWorldPosition, collider.Radius, out l); } } @@ -220,10 +216,6 @@ namespace SphereTriangle public void DrawGizmos() { - if (_triangle0.Points == null) - { - return; - } var r = Vector3.Distance(_triangle0.b, _triangle0.c) * 0.1f; _DrawGizmos(_triangle0, _s0, _trinagle0Collision, r); _DrawGizmos(_triangle1, _s1, _triangle1Collision, r); diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/PositionList.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/PositionList.cs index b13b87fe8..0377300ad 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/PositionList.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/PositionList.cs @@ -30,6 +30,22 @@ namespace SphereTriangle Result = new Vector3[count]; } + public Dictionary BoundsCache = new(); + + public Bounds GetBounds(ClothRectCollision rect) + { + if (BoundsCache.TryGetValue(rect, out var b)) + { + return b; + } + else + { + b = rect.GetBoundsFrom4(Get(rect._a), Get(rect._b), Get(rect._c), Get(rect._d)); + BoundsCache.Add(rect, b); + return b; + } + } + public Vector3 Get(int index) { return Positions[index]; @@ -59,7 +75,7 @@ namespace SphereTriangle /// public void CollisionMove(int index, in LineSegment l, float radius, float factor = 1.0f) { - using var profile = new ProfileSample("CollisionMove"); + // using var profile = new ProfileSample("CollisionMove"); if (Mass[index] > 0) { Delta[index] += l.GetDelta(radius) * factor; diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/Triangle.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/Triangle.cs index ac30e6a6c..1b0dd1442 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/Triangle.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/Triangle.cs @@ -30,11 +30,10 @@ namespace SphereTriangle public struct Triangle { public Plane Plane; - public Vector3[] Points; - public Vector3 a => Points[0]; - public Vector3 b => Points[1]; - public Vector3 c => Points[2]; + public Vector3 a; + public Vector3 b; + public Vector3 c; public LineSegment AB => new LineSegment(a, b); public LineSegment BC => new LineSegment(b, c); @@ -43,7 +42,9 @@ namespace SphereTriangle public Triangle(Vector3 a, Vector3 b, Vector3 c) { Plane = new Plane(a, b, c); - Points = new Vector3[] { a, b, c }; + this.a = a; + this.b = b; + this.c = c; } /// @@ -316,15 +317,11 @@ namespace SphereTriangle public void DrawGizmos() { -#if UNITY_2022_3_OR_NEWER - Gizmos.DrawLineStrip(Points, true); -#else - for (int i = 0; i < Points.Length - 1; ++i) - { - Gizmos.DrawLine(Points[i], Points[i + 1]); - } - Gizmos.DrawLine(Points[Points.Length - 1], Points[0]); -#endif + var points = (stackalloc Vector3[3]); + points[0] = a; + points[1] = b; + points[2] = c; + Gizmos.DrawLineStrip(points, true); } } } \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/TriangleCapsuleCollisionSolver.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/TriangleCapsuleCollisionSolver.cs index 0ce7ad4f6..b2e13e96d 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/TriangleCapsuleCollisionSolver.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/TriangleCapsuleCollisionSolver.cs @@ -59,7 +59,7 @@ namespace SphereTriangle public IntersectionType? TryGetClosest(out LineSegment value) { - using var profile = new ProfileSample("TryGetClosest"); + // using var profile = new ProfileSample("TryGetClosest"); var d = float.PositiveInfinity; value = default; IntersectionType? it = default; @@ -145,7 +145,7 @@ namespace SphereTriangle } Status status = default; - using (new ProfileSample("Parallel Prepare")) + // using (new ProfileSample("Parallel Prepare")) { if (collider_status_map.TryGetValue(collider, out status)) { @@ -157,14 +157,14 @@ namespace SphereTriangle } float dot = default; - using (new ProfileSample("Dot")) + // using (new ProfileSample("Dot")) { dot = Vector3.Dot(t.Plane.normal, capsule.Vector); } if (Mathf.Abs(dot) < 1e-4) { - using var profile = new ProfileSample("Parallel"); + // using var profile = new ProfileSample("Parallel"); // 三角面とカプセルが平行 var d = t.Plane.GetDistanceToPoint(capsule.Start); if (d < -radius || d > radius) @@ -176,7 +176,7 @@ namespace SphereTriangle } else { - using var profile = new ProfileSample("TryClampPlaneDistance"); + // using var profile = new ProfileSample("TryClampPlaneDistance"); if (capsule.TryClampPlaneDistance(t.Plane, radius, out status.Clamped, out status.O)) { } @@ -186,7 +186,7 @@ namespace SphereTriangle } } - using (new ProfileSample("ClosestPointOnPlane")) + // using (new ProfileSample("ClosestPointOnPlane")) { status.PS = t.Plane.ClosestPointOnPlane(status.Clamped.Start); status.PE = t.Plane.ClosestPointOnPlane(status.Clamped.End); @@ -195,7 +195,7 @@ namespace SphereTriangle LineSegment? startInTriangle = default; LineSegment? endInTriangle = default; - using (new ProfileSample("InTriangle")) + // using (new ProfileSample("InTriangle")) { if (t.IsSameSide(status.PS)) { @@ -231,7 +231,7 @@ namespace SphereTriangle LineSegment? edgeABDistance = default; LineSegment? edgeBCDistance = default; LineSegment? edgeCADistance = default; - using (new ProfileSample("EdgeDistance")) + // using (new ProfileSample("EdgeDistance")) { // triangle edges var ab = new LineSegment(t.a, t.b); From a39ed1594b0c9b70eafef7be3f54131929b3897f Mon Sep 17 00:00:00 2001 From: ousttrue Date: Sun, 17 Nov 2024 18:53:11 +0900 Subject: [PATCH 033/113] IRotateParticleSystem.InitializeAsync --- .../UniHumanoid/SkeletonMeshUtility.cs | 2 +- .../ClothSample/ClothViewer/ClothViewerUI.cs | 30 +++++---- .../RotateParticleRuntimeProviderEditor.cs | 64 +------------------ .../RotateParticleRuntimeProvider.cs | 61 ++++++++++++++++++ .../Runtime/IRotateParticleSystem.cs | 6 +- .../Runtime/Jobs/RotateParticleJobSystem.cs | 15 ++--- .../RotateParticleSpringboneRuntime.cs | 43 +++++-------- .../Runtime/RotateParticleSystem.cs | 8 ++- 8 files changed, 116 insertions(+), 113 deletions(-) diff --git a/Assets/UniGLTF/Runtime/UniHumanoid/SkeletonMeshUtility.cs b/Assets/UniGLTF/Runtime/UniHumanoid/SkeletonMeshUtility.cs index 708dd6544..cee8f1fa4 100644 --- a/Assets/UniGLTF/Runtime/UniHumanoid/SkeletonMeshUtility.cs +++ b/Assets/UniGLTF/Runtime/UniHumanoid/SkeletonMeshUtility.cs @@ -254,7 +254,7 @@ namespace UniHumanoid { if (Application.isEditor) { - Debug.LogWarningFormat("{0} not found", headTail.Head); + // Debug.LogWarningFormat("{0} not found", headTail.Head); } } } diff --git a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewerUI.cs b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewerUI.cs index 022f4e1af..310375276 100644 --- a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewerUI.cs +++ b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewerUI.cs @@ -544,23 +544,31 @@ namespace UniVRM10.Cloth.Viewer } } - void OnInit(RotateParticle.IRotateParticleSystem system, Vrm10Instance vrm) + void OnInit(Vrm10Instance vrm) { var animator = vrm.GetComponent(); - if (vrm.SpringBone.ColliderGroups.Count == 0) - { - HumanoidCollider.AddColliders(animator); - } try { - ClothGuess.Guess(animator); - - var warps = animator.GetComponentsInChildren(); - var colliderGroups = animator.GetComponentsInChildren(); - foreach (var warp in warps) + if (vrm.SpringBone.Springs.Count == 0) { - warp.ColliderGroups = colliderGroups.ToList(); + ClothGuess.Guess(animator); + if (vrm.SpringBone.ColliderGroups.Count == 0) + { + HumanoidCollider.AddColliders(animator); + var warps = animator.GetComponentsInChildren(); + var colliderGroups = animator.GetComponentsInChildren(); + foreach (var warp in warps) + { + warp.ColliderGroups = colliderGroups.ToList(); + } + } + } + else + { + RotateParticleRuntimeProvider.FromVrm10(vrm, + go => go.AddComponent(), + o => GameObject.DestroyImmediate(o)); } } catch (Exception ex) diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/RotateParticleRuntimeProviderEditor.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/RotateParticleRuntimeProviderEditor.cs index 1affaad8a..b730f3bf8 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/RotateParticleRuntimeProviderEditor.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/RotateParticleRuntimeProviderEditor.cs @@ -22,66 +22,6 @@ namespace RotateParticle.Components return go.GetComponent() != null; } - static void FromVrm10(Vrm10Instance instance) - { - Undo.RegisterCompleteObjectUndo(instance, "RegisterCompleteObjectUndo"); - foreach (var spring in instance.SpringBone.Springs) - { - if (spring.Joints == null || spring.Joints[0] == null) - { - continue; - } - - var root_joint = spring.Joints[0].gameObject; - if (root_joint == null) - { - continue; - } - - if (root_joint.GetComponent() != null) - { - continue; - } - - var warp = Undo.AddComponent(root_joint); - var joints = spring.Joints.Where(x => x != null).ToArray(); - for (int i = 0; i < joints.Length; ++i) - { - var joint = joints[i]; - var settings = new Warp.ParticleSettings - { - DragForce = joint.m_dragForce, - GravityDir = joint.m_gravityDir, - GravityPower = joint.m_gravityPower, - StiffnessForce = joint.m_stiffnessForce, - }; - if (i == 0) - { - settings.HitRadius = joints[0].m_jointRadius; - warp.BaseSettings = settings; - } - else - { - // breaking change from vrm-1.0 - settings.HitRadius = joints[i - 1].m_jointRadius; - var useInheritSettings = warp.BaseSettings.Equals(settings); - warp.Particles.Add(new Warp.Particle - { - useInheritSettings = useInheritSettings, - OverrideSettings = settings, - Transform = joint.transform, - }); - } - Undo.DestroyObjectImmediate(joint); - } - spring.Joints.Clear(); - } - instance.SpringBone.Springs.Clear(); - - Undo.RegisterFullObjectHierarchyUndo(instance.gameObject, "RegisterFullObjectHierarchyUndo"); - - } - public override void OnInspectorGUI() { var provider = target as RotateParticleRuntimeProvider; @@ -98,7 +38,9 @@ namespace RotateParticle.Components Undo.SetCurrentGroupName(FROM_VRM10_MENU); var undo = Undo.GetCurrentGroup(); - FromVrm10(instance); + Undo.RegisterCompleteObjectUndo(instance, "RegisterCompleteObjectUndo"); + RotateParticleRuntimeProvider.FromVrm10(instance, Undo.AddComponent, Undo.DestroyObjectImmediate); + Undo.RegisterFullObjectHierarchyUndo(instance.gameObject, "RegisterFullObjectHierarchyUndo"); Undo.RegisterCompleteObjectUndo(provider, "RegisterCompleteObjectUndo"); provider.Reset(); diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RotateParticleRuntimeProvider.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RotateParticleRuntimeProvider.cs index 5ee13cbde..99d3d8cf4 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RotateParticleRuntimeProvider.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RotateParticleRuntimeProvider.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using System.Linq; using UnityEngine; @@ -36,5 +37,65 @@ namespace RotateParticle.Components } m_runtime.DrawGizmos(); } + + public static void FromVrm10(Vrm10Instance instance, + Func addWarp, + Action deleteObject) + { + foreach (var spring in instance.SpringBone.Springs) + { + if (spring.Joints == null || spring.Joints[0] == null) + { + continue; + } + + var root_joint = spring.Joints[0].gameObject; + if (root_joint == null) + { + continue; + } + + var warp = root_joint.GetComponent(); + if (warp == null) + { + // var warp = Undo.AddComponent(root_joint); + warp = addWarp(root_joint); + var joints = spring.Joints.Where(x => x != null).ToArray(); + for (int i = 0; i < joints.Length; ++i) + { + var joint = joints[i]; + var settings = new Warp.ParticleSettings + { + DragForce = joint.m_dragForce, + GravityDir = joint.m_gravityDir, + GravityPower = joint.m_gravityPower, + StiffnessForce = joint.m_stiffnessForce, + }; + if (i == 0) + { + settings.HitRadius = joints[0].m_jointRadius; + warp.BaseSettings = settings; + } + else + { + // breaking change from vrm-1.0 + settings.HitRadius = joints[i - 1].m_jointRadius; + var useInheritSettings = warp.BaseSettings.Equals(settings); + warp.Particles.Add(new Warp.Particle + { + useInheritSettings = useInheritSettings, + OverrideSettings = settings, + Transform = joint.transform, + }); + } + // Undo.DestroyObjectImmediate(joint); + deleteObject(joint); + } + spring.Joints.Clear(); + warp.ColliderGroups = spring.ColliderGroups.ToList(); + } + } + instance.SpringBone.Springs.Clear(); + } } } \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/IRotateParticleSystem.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/IRotateParticleSystem.cs index c1d2ec185..962b5e8e0 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/IRotateParticleSystem.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/IRotateParticleSystem.cs @@ -1,13 +1,13 @@ using System; -using System.Collections.Generic; -using RotateParticle.Components; +using System.Threading.Tasks; +using UniGLTF; using UniVRM10; namespace RotateParticle { public interface IRotateParticleSystem : IDisposable { - void Initialize(IEnumerable warps, IEnumerable cloths); + Task InitializeAsync(Vrm10Instance vrm, IAwaitCaller awaitCaller); void Process(float deltaTime); void ResetInitialRotation(); void DrawGizmos(); diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs index f2b763f4a..271098f09 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs @@ -1,6 +1,8 @@ using System; using System.Collections.Generic; +using System.Threading.Tasks; using RotateParticle.Components; +using UniGLTF; using UniGLTF.SpringBoneJobs.Blittables; using Unity.Collections; using Unity.Jobs; @@ -13,7 +15,7 @@ namespace RotateParticle.Jobs { public class RotateParticleJobSystem : IRotateParticleSystem { - readonly Vrm10Instance _vrm; + Vrm10Instance _vrm; TransformAccessArray _transformAccessArray; NativeArray _transforms; @@ -146,12 +148,6 @@ namespace RotateParticle.Jobs } } - public RotateParticleJobSystem(Vrm10Instance vrm) - { - _vrm = vrm; - var warps = vrm.GetComponentsInChildren(); - } - void IDisposable.Dispose() { throw new NotImplementedException(); @@ -191,8 +187,11 @@ namespace RotateParticle.Jobs return handle; } - void IRotateParticleSystem.Initialize(IEnumerable warps, IEnumerable cloths) + async Task IRotateParticleSystem.InitializeAsync(Vrm10Instance vrm, IAwaitCaller awaitCaller) { + _vrm = vrm; + var warps = vrm.GetComponentsInChildren(); + await awaitCaller.NextFrame(); throw new NotImplementedException(); } diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs index 107d9f46f..96bd281ea 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs @@ -1,6 +1,6 @@ +// #define USE_ROTATEPARTICLE_JOB using System; using System.Threading.Tasks; -using RotateParticle.Components; using UniGLTF; using UniGLTF.SpringBoneJobs.Blittables; using UnityEngine; @@ -12,12 +12,12 @@ namespace RotateParticle public class RotateParticleSpringboneRuntime : IVrm10SpringBoneRuntime { Vrm10Instance _vrm; - Action _onInit; + Action _onInit; IRotateParticleSystem _system; - public RotateParticleSpringboneRuntime(Action onInit = null) + public RotateParticleSpringboneRuntime(Action onInit = null) { _onInit = onInit; } @@ -26,35 +26,24 @@ namespace RotateParticle { } - public async Task InitializeAsync(Vrm10Instance instance, IAwaitCaller awaitCaller) + public async Task InitializeAsync(Vrm10Instance vrm, IAwaitCaller awaitCaller) { - _vrm = instance; - - var animator = instance.GetComponent(); - if (animator == null) - { - Debug.LogWarning("no animator"); - return; - } - - var avatar = animator.avatar; - if (!avatar.isHuman) - { - Debug.LogWarning("not humanoid"); - return; - } - - _system = new RotateParticleSystem(); - + _vrm = vrm; if (_onInit != null) { - _onInit(_system, instance); + _onInit(vrm); } - var warps = instance.GetComponentsInChildren(); - var cloths = instance.GetComponentsInChildren(); - await awaitCaller.NextFrame(); - _system.Initialize(warps, cloths); + // var warps = vrm.GetComponentsInChildren(); + // var cloths = vrm.GetComponentsInChildren(); + // await awaitCaller.NextFrame(); + +#if USE_ROTATEPARTICLE_JOB + _system = new Jobs.RotateParticleJobSystem(); +#else + _system = new RotateParticleSystem(); +#endif + await _system.InitializeAsync(vrm, awaitCaller); } public void Process() diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs index 1838f2d08..f9626949e 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs @@ -1,8 +1,10 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Threading.Tasks; using RotateParticle.Components; using SphereTriangle; +using UniGLTF; using UnityEngine; using UniVRM10; @@ -134,9 +136,10 @@ namespace RotateParticle } } - void IRotateParticleSystem.Initialize(IEnumerable warps, IEnumerable cloths) + async Task IRotateParticleSystem.InitializeAsync(Vrm10Instance vrm, IAwaitCaller awaitCaller) { var strandMap = new Dictionary(); + var warps = vrm.GetComponentsInChildren(); foreach (var warp in warps) { var strands = new List(); @@ -154,6 +157,7 @@ namespace RotateParticle } } + var cloths = vrm.GetComponentsInChildren(); foreach (var cloth in cloths) { InitializeCloth(cloth, _list, _clothRects, strandMap); @@ -313,7 +317,7 @@ namespace RotateParticle } } - var group = go.AddComponent(); + var group = go.GetOrAddComponent(); _colliderGroups.Add(group); return group; } From e339e2540bac1dc1c41390f68c32f505b498d976 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Mon, 18 Nov 2024 02:31:11 +0900 Subject: [PATCH 034/113] types --- .../Runtime/Jobs/RotateParticleJobSystem.cs | 200 +++++------------- .../RotateParticle/Runtime/Jobs/Types.cs | 148 +++++++++++++ .../RotateParticle/Runtime/Jobs/Types.cs.meta | 11 + .../RotateParticleSpringboneRuntime.cs | 15 +- 4 files changed, 214 insertions(+), 160 deletions(-) create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Types.cs create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Types.cs.meta diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs index 271098f09..8fa49e791 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs @@ -16,164 +16,79 @@ namespace RotateParticle.Jobs public class RotateParticleJobSystem : IRotateParticleSystem { Vrm10Instance _vrm; - TransformAccessArray _transformAccessArray; - NativeArray _transforms; - enum ParticleType - { - // kinematic. not verlet move - Root, - // particle. verlet move - Verlet, - // branch. move same as 1st branch sibling - Branch, - } - - struct ParticleInfo - { - public ParticleType ParticleType; - public int WarpIndex; - public int ParentIndex; - public float DistanceFromParent; - public Quaternion InitRotation; - public Vector3 InitTailLocalPosition; - } - - struct WarpInfo - { - public Vector3 Center; - public float DragForce; - public Quaternion ParentRotation; - public int BranchRootIndex; - public int Start; - public int End; - } NativeArray _warps; + TransformAccessArray _transformAccessArray; NativeArray _particles; - NativeArray _verletPrevOnCenter; - NativeArray _verletCurrent; - NativeArray _verletNext; - - public IList Warps => throw new NotImplementedException(); - - public IList Cloths => throw new NotImplementedException(); - - struct VerletJob : IJobParallelFor - { - [ReadOnly] public FrameInfo Frame; - - [ReadOnly] public NativeArray Warps; - - - [ReadOnly] public NativeArray Particles; - [ReadOnly] public NativeArray PrevPositionsInCenter; - [ReadOnly] public NativeArray CurrentPositions; - [WriteOnly] public NativeArray NextPositions; - public void Execute(int index) - { - var particle = Particles[index]; - if (particle.ParticleType == ParticleType.Root) - { - // kinematic. not move - NextPositions[index] = CurrentPositions[index]; - } - else - { - var warp = Warps[particle.WarpIndex]; - var velocity = CurrentPositions[index] - warp.Center - PrevPositionsInCenter[index]; - velocity *= 1 - warp.DragForce; - NextPositions[index] = CurrentPositions[index] + - velocity + Frame.Force * Frame.SqDeltaTime; - } - } - } - - /// - /// Warp毎に verlet の結果を拘束する - /// 1. 親子間の距離を一定に保つ - /// 2. 移動を親の回転に変換する - /// - struct LocalRotationConstraintJob : IJobParallelFor - { - [ReadOnly] public NativeArray Warps; - [ReadOnly] public NativeArray Particles; - [NativeDisableParallelForRestriction] public NativeArray Positions; - [NativeDisableParallelForRestriction] public NativeArray Rotations; - - public void Execute(int index) - { - var warp = Warps[index]; - for (int i = warp.Start; i < warp.End; ++i) - { - var particle = Particles[i]; - switch (particle.ParticleType) - { - case ParticleType.Root: - break; - - case ParticleType.Verlet: - if (i + 1 < warp.End) - { - var next = Particles[i + 1]; - if (next.ParentIndex == i) - { - /// 1. 親子間の距離を一定に保つ - Positions[i + 1] = CalcPosition(Positions[i + 1], - Positions[i], next.DistanceFromParent); - // 2. 移動を親の回転に変換する - var rest = Rotations[i] * next.InitRotation; - Rotations[i] = rest * Quaternion.FromToRotation( - // 初期状態 - rest * particle.InitTailLocalPosition, - // 現状 - Positions[i + 1] - Positions[i] - ); - } - } - break; - - case ParticleType.Branch: - { - // TODO - break; - } - } - } - } - - static Vector3 CalcPosition(in Vector3 pos, in Vector3 parent, float distance) - { - return pos + (pos - parent).normalized * distance; - } - } + NativeArray _prevPositionsOnCenter; + NativeArray _currentPositions; + NativeArray _nextPositions; + NativeArray _currentRotations; + NativeArray _nextRotations; void IDisposable.Dispose() { - throw new NotImplementedException(); + if (_transformAccessArray.isCreated) _transformAccessArray.Dispose(); + if (_warps.IsCreated) _warps.Dispose(); + if (_particles.IsCreated) _particles.Dispose(); + if (_prevPositionsOnCenter.IsCreated) _prevPositionsOnCenter.Dispose(); + if (_currentPositions.IsCreated) _currentPositions.Dispose(); + if (_nextPositions.IsCreated) _nextPositions.Dispose(); } - class LocalRotaionConstraintJOb : IJob + async Task IRotateParticleSystem.InitializeAsync(Vrm10Instance vrm, IAwaitCaller awaitCaller) { - public void Execute() - { + _vrm = vrm; + List transforms = new(); + var warps = vrm.GetComponentsInChildren(); + foreach(var warp in warps) + { + } + await awaitCaller.NextFrame(); } - JobHandle Schedule( - in FrameInfo info, + void IRotateParticleSystem.Process(float deltaTime) + { + Schedule( + new FrameInfo(deltaTime, Vector3.zero), + _transformAccessArray + ).Complete(); + } + + /// + /// INIT PROCESS + /// _transformAccessArray + /// 👇 + /// _currentPositions + /// _currentRotations + /// + private JobHandle Schedule( + in FrameInfo frame, TransformAccessArray transformAccessArray ) { JobHandle handle = default; // load transform + handle = new LoadTransformJob + { + CurrentPositions = _currentPositions, + CurrentRotations = _currentRotations, + }.Schedule(_transformAccessArray, handle); // verlet handle = new VerletJob { - }.Schedule(_verletCurrent.Length, 128, handle); + Frame = frame, + Warps = _warps, + Particles = _particles, + PrevPositionsOnCenter = _prevPositionsOnCenter, + CurrentPositions = _currentPositions, + NextPositions = _nextPositions, + }.Schedule(_currentPositions.Length, 128, handle); // local rotation constraint handle = new LocalRotationConstraintJob @@ -187,22 +102,6 @@ namespace RotateParticle.Jobs return handle; } - async Task IRotateParticleSystem.InitializeAsync(Vrm10Instance vrm, IAwaitCaller awaitCaller) - { - _vrm = vrm; - var warps = vrm.GetComponentsInChildren(); - await awaitCaller.NextFrame(); - throw new NotImplementedException(); - } - - void IRotateParticleSystem.Process(float deltaTime) - { - Schedule( - new FrameInfo(deltaTime, Vector3.zero), - _transformAccessArray - ).Complete(); - } - void IRotateParticleSystem.ResetInitialRotation() { throw new NotImplementedException(); @@ -210,7 +109,6 @@ namespace RotateParticle.Jobs void IRotateParticleSystem.DrawGizmos() { - throw new NotImplementedException(); } } } \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Types.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Types.cs new file mode 100644 index 000000000..5cbd214e4 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Types.cs @@ -0,0 +1,148 @@ +using Unity.Collections; +using Unity.Jobs; +using UnityEngine; +using UnityEngine.Jobs; + + +namespace RotateParticle.Jobs +{ + public enum ParticleType + { + // kinematic. not verlet move + Root, + // particle. verlet move + Verlet, + // branch. move same as 1st branch sibling + Branch, + } + + public struct ParticleInfo + { + public ParticleType ParticleType; + public int WarpIndex; + public int ParentIndex; + public float DistanceFromParent; + public Quaternion InitRotation; + public Vector3 InitTailLocalPosition; + } + + public struct WarpInfo + { + public Vector3 Center; + public float DragForce; + public Quaternion ParentRotation; + public int BranchRootIndex; + public int Start; + public int End; + } + + public struct LoadTransformJob : IJobParallelForTransform + { + // [ReadOnly] public NativeArray Particles; + [WriteOnly] public NativeArray CurrentPositions; + [WriteOnly] public NativeArray CurrentRotations; + public void Execute(int index, TransformAccess transform) + { + // TODO: ModelSpace + CurrentPositions[index] = transform.position; + CurrentRotations[index] = transform.rotation; + } + } + + struct VerletJob : IJobParallelFor + { + [ReadOnly] public FrameInfo Frame; + + [ReadOnly] public NativeArray Warps; + + + [ReadOnly] public NativeArray Particles; + [ReadOnly] public NativeArray PrevPositionsOnCenter; + [ReadOnly] public NativeArray CurrentPositions; + [WriteOnly] public NativeArray NextPositions; + public void Execute(int index) + { + var particle = Particles[index]; + if (particle.ParticleType == ParticleType.Root) + { + // kinematic. not move + NextPositions[index] = CurrentPositions[index]; + } + else + { + var warp = Warps[particle.WarpIndex]; + var velocity = CurrentPositions[index] - warp.Center - PrevPositionsOnCenter[index]; + velocity *= 1 - warp.DragForce; + NextPositions[index] = CurrentPositions[index] + + velocity + Frame.Force * Frame.SqDeltaTime; + } + } + } + + /// + /// Warp毎に verlet の結果を拘束する + /// 1. 親子間の距離を一定に保つ + /// 2. 移動を親の回転に変換する + /// + struct LocalRotationConstraintJob : IJobParallelFor + { + [ReadOnly] public NativeArray Warps; + [ReadOnly] public NativeArray Particles; + [NativeDisableParallelForRestriction] public NativeArray Positions; + [NativeDisableParallelForRestriction] public NativeArray Rotations; + + public void Execute(int index) + { + var warp = Warps[index]; + for (int i = warp.Start; i < warp.End; ++i) + { + var particle = Particles[i]; + switch (particle.ParticleType) + { + case ParticleType.Root: + break; + + case ParticleType.Verlet: + if (i + 1 < warp.End) + { + var next = Particles[i + 1]; + if (next.ParentIndex == i) + { + /// 1. 親子間の距離を一定に保つ + Positions[i + 1] = CalcPosition(Positions[i + 1], + Positions[i], next.DistanceFromParent); + // 2. 移動を親の回転に変換する + var rest = Rotations[i] * next.InitRotation; + Rotations[i] = rest * Quaternion.FromToRotation( + // 初期状態 + rest * particle.InitTailLocalPosition, + // 現状 + Positions[i + 1] - Positions[i] + ); + } + } + break; + + case ParticleType.Branch: + { + // TODO + break; + } + } + } + } + + static Vector3 CalcPosition(in Vector3 pos, in Vector3 parent, float distance) + { + return pos + (pos - parent).normalized * distance; + } + } + + class LocalRotaionConstraintJob : IJob + { + public void Execute() + { + + } + } +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Types.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Types.cs.meta new file mode 100644 index 000000000..7c59093ea --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Types.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 139cb8a384ad8c64abc4dcfab37bcaca +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs index 96bd281ea..0a0914ce4 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs @@ -1,4 +1,4 @@ -// #define USE_ROTATEPARTICLE_JOB +#define USE_ROTATEPARTICLE_JOB using System; using System.Threading.Tasks; using UniGLTF; @@ -11,10 +11,7 @@ namespace RotateParticle { public class RotateParticleSpringboneRuntime : IVrm10SpringBoneRuntime { - Vrm10Instance _vrm; Action _onInit; - - IRotateParticleSystem _system; public RotateParticleSpringboneRuntime(Action onInit = null) @@ -24,20 +21,20 @@ namespace RotateParticle public void Dispose() { + if (_system != null) + { + _system.Dispose(); + _system = null; + } } public async Task InitializeAsync(Vrm10Instance vrm, IAwaitCaller awaitCaller) { - _vrm = vrm; if (_onInit != null) { _onInit(vrm); } - // var warps = vrm.GetComponentsInChildren(); - // var cloths = vrm.GetComponentsInChildren(); - // await awaitCaller.NextFrame(); - #if USE_ROTATEPARTICLE_JOB _system = new Jobs.RotateParticleJobSystem(); #else From aba3114c9d97d4a7656e039dc740af2073a7ee2e Mon Sep 17 00:00:00 2001 From: ousttrue Date: Tue, 19 Nov 2024 01:26:06 +0900 Subject: [PATCH 035/113] WIP RotateParticleJobSystem --- .../Runtime/Jobs/RotateParticleJobSystem.cs | 105 +++++++++++++++--- .../RotateParticle/Runtime/Jobs/Types.cs | 99 +++++++++++++---- 2 files changed, 165 insertions(+), 39 deletions(-) diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs index 8fa49e791..2ad234231 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Threading.Tasks; using RotateParticle.Components; using UniGLTF; -using UniGLTF.SpringBoneJobs.Blittables; using Unity.Collections; using Unity.Jobs; using UnityEngine; @@ -17,37 +16,94 @@ namespace RotateParticle.Jobs { Vrm10Instance _vrm; - NativeArray _warps; + NativeArray _warpImmutables; + NativeArray _warpMutables; TransformAccessArray _transformAccessArray; - NativeArray _particles; + NativeArray _particleImmutables; + NativeArray _particleMutables; + NativeArray _prevPositionsOnCenter; NativeArray _currentPositions; NativeArray _nextPositions; - NativeArray _currentRotations; + // NativeArray _currentRotations; NativeArray _nextRotations; + bool _zeroVelocity = true; + void IDisposable.Dispose() { if (_transformAccessArray.isCreated) _transformAccessArray.Dispose(); - if (_warps.IsCreated) _warps.Dispose(); - if (_particles.IsCreated) _particles.Dispose(); + if (_warpImmutables.IsCreated) _warpImmutables.Dispose(); + + if (_warpMutables.IsCreated) _warpMutables.Dispose(); + if (_particleImmutables.IsCreated) _particleImmutables.Dispose(); + if (_particleMutables.IsCreated) _particleMutables.Dispose(); + if (_prevPositionsOnCenter.IsCreated) _prevPositionsOnCenter.Dispose(); if (_currentPositions.IsCreated) _currentPositions.Dispose(); if (_nextPositions.IsCreated) _nextPositions.Dispose(); + // if (_currentRotations.IsCreated) _currentRotations.Dispose(); + if (_nextRotations.IsCreated) _nextRotations.Dispose(); } async Task IRotateParticleSystem.InitializeAsync(Vrm10Instance vrm, IAwaitCaller awaitCaller) { _vrm = vrm; + List warpImmutables = new(); + List warpMutables = new(); + List transforms = new(); - var warps = vrm.GetComponentsInChildren(); - foreach(var warp in warps) + List particleImmutables = new(); + // List particleMutables = new(); + var warpSrcs = vrm.GetComponentsInChildren(); + for (int warpIndex = 0; warpIndex < warpSrcs.Length; ++warpIndex) { - + var warp = warpSrcs[warpIndex]; + warpImmutables.Add(new WarpImmutable + { + + }); + warpMutables.Add(new WarpMutable + { + + }); + + transforms.Add(warp.transform); + particleImmutables.Add(new ParticleImmutable + { + ParticleType = ParticleType.Root, + WarpIndex = warpIndex, + }); + foreach (var particle in warp.Particles) + { + if (particle != null && particle.Transform != null) + { + transforms.Add(particle.Transform); + particleImmutables.Add(new ParticleImmutable + { + // TODO: ParticleType.Branch + ParticleType = ParticleType.Verlet, + WarpIndex = warpIndex, + }); + } + } + await awaitCaller.NextFrame(); } - await awaitCaller.NextFrame(); + + _warpImmutables = new(warpImmutables.ToArray(), Allocator.Persistent); + _warpMutables = new(warpMutables.ToArray(), Allocator.Persistent); + + _transformAccessArray = new TransformAccessArray(transforms.ToArray()); + _particleImmutables = new(particleImmutables.ToArray(), Allocator.Persistent); + _particleMutables = new(transforms.Count, Allocator.Persistent); + + _currentPositions = new(transforms.Count, Allocator.Persistent); + _prevPositionsOnCenter = new(transforms.Count, Allocator.Persistent); + _nextPositions = new(transforms.Count, Allocator.Persistent); + // _currentRotations = new(transforms.Count, Allocator.Persistent); + _nextRotations = new(transforms.Count, Allocator.Persistent); } void IRotateParticleSystem.Process(float deltaTime) @@ -73,31 +129,50 @@ namespace RotateParticle.Jobs JobHandle handle = default; // load transform - handle = new LoadTransformJob + handle = new ReadTransformJob { CurrentPositions = _currentPositions, - CurrentRotations = _currentRotations, + NextRotations = _nextRotations, }.Schedule(_transformAccessArray, handle); // verlet handle = new VerletJob { + ZeroVelocity = _zeroVelocity, Frame = frame, - Warps = _warps, - Particles = _particles, + WarpMutables = _warpMutables, + ParticleImmutables = _particleImmutables, + ParticleMutables = _particleMutables, PrevPositionsOnCenter = _prevPositionsOnCenter, CurrentPositions = _currentPositions, NextPositions = _nextPositions, }.Schedule(_currentPositions.Length, 128, handle); + _zeroVelocity = false; // local rotation constraint handle = new LocalRotationConstraintJob { - }.Schedule(_warps.Length, 1, handle); + WarpImmutables = _warpImmutables, + ParticleImmutables = _particleImmutables, + Positions = _nextPositions, + Rotations = _nextRotations, + }.Schedule(_warpImmutables.Length, 1, handle); // update verlet + handle = new VerletStatusJob + { + WarpImmutables = _warpImmutables, + WarpMutables = _warpMutables, + CurrentPositions = _currentPositions, + PrevPositionsOnCenter = _prevPositionsOnCenter, + }.Schedule(_warpImmutables.Length, 1, handle); // writeback transform + handle = new WritebackTransformJob + { + NextPositions = _nextPositions, + NextRotations = _nextRotations, + }.Schedule(_transformAccessArray, handle); return handle; } diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Types.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Types.cs index 5cbd214e4..ad3a37edc 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Types.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Types.cs @@ -16,7 +16,11 @@ namespace RotateParticle.Jobs Branch, } - public struct ParticleInfo + + /// + /// Reconstruct されるまで不変 + /// + public struct ParticleImmutable { public ParticleType ParticleType; public int WarpIndex; @@ -26,43 +30,77 @@ namespace RotateParticle.Jobs public Vector3 InitTailLocalPosition; } - public struct WarpInfo + /// + /// 毎フレーム変化するかもしれない + /// + public struct ParticleMutable { - public Vector3 Center; public float DragForce; - public Quaternion ParentRotation; + } + + /// + /// Reconstruct されるまで不変 + /// + public struct WarpImmutable + { + public int ParentIndex; public int BranchRootIndex; public int Start; public int End; } - public struct LoadTransformJob : IJobParallelForTransform + /// + /// 毎フレーム変化するかもしれない + /// + public struct WarpMutable + { + /// + /// center が未指定ならば Vector3.zero + /// + public Vector3 Center; + } + + public struct ReadTransformJob : IJobParallelForTransform { - // [ReadOnly] public NativeArray Particles; [WriteOnly] public NativeArray CurrentPositions; - [WriteOnly] public NativeArray CurrentRotations; + [WriteOnly] public NativeArray NextRotations; public void Execute(int index, TransformAccess transform) { // TODO: ModelSpace CurrentPositions[index] = transform.position; - CurrentRotations[index] = transform.rotation; + NextRotations[index] = transform.rotation; + } + } + + public struct WritebackTransformJob : IJobParallelForTransform + { + [ReadOnly] public NativeArray NextPositions; + [ReadOnly] public NativeArray NextRotations; + public void Execute(int index, TransformAccess transform) + { + // TODO: ModelSpace + transform.position = NextPositions[index]; + transform.rotation = NextRotations[index]; } } struct VerletJob : IJobParallelFor { + public bool ZeroVelocity; [ReadOnly] public FrameInfo Frame; - [ReadOnly] public NativeArray Warps; + // [ReadOnly] public NativeArray WarpImmutables; + [ReadOnly] public NativeArray WarpMutables; - - [ReadOnly] public NativeArray Particles; + [ReadOnly] public NativeArray ParticleImmutables; + [ReadOnly] public NativeArray ParticleMutables; [ReadOnly] public NativeArray PrevPositionsOnCenter; [ReadOnly] public NativeArray CurrentPositions; [WriteOnly] public NativeArray NextPositions; public void Execute(int index) { - var particle = Particles[index]; + var particle = ParticleImmutables[index]; + var particleMutable = ParticleMutables[index]; if (particle.ParticleType == ParticleType.Root) { // kinematic. not move @@ -70,9 +108,12 @@ namespace RotateParticle.Jobs } else { - var warp = Warps[particle.WarpIndex]; - var velocity = CurrentPositions[index] - warp.Center - PrevPositionsOnCenter[index]; - velocity *= 1 - warp.DragForce; + var warp = WarpMutables[particle.WarpIndex]; + var velocity = ZeroVelocity + ? Vector3.zero + : CurrentPositions[index] - warp.Center - PrevPositionsOnCenter[index] + ; + velocity *= 1 - particleMutable.DragForce; NextPositions[index] = CurrentPositions[index] + velocity + Frame.Force * Frame.SqDeltaTime; } @@ -86,17 +127,17 @@ namespace RotateParticle.Jobs /// struct LocalRotationConstraintJob : IJobParallelFor { - [ReadOnly] public NativeArray Warps; - [ReadOnly] public NativeArray Particles; + [ReadOnly] public NativeArray WarpImmutables; + [ReadOnly] public NativeArray ParticleImmutables; [NativeDisableParallelForRestriction] public NativeArray Positions; [NativeDisableParallelForRestriction] public NativeArray Rotations; - public void Execute(int index) + public void Execute(int warpIndex) { - var warp = Warps[index]; + var warp = WarpImmutables[warpIndex]; for (int i = warp.Start; i < warp.End; ++i) { - var particle = Particles[i]; + var particle = ParticleImmutables[i]; switch (particle.ParticleType) { case ParticleType.Root: @@ -105,7 +146,7 @@ namespace RotateParticle.Jobs case ParticleType.Verlet: if (i + 1 < warp.End) { - var next = Particles[i + 1]; + var next = ParticleImmutables[i + 1]; if (next.ParentIndex == i) { /// 1. 親子間の距離を一定に保つ @@ -138,11 +179,21 @@ namespace RotateParticle.Jobs } } - class LocalRotaionConstraintJob : IJob + struct VerletStatusJob : IJobParallelFor { - public void Execute() - { + [ReadOnly] public NativeArray WarpImmutables; + [ReadOnly] public NativeArray WarpMutables; + [ReadOnly] public NativeArray CurrentPositions; + [WriteOnly] public NativeArray PrevPositionsOnCenter; + public void Execute(int warpIndex) + { + var warp = WarpImmutables[warpIndex]; + var warpMutable = WarpMutables[warpIndex]; + for (int i = warp.Start; i < warp.End; ++i) + { + PrevPositionsOnCenter[i] = CurrentPositions[i] - warpMutable.Center; + } } } } \ No newline at end of file From 23ddea2ebe2448c87642a2f74ae01982986f128a Mon Sep 17 00:00:00 2001 From: ousttrue Date: Tue, 19 Nov 2024 22:15:01 +0900 Subject: [PATCH 036/113] WIP parent length constraint --- .../Runtime/Jobs/RotateParticleJobSystem.cs | 274 +++++++++++------- .../RotateParticle/Runtime/Jobs/Types.cs | 199 ------------- .../RotateParticle/Runtime/Jobs/Types.cs.meta | 11 - .../VRM10Viewer/FaceCameraTarget.asset | 1 + 4 files changed, 165 insertions(+), 320 deletions(-) delete mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Types.cs delete mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Types.cs.meta diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs index 2ad234231..5724fa253 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs @@ -16,170 +16,224 @@ namespace RotateParticle.Jobs { Vrm10Instance _vrm; - NativeArray _warpImmutables; - NativeArray _warpMutables; + // [Input] + // center + // rootParent + // root + // + // の入力(jobにわたす) + List _inputTransforms; + TransformAccessArray _inputTransformAccessArray; + public struct InputTransformData + { + public Matrix4x4 ToWorld; + public Matrix4x4 TOLocal; - TransformAccessArray _transformAccessArray; - NativeArray _particleImmutables; - NativeArray _particleMutables; + public InputTransformData(TransformAccess t) + { + ToWorld = t.localToWorldMatrix; + TOLocal = t.worldToLocalMatrix; + } + } + NativeArray _inputData; + public struct InputTransformJob : IJobParallelForTransform + { + [WriteOnly] public NativeArray InputData; + public void Execute(int index, TransformAccess transform) + { + InputData[index] = new InputTransformData(transform); + } + } - NativeArray _prevPositionsOnCenter; - NativeArray _currentPositions; + // [Output] + // root 回転のみ + // particle 回転 + 移動 + // を出力(jobから反映する) + List _outputTransforms; + List _positions; NativeArray _nextPositions; - // NativeArray _currentRotations; - NativeArray _nextRotations; + TransformAccessArray _outputTransformAccessArray; + public struct OutputTransformJob : IJobParallelForTransform + { + [ReadOnly] public NativeArray NextPositions; + public void Execute(int index, TransformAccess transform) + { + transform.position = NextPositions[index]; + } + } - bool _zeroVelocity = true; + public struct ParticleIndo + { + public int InputTransformIndex; + public int? ParentIndex; + public Vector3 InitLocalPosition; + // DragForce: 1 で即時停止 + public float DragForce; + } + NativeArray _particles; + + // [Init/State] + // 初期化時に値を作って毎フレーム更新していく + // output と同じ長さ index + NativeArray _currentPositions; + NativeArray _prevPositions; + public struct VerletJob : IJobParallelFor + { + public FrameInfo Frame; + [WriteOnly] public NativeArray NextPositions; + [ReadOnly] public NativeArray CurrentPositions; + [ReadOnly] public NativeArray PrevPositions; + [ReadOnly] public NativeArray Particles; + + public void Execute(int index) + { + var particle = Particles[index]; + if (particle.ParentIndex.HasValue) + { + var velocity = CurrentPositions[index] - PrevPositions[index]; + velocity *= (1 - particle.DragForce); + var newPosition = CurrentPositions[index] + velocity + Frame.Force * Frame.SqDeltaTime; + + var parentIndex = particle.ParentIndex.Value; + var parentPosition = CurrentPositions[parentIndex]; + + // 位置を長さで拘束 + newPosition = parentPosition + (newPosition - parentPosition).normalized * particle.InitLocalPosition.magnitude; + + NextPositions[index] = newPosition; + } + else + { + // kinematic + NextPositions[index] = CurrentPositions[index]; + } + } + } void IDisposable.Dispose() { - if (_transformAccessArray.isCreated) _transformAccessArray.Dispose(); - if (_warpImmutables.IsCreated) _warpImmutables.Dispose(); - - if (_warpMutables.IsCreated) _warpMutables.Dispose(); - if (_particleImmutables.IsCreated) _particleImmutables.Dispose(); - if (_particleMutables.IsCreated) _particleMutables.Dispose(); - - if (_prevPositionsOnCenter.IsCreated) _prevPositionsOnCenter.Dispose(); - if (_currentPositions.IsCreated) _currentPositions.Dispose(); - if (_nextPositions.IsCreated) _nextPositions.Dispose(); - // if (_currentRotations.IsCreated) _currentRotations.Dispose(); - if (_nextRotations.IsCreated) _nextRotations.Dispose(); } async Task IRotateParticleSystem.InitializeAsync(Vrm10Instance vrm, IAwaitCaller awaitCaller) { _vrm = vrm; - List warpImmutables = new(); - List warpMutables = new(); + _inputTransforms = new(); + _outputTransforms = new(); + _positions = new(); - List transforms = new(); - List particleImmutables = new(); - // List particleMutables = new(); + List particles = new(); var warpSrcs = vrm.GetComponentsInChildren(); for (int warpIndex = 0; warpIndex < warpSrcs.Length; ++warpIndex) { var warp = warpSrcs[warpIndex]; - warpImmutables.Add(new WarpImmutable - { + var inputCenterTransformIndex = GetInputTransformIndex(warp.Center); + var inputWarpRootParentTransformIndex = GetInputTransformIndex(warp.transform.parent); + Debug.Assert(inputWarpRootParentTransformIndex != -1); + var inputWarpRootTransformIndex = GetInputTransformIndex(warp.transform); + Debug.Assert(inputWarpRootParentTransformIndex != -1); - }); - warpMutables.Add(new WarpMutable + var ouputWarpRootTransformIndex = GetOutputTransformIndex(warp.transform); + particles.Add(new ParticleIndo { - - }); - - transforms.Add(warp.transform); - particleImmutables.Add(new ParticleImmutable - { - ParticleType = ParticleType.Root, - WarpIndex = warpIndex, + InputTransformIndex = inputWarpRootTransformIndex, }); + var parentIndex = ouputWarpRootTransformIndex; foreach (var particle in warp.Particles) { if (particle != null && particle.Transform != null) { - transforms.Add(particle.Transform); - particleImmutables.Add(new ParticleImmutable + var outputParticleTransformIndex = GetOutputTransformIndex(particle.Transform); + particles.Add(new ParticleIndo { - // TODO: ParticleType.Branch - ParticleType = ParticleType.Verlet, - WarpIndex = warpIndex, + ParentIndex = parentIndex, + InitLocalPosition = vrm.DefaultTransformStates[particle.Transform].LocalPosition, + DragForce = particle.GetSettings(warp.BaseSettings).DragForce, }); + parentIndex = outputParticleTransformIndex; } } await awaitCaller.NextFrame(); } + _inputTransformAccessArray = new(_inputTransforms.ToArray(), 128); + _inputData = new(_inputTransforms.Count, Allocator.Persistent); - _warpImmutables = new(warpImmutables.ToArray(), Allocator.Persistent); - _warpMutables = new(warpMutables.ToArray(), Allocator.Persistent); + _outputTransformAccessArray = new(_outputTransforms.ToArray(), 128); + var positions = _positions.ToArray(); + _currentPositions = new(positions, Allocator.Persistent); + _prevPositions = new(positions, Allocator.Persistent); + _nextPositions = new(positions, Allocator.Persistent); + _particles = new(particles.ToArray(), Allocator.Persistent); + } - _transformAccessArray = new TransformAccessArray(transforms.ToArray()); - _particleImmutables = new(particleImmutables.ToArray(), Allocator.Persistent); - _particleMutables = new(transforms.Count, Allocator.Persistent); + int GetInputTransformIndex(Transform t) + { + if (t == null) return -1; + var i = _inputTransforms.IndexOf(t); + if (i == -1) + { + i = _inputTransforms.Count; + _inputTransforms.Add(t); + } + return i; + } - _currentPositions = new(transforms.Count, Allocator.Persistent); - _prevPositionsOnCenter = new(transforms.Count, Allocator.Persistent); - _nextPositions = new(transforms.Count, Allocator.Persistent); - // _currentRotations = new(transforms.Count, Allocator.Persistent); - _nextRotations = new(transforms.Count, Allocator.Persistent); + int GetOutputTransformIndex(Transform t) + { + if (t == null) return -1; + var i = _outputTransforms.IndexOf(t); + if (i == -1) + { + i = _outputTransforms.Count; + _outputTransforms.Add(t); + _positions.Add(t.position); + } + return i; } void IRotateParticleSystem.Process(float deltaTime) { - Schedule( - new FrameInfo(deltaTime, Vector3.zero), - _transformAccessArray - ).Complete(); - } + var frame = new FrameInfo(deltaTime, Vector3.zero); - /// - /// INIT PROCESS - /// _transformAccessArray - /// 👇 - /// _currentPositions - /// _currentRotations - /// - private JobHandle Schedule( - in FrameInfo frame, - TransformAccessArray transformAccessArray - ) - { - JobHandle handle = default; - - // load transform - handle = new ReadTransformJob + // input + new InputTransformJob { - CurrentPositions = _currentPositions, - NextRotations = _nextRotations, - }.Schedule(_transformAccessArray, handle); + InputData = _inputData, + }.Schedule(_inputTransformAccessArray, default).Complete(); + + // update root position + for (int i = 0; i < _particles.Length; ++i) + { + var particle = _particles[i]; + if (!particle.ParentIndex.HasValue) + { + _currentPositions[i] = _inputData[particle.InputTransformIndex].ToWorld.GetPosition(); + } + } // verlet - handle = new VerletJob + new VerletJob { - ZeroVelocity = _zeroVelocity, Frame = frame, - WarpMutables = _warpMutables, - ParticleImmutables = _particleImmutables, - ParticleMutables = _particleMutables, - PrevPositionsOnCenter = _prevPositionsOnCenter, + Particles = _particles, + PrevPositions = _prevPositions, CurrentPositions = _currentPositions, NextPositions = _nextPositions, - }.Schedule(_currentPositions.Length, 128, handle); - _zeroVelocity = false; + }.Run(_particles.Length); - // local rotation constraint - handle = new LocalRotationConstraintJob - { - WarpImmutables = _warpImmutables, - ParticleImmutables = _particleImmutables, - Positions = _nextPositions, - Rotations = _nextRotations, - }.Schedule(_warpImmutables.Length, 1, handle); - - // update verlet - handle = new VerletStatusJob - { - WarpImmutables = _warpImmutables, - WarpMutables = _warpMutables, - CurrentPositions = _currentPositions, - PrevPositionsOnCenter = _prevPositionsOnCenter, - }.Schedule(_warpImmutables.Length, 1, handle); - - // writeback transform - handle = new WritebackTransformJob + // output + new OutputTransformJob { NextPositions = _nextPositions, - NextRotations = _nextRotations, - }.Schedule(_transformAccessArray, handle); + }.Schedule(_outputTransformAccessArray, default).Complete(); - return handle; + // update state + NativeArray.Copy(_currentPositions, _prevPositions); + NativeArray.Copy(_nextPositions, _currentPositions); } void IRotateParticleSystem.ResetInitialRotation() { - throw new NotImplementedException(); } void IRotateParticleSystem.DrawGizmos() diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Types.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Types.cs deleted file mode 100644 index ad3a37edc..000000000 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Types.cs +++ /dev/null @@ -1,199 +0,0 @@ -using Unity.Collections; -using Unity.Jobs; -using UnityEngine; -using UnityEngine.Jobs; - - -namespace RotateParticle.Jobs -{ - public enum ParticleType - { - // kinematic. not verlet move - Root, - // particle. verlet move - Verlet, - // branch. move same as 1st branch sibling - Branch, - } - - - /// - /// Reconstruct されるまで不変 - /// - public struct ParticleImmutable - { - public ParticleType ParticleType; - public int WarpIndex; - public int ParentIndex; - public float DistanceFromParent; - public Quaternion InitRotation; - public Vector3 InitTailLocalPosition; - } - - /// - /// 毎フレーム変化するかもしれない - /// - public struct ParticleMutable - { - public float DragForce; - } - - /// - /// Reconstruct されるまで不変 - /// - public struct WarpImmutable - { - public int ParentIndex; - public int BranchRootIndex; - public int Start; - public int End; - } - - /// - /// 毎フレーム変化するかもしれない - /// - public struct WarpMutable - { - /// - /// center が未指定ならば Vector3.zero - /// - public Vector3 Center; - } - - public struct ReadTransformJob : IJobParallelForTransform - { - [WriteOnly] public NativeArray CurrentPositions; - [WriteOnly] public NativeArray NextRotations; - public void Execute(int index, TransformAccess transform) - { - // TODO: ModelSpace - CurrentPositions[index] = transform.position; - NextRotations[index] = transform.rotation; - } - } - - public struct WritebackTransformJob : IJobParallelForTransform - { - [ReadOnly] public NativeArray NextPositions; - [ReadOnly] public NativeArray NextRotations; - public void Execute(int index, TransformAccess transform) - { - // TODO: ModelSpace - transform.position = NextPositions[index]; - transform.rotation = NextRotations[index]; - } - } - - struct VerletJob : IJobParallelFor - { - public bool ZeroVelocity; - [ReadOnly] public FrameInfo Frame; - - // [ReadOnly] public NativeArray WarpImmutables; - [ReadOnly] public NativeArray WarpMutables; - - [ReadOnly] public NativeArray ParticleImmutables; - [ReadOnly] public NativeArray ParticleMutables; - [ReadOnly] public NativeArray PrevPositionsOnCenter; - [ReadOnly] public NativeArray CurrentPositions; - [WriteOnly] public NativeArray NextPositions; - public void Execute(int index) - { - var particle = ParticleImmutables[index]; - var particleMutable = ParticleMutables[index]; - if (particle.ParticleType == ParticleType.Root) - { - // kinematic. not move - NextPositions[index] = CurrentPositions[index]; - } - else - { - var warp = WarpMutables[particle.WarpIndex]; - var velocity = ZeroVelocity - ? Vector3.zero - : CurrentPositions[index] - warp.Center - PrevPositionsOnCenter[index] - ; - velocity *= 1 - particleMutable.DragForce; - NextPositions[index] = CurrentPositions[index] + - velocity + Frame.Force * Frame.SqDeltaTime; - } - } - } - - /// - /// Warp毎に verlet の結果を拘束する - /// 1. 親子間の距離を一定に保つ - /// 2. 移動を親の回転に変換する - /// - struct LocalRotationConstraintJob : IJobParallelFor - { - [ReadOnly] public NativeArray WarpImmutables; - [ReadOnly] public NativeArray ParticleImmutables; - [NativeDisableParallelForRestriction] public NativeArray Positions; - [NativeDisableParallelForRestriction] public NativeArray Rotations; - - public void Execute(int warpIndex) - { - var warp = WarpImmutables[warpIndex]; - for (int i = warp.Start; i < warp.End; ++i) - { - var particle = ParticleImmutables[i]; - switch (particle.ParticleType) - { - case ParticleType.Root: - break; - - case ParticleType.Verlet: - if (i + 1 < warp.End) - { - var next = ParticleImmutables[i + 1]; - if (next.ParentIndex == i) - { - /// 1. 親子間の距離を一定に保つ - Positions[i + 1] = CalcPosition(Positions[i + 1], - Positions[i], next.DistanceFromParent); - // 2. 移動を親の回転に変換する - var rest = Rotations[i] * next.InitRotation; - Rotations[i] = rest * Quaternion.FromToRotation( - // 初期状態 - rest * particle.InitTailLocalPosition, - // 現状 - Positions[i + 1] - Positions[i] - ); - } - } - break; - - case ParticleType.Branch: - { - // TODO - break; - } - } - } - } - - static Vector3 CalcPosition(in Vector3 pos, in Vector3 parent, float distance) - { - return pos + (pos - parent).normalized * distance; - } - } - - struct VerletStatusJob : IJobParallelFor - { - [ReadOnly] public NativeArray WarpImmutables; - [ReadOnly] public NativeArray WarpMutables; - [ReadOnly] public NativeArray CurrentPositions; - [WriteOnly] public NativeArray PrevPositionsOnCenter; - - public void Execute(int warpIndex) - { - var warp = WarpImmutables[warpIndex]; - var warpMutable = WarpMutables[warpIndex]; - for (int i = warp.Start; i < warp.End; ++i) - { - PrevPositionsOnCenter[i] = CurrentPositions[i] - warpMutable.Center; - } - } - } -} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Types.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Types.cs.meta deleted file mode 100644 index 7c59093ea..000000000 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Types.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 139cb8a384ad8c64abc4dcfab37bcaca -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VRM10_Samples/VRM10Viewer/FaceCameraTarget.asset b/Assets/VRM10_Samples/VRM10Viewer/FaceCameraTarget.asset index c1311d8e0..dc5b55f8e 100644 --- a/Assets/VRM10_Samples/VRM10Viewer/FaceCameraTarget.asset +++ b/Assets/VRM10_Samples/VRM10Viewer/FaceCameraTarget.asset @@ -26,6 +26,7 @@ CustomRenderTexture: m_UseDynamicScale: 0 m_BindMS: 0 m_EnableCompatibleFormat: 1 + m_EnableRandomWrite: 0 m_TextureSettings: serializedVersion: 2 m_FilterMode: 1 From 47a22c20d23c87e5826bf717d9062607a5561968 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Wed, 20 Nov 2024 02:40:04 +0900 Subject: [PATCH 037/113] transforms --- .../Runtime/Jobs/RotateParticleJobSystem.cs | 232 +++++++++--------- 1 file changed, 111 insertions(+), 121 deletions(-) diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs index 5724fa253..e69ae7d84 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs @@ -16,61 +16,87 @@ namespace RotateParticle.Jobs { Vrm10Instance _vrm; - // [Input] - // center - // rootParent - // root - // - // の入力(jobにわたす) - List _inputTransforms; - TransformAccessArray _inputTransformAccessArray; - public struct InputTransformData + public enum TransformType { - public Matrix4x4 ToWorld; - public Matrix4x4 TOLocal; - - public InputTransformData(TransformAccess t) - { - ToWorld = t.localToWorldMatrix; - TOLocal = t.worldToLocalMatrix; - } - } - NativeArray _inputData; - public struct InputTransformJob : IJobParallelForTransform - { - [WriteOnly] public NativeArray InputData; - public void Execute(int index, TransformAccess transform) - { - InputData[index] = new InputTransformData(transform); - } + WarpRoot, + Particle, + Center, } - // [Output] - // root 回転のみ - // particle 回転 + 移動 - // を出力(jobから反映する) - List _outputTransforms; - List _positions; - NativeArray _nextPositions; - TransformAccessArray _outputTransformAccessArray; - public struct OutputTransformJob : IJobParallelForTransform + public struct TransformIndo { - [ReadOnly] public NativeArray NextPositions; - public void Execute(int index, TransformAccess transform) - { - transform.position = NextPositions[index]; - } - } - - public struct ParticleIndo - { - public int InputTransformIndex; + public TransformType TransformType; public int? ParentIndex; public Vector3 InitLocalPosition; // DragForce: 1 で即時停止 public float DragForce; } - NativeArray _particles; + + public struct TransformData + { + public Matrix4x4 ToWorld; + public Vector3 Position => ToWorld.GetPosition(); + public Matrix4x4 ToLocal; + + public TransformData(TransformAccess t) + { + ToWorld = t.localToWorldMatrix; + ToLocal = t.worldToLocalMatrix; + } + public TransformData(Transform t) + { + ToWorld = t.localToWorldMatrix; + ToLocal = t.worldToLocalMatrix; + } + } + + // [Input] + List _transforms; + int GetTransformIndex(Transform t, + TransformIndo info, + List infos, + List positions) + { + if (t == null) return -1; + var i = _transforms.IndexOf(t); + if (i == -1) + { + i = _transforms.Count; + _transforms.Add(t); + infos.Add(info); + positions.Add(t.position); + } + return i; + } + + TransformAccessArray _transformAccessArray; + NativeArray _inputData; + public struct InputTransformJob : IJobParallelForTransform + { + [WriteOnly] public NativeArray InputData; + public void Execute(int index, TransformAccess transform) + { + InputData[index] = new TransformData(transform); + } + } + + // [Output] + NativeArray _nextPositions; + public struct OutputTransformJob : IJobParallelForTransform + { + [ReadOnly] public NativeArray Info; + [ReadOnly] public NativeArray NextPositions; + public void Execute(int index, TransformAccess transform) + { + var info = Info[index]; + if (info.TransformType == TransformType.Particle) + { + transform.position = NextPositions[index]; + } + } + } + + NativeArray _info; // [Init/State] // 初期化時に値を作って毎フレーム更新していく @@ -80,32 +106,32 @@ namespace RotateParticle.Jobs public struct VerletJob : IJobParallelFor { public FrameInfo Frame; - [WriteOnly] public NativeArray NextPositions; - [ReadOnly] public NativeArray CurrentPositions; - [ReadOnly] public NativeArray PrevPositions; - [ReadOnly] public NativeArray Particles; + [ReadOnly] public NativeArray Info; + [ReadOnly] public NativeArray Current; + [ReadOnly] public NativeArray Prev; + [WriteOnly] public NativeArray Next; public void Execute(int index) { - var particle = Particles[index]; + var particle = Info[index]; if (particle.ParentIndex.HasValue) { - var velocity = CurrentPositions[index] - PrevPositions[index]; + var velocity = Current[index] - Prev[index]; velocity *= (1 - particle.DragForce); - var newPosition = CurrentPositions[index] + velocity + Frame.Force * Frame.SqDeltaTime; + var newPosition = Current[index] + velocity + Frame.Force * Frame.SqDeltaTime; var parentIndex = particle.ParentIndex.Value; - var parentPosition = CurrentPositions[parentIndex]; + var parentPosition = Current[parentIndex]; // 位置を長さで拘束 newPosition = parentPosition + (newPosition - parentPosition).normalized * particle.InitLocalPosition.magnitude; - NextPositions[index] = newPosition; + Next[index] = newPosition; } else { // kinematic - NextPositions[index] = CurrentPositions[index]; + Next[index] = Current[index]; } } } @@ -117,78 +143,41 @@ namespace RotateParticle.Jobs async Task IRotateParticleSystem.InitializeAsync(Vrm10Instance vrm, IAwaitCaller awaitCaller) { _vrm = vrm; - - _inputTransforms = new(); - _outputTransforms = new(); - _positions = new(); - - List particles = new(); + _transforms = new(); + List info = new(); + List positions = new(); var warpSrcs = vrm.GetComponentsInChildren(); for (int warpIndex = 0; warpIndex < warpSrcs.Length; ++warpIndex) { var warp = warpSrcs[warpIndex]; - var inputCenterTransformIndex = GetInputTransformIndex(warp.Center); - var inputWarpRootParentTransformIndex = GetInputTransformIndex(warp.transform.parent); - Debug.Assert(inputWarpRootParentTransformIndex != -1); - var inputWarpRootTransformIndex = GetInputTransformIndex(warp.transform); - Debug.Assert(inputWarpRootParentTransformIndex != -1); + var centerTransformIndex = GetTransformIndex(warp.Center, new TransformIndo { TransformType = TransformType.Center }, info, positions); + var warpRootTransformIndex = GetTransformIndex(warp.transform, new TransformIndo { TransformType = TransformType.WarpRoot }, info, positions); + Debug.Assert(warpRootTransformIndex != -1); - var ouputWarpRootTransformIndex = GetOutputTransformIndex(warp.transform); - particles.Add(new ParticleIndo - { - InputTransformIndex = inputWarpRootTransformIndex, - }); - var parentIndex = ouputWarpRootTransformIndex; + var parentIndex = warpRootTransformIndex; foreach (var particle in warp.Particles) { if (particle != null && particle.Transform != null) { - var outputParticleTransformIndex = GetOutputTransformIndex(particle.Transform); - particles.Add(new ParticleIndo + var outputParticleTransformIndex = GetTransformIndex(particle.Transform, new TransformIndo { + TransformType = TransformType.Particle, ParentIndex = parentIndex, InitLocalPosition = vrm.DefaultTransformStates[particle.Transform].LocalPosition, DragForce = particle.GetSettings(warp.BaseSettings).DragForce, - }); + }, info, positions); parentIndex = outputParticleTransformIndex; } } await awaitCaller.NextFrame(); } - _inputTransformAccessArray = new(_inputTransforms.ToArray(), 128); - _inputData = new(_inputTransforms.Count, Allocator.Persistent); - - _outputTransformAccessArray = new(_outputTransforms.ToArray(), 128); - var positions = _positions.ToArray(); - _currentPositions = new(positions, Allocator.Persistent); - _prevPositions = new(positions, Allocator.Persistent); - _nextPositions = new(positions, Allocator.Persistent); - _particles = new(particles.ToArray(), Allocator.Persistent); - } - - int GetInputTransformIndex(Transform t) - { - if (t == null) return -1; - var i = _inputTransforms.IndexOf(t); - if (i == -1) - { - i = _inputTransforms.Count; - _inputTransforms.Add(t); - } - return i; - } - - int GetOutputTransformIndex(Transform t) - { - if (t == null) return -1; - var i = _outputTransforms.IndexOf(t); - if (i == -1) - { - i = _outputTransforms.Count; - _outputTransforms.Add(t); - _positions.Add(t.position); - } - return i; + _transformAccessArray = new(_transforms.ToArray(), 128); + _inputData = new(_transforms.Count, Allocator.Persistent); + var pos = positions.ToArray(); + _currentPositions = new(pos, Allocator.Persistent); + _prevPositions = new(pos, Allocator.Persistent); + _nextPositions = new(pos.Length, Allocator.Persistent); + _info = new(info.ToArray(), Allocator.Persistent); } void IRotateParticleSystem.Process(float deltaTime) @@ -199,15 +188,15 @@ namespace RotateParticle.Jobs new InputTransformJob { InputData = _inputData, - }.Schedule(_inputTransformAccessArray, default).Complete(); + }.Schedule(_transformAccessArray, default).Complete(); // update root position - for (int i = 0; i < _particles.Length; ++i) + for (int i = 0; i < _info.Length; ++i) { - var particle = _particles[i]; - if (!particle.ParentIndex.HasValue) + var particle = _info[i]; + if (particle.TransformType == TransformType.WarpRoot) { - _currentPositions[i] = _inputData[particle.InputTransformIndex].ToWorld.GetPosition(); + _currentPositions[i] = _inputData[i].ToWorld.GetPosition(); } } @@ -215,17 +204,18 @@ namespace RotateParticle.Jobs new VerletJob { Frame = frame, - Particles = _particles, - PrevPositions = _prevPositions, - CurrentPositions = _currentPositions, - NextPositions = _nextPositions, - }.Run(_particles.Length); + Info = _info, + Prev = _prevPositions, + Current = _currentPositions, + Next = _nextPositions, + }.Run(_info.Length); // output new OutputTransformJob { + Info = _info, NextPositions = _nextPositions, - }.Schedule(_outputTransformAccessArray, default).Complete(); + }.Schedule(_transformAccessArray, default).Complete(); // update state NativeArray.Copy(_currentPositions, _prevPositions); From c8010a86d6cd10f6969e4509781897213d314ad7 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Wed, 20 Nov 2024 12:31:23 +0900 Subject: [PATCH 038/113] remove not used --- .../Runtime/CollisionGroupMask.cs | 41 ---------- .../Runtime/CollisionGroupMask.cs.meta | 11 --- .../Runtime/ParticleInitState.cs | 5 +- .../RotateParticle/Runtime/ParticleJob.cs | 81 ------------------- .../Runtime/ParticleJob.cs.meta | 11 --- .../RotateParticle/Runtime/ParticleList.cs | 12 +-- .../RotateParticle/Runtime/RotateParticle.cs | 4 +- .../Runtime/RotateParticleSystem.cs | 2 +- .../RotateParticle/Runtime/Strand.cs | 5 +- 9 files changed, 11 insertions(+), 161 deletions(-) delete mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/CollisionGroupMask.cs delete mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/CollisionGroupMask.cs.meta delete mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleJob.cs delete mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleJob.cs.meta diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/CollisionGroupMask.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/CollisionGroupMask.cs deleted file mode 100644 index e2a3204f9..000000000 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/CollisionGroupMask.cs +++ /dev/null @@ -1,41 +0,0 @@ -namespace RotateParticle -{ - [System.Flags] - public enum CollisionGroupMask : uint - { - None = 0, - Group01 = 0x00000001, - Group02 = 0x00000002, - Group03 = 0x00000004, - Group04 = 0x00000008, - Group05 = 0x00000010, - Group06 = 0x00000020, - Group07 = 0x00000040, - Group08 = 0x00000080, - Group09 = 0x00000100, - Group10 = 0x00000200, - Group11 = 0x00000400, - Group12 = 0x00000800, - Group13 = 0x00001000, - Group14 = 0x00002000, - Group15 = 0x00004000, - Group16 = 0x00008000, - Group17 = 0x00010000, - Group18 = 0x00020000, - Group19 = 0x00040000, - Group20 = 0x00080000, - Group21 = 0x00100000, - Group22 = 0x00200000, - Group23 = 0x00400000, - Group24 = 0x00800000, - Group25 = 0x01000000, - Group26 = 0x02000000, - Group27 = 0x04000000, - Group28 = 0x08000000, - Group29 = 0x10000000, - Group30 = 0x20000000, - Group31 = 0x40000000, - Group32 = 0x80000000, - All = uint.MaxValue, - } -} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/CollisionGroupMask.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/CollisionGroupMask.cs.meta deleted file mode 100644 index 8672185ef..000000000 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/CollisionGroupMask.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 7ac7f1d83935aa84b9e80739be4ae02b -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleInitState.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleInitState.cs index 48c2f897b..c83704dc9 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleInitState.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleInitState.cs @@ -27,9 +27,7 @@ namespace RotateParticle // TODO: force / mass => accelaration public float Mass; - public CollisionGroupMask CollisionMask; - - public ParticleInitState(int index, Transform t, float radius, float mass, CollisionGroupMask collisionMask) + public ParticleInitState(int index, Transform t, float radius, float mass) { Index = index; LocalPosition = t.localPosition; @@ -38,7 +36,6 @@ namespace RotateParticle BoneAxis = LocalPosition.normalized; Radius = radius; Mass = mass; - CollisionMask = collisionMask; } public override string ToString() diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleJob.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleJob.cs deleted file mode 100644 index 0b235f0c2..000000000 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleJob.cs +++ /dev/null @@ -1,81 +0,0 @@ -using Unity.Collections; -using Unity.Jobs; -using UnityEngine; - -namespace RotateParticle -{ - public struct ParticleJob : IJob - { - public float DeltaTime; - public float Stiffness; - public float DragForce; - public Vector3 External; - - public int Index; - public int ParentIndex; - - public float Mass; - public Vector3 Rest; - public Vector3 CurrentPosition; - public Vector3 Prev; - - public Quaternion ParentParentRotation; - public Quaternion InitParentLocalRotation; - public Vector3 InitBoneAxis; - public Vector3 ParentPosition; - - public NativeArray NewPos; - public NativeArray NewRot; - - public void Execute() - { - var tr = Step(); - if (tr.HasValue) - { - var (newPos, parentRot) = tr.Value; - NewPos[Index] = newPos; - NewRot[ParentIndex] = parentRot; - } - } - - public (Vector3 NewPos, Quaternion ParentRotation)? Step() - { - if (Mass == 0) - { - return default; - } - - var sqDt = DeltaTime * DeltaTime; - - var f = (Rest - CurrentPosition) * Stiffness / sqDt; - // Debug.Log($"{rest}"); - - f += (External / sqDt); - - var newPos = CurrentPosition + (CurrentPosition - Prev) * (1 - DragForce) + f * sqDt; - - var parentRotation = CalcParentRotation(newPos, ParentParentRotation, InitParentLocalRotation, InitBoneAxis, ParentPosition); - - return (newPos, parentRotation); - } - - public static Quaternion CalcParentRotation(in Vector3 newPos, - in Quaternion parentparent, - in Quaternion initParentLocalRotation, - in Vector3 initBoneAxis, - in Vector3 parentPosition) - { - // 親の回転として結果を適用する(位置から回転を作る) - var restRotation = parentparent * initParentLocalRotation; - var r = CalcRotation(restRotation, initBoneAxis, newPos - parentPosition); - // _runtime = new ParticleRuntimeState(_runtime.CurrentPosition, transform.position); - return r; - } - - static Quaternion CalcRotation(Quaternion restRotation, Vector3 boneAxis, Vector3 to) - { - Quaternion aimRotation = Quaternion.FromToRotation(restRotation * boneAxis, to); - return aimRotation * restRotation; - } - } -} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleJob.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleJob.cs.meta deleted file mode 100644 index 08d8ff997..000000000 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleJob.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 7127f077eba307343a5f5ce15213a595 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleList.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleList.cs index dcf4f91d6..ca09d8c57 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleList.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleList.cs @@ -12,19 +12,19 @@ namespace RotateParticle public List _particles = new(); public List _particleTransforms = new(); - public Strand MakeParticleStrand(SimulationEnv env, Warp warp, CollisionGroupMask mask) + public Strand MakeParticleStrand(SimulationEnv env, Warp warp) { - var strand = new Strand(mask); + var strand = new Strand(); // root kinematic - var particle_index = _MakeAParticle(null, env, warp.transform, 0, 0, strand.CollisionMask); + var particle_index = _MakeAParticle(null, env, warp.transform, 0, 0); var joint = _particles[particle_index]; strand.Particles.Add(joint); foreach (var particle in warp.Particles) { var child_index = _MakeAParticle(joint, env, particle.Transform, - particle.GetSettings(warp.BaseSettings).HitRadius, 1, strand.CollisionMask); + particle.GetSettings(warp.BaseSettings).HitRadius, 1); var child = _particles[child_index]; strand.Particles.Add(child); joint.Children.Add(child); @@ -34,11 +34,11 @@ namespace RotateParticle return strand; } - int _MakeAParticle(RotateParticle parent, SimulationEnv env, Transform t, float radius, float mass, CollisionGroupMask collisionMask) + int _MakeAParticle(RotateParticle parent, SimulationEnv env, Transform t, float radius, float mass) { var index = _particles.Count; _particleTransforms.Add(t); - _particles.Add(new RotateParticle(index, parent, env, t, radius, mass, collisionMask)); + _particles.Add(new RotateParticle(index, parent, env, t, radius, mass)); return index; } diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticle.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticle.cs index b6ddbb481..ae6d21431 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticle.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticle.cs @@ -21,9 +21,9 @@ namespace RotateParticle // 直前で接触があった public bool HasCollide = false; - public RotateParticle(int index, RotateParticle parent, SimulationEnv env, Transform transform, float radius, float mass, CollisionGroupMask collisionMask) + public RotateParticle(int index, RotateParticle parent, SimulationEnv env, Transform transform, float radius, float mass) { - Init = new ParticleInitState(index, transform, radius, mass, collisionMask); + Init = new ParticleInitState(index, transform, radius, mass); State = new ParticleRuntimeState(env, transform); Parent = parent; } diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs index f9626949e..0999150dc 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs @@ -143,7 +143,7 @@ namespace RotateParticle foreach (var warp in warps) { var strands = new List(); - var strand = _list.MakeParticleStrand(Env, warp, default); + var strand = _list.MakeParticleStrand(Env, warp); strands.Add(strand); _strands.AddRange(strands); strandMap.Add(warp, strand); diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Strand.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Strand.cs index a36b1178b..8ba2d991b 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Strand.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Strand.cs @@ -6,11 +6,8 @@ namespace RotateParticle { public class Strand { - public CollisionGroupMask CollisionMask; - - public Strand(CollisionGroupMask mask) + public Strand() { - CollisionMask = mask; } public readonly List Particles = new(); From 1824d2a3b7285742ddb317ec53a838dbb461dda3 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Wed, 20 Nov 2024 14:09:37 +0900 Subject: [PATCH 039/113] basic springbone --- .../RotateParticleRuntimeProvider.cs | 2 +- .../RotateParticle/Runtime/Components/Warp.cs | 43 +-- .../Runtime/Jobs/RotateParticleJobSystem.cs | 267 +++++++++++++----- 3 files changed, 212 insertions(+), 100 deletions(-) diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RotateParticleRuntimeProvider.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RotateParticleRuntimeProvider.cs index 99d3d8cf4..4acceea41 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RotateParticleRuntimeProvider.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RotateParticleRuntimeProvider.cs @@ -69,7 +69,7 @@ namespace RotateParticle.Components DragForce = joint.m_dragForce, GravityDir = joint.m_gravityDir, GravityPower = joint.m_gravityPower, - StiffnessForce = joint.m_stiffnessForce, + Stiffness = joint.m_stiffnessForce, }; if (i == 0) { diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Warp.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Warp.cs index f83bfd4ae..5a3d09599 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Warp.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Warp.cs @@ -11,44 +11,31 @@ namespace RotateParticle.Components public class Warp : MonoBehaviour { [Serializable] - public class ParticleSettings : IEquatable + public struct ParticleSettings { [SerializeField] - public float StiffnessForce = 1.0f; + public float Stiffness; [SerializeField] - public float GravityPower = 0; + public float GravityPower; [SerializeField] - public Vector3 GravityDir = new Vector3(0, -1.0f, 0); + public Vector3 GravityDir; [SerializeField, Range(0, 1)] - public float DragForce = 0.4f; + public float DragForce; [SerializeField] - public float HitRadius = 0.02f; + public float HitRadius; - - public override bool Equals(object obj) // Object.Equals(Object)のオーバーライド + public static ParticleSettings Default => new ParticleSettings { - return Equals(obj as ParticleSettings); - } - - public bool Equals(ParticleSettings other) - { - return - StiffnessForce == other.StiffnessForce - && GravityPower == other.GravityPower - && GravityDir == other.GravityDir - && DragForce == other.DragForce - && HitRadius == other.HitRadius - ; - } - - public override int GetHashCode() - { - return GravityDir.GetHashCode(); - } + Stiffness = 1.0f, + GravityPower = 0, + GravityDir = new Vector3(0, -1.0f, 0), + DragForce = 0.4f, + HitRadius = 0.02f, + }; } /// @@ -58,7 +45,7 @@ namespace RotateParticle.Components public class Particle { public bool useInheritSettings = true; - public ParticleSettings OverrideSettings = new(); + public ParticleSettings OverrideSettings = ParticleSettings.Default; public Transform Transform; public ParticleSettings GetSettings(ParticleSettings baseSettings) @@ -68,7 +55,7 @@ namespace RotateParticle.Components } [SerializeField] - public ParticleSettings BaseSettings = new(); + public ParticleSettings BaseSettings = ParticleSettings.Default; /// /// null のときは world root ではなく model root で処理 diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs index e69ae7d84..fa99ecb7d 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs @@ -12,30 +12,57 @@ using UniVRM10; namespace RotateParticle.Jobs { + public enum TransformType + { + Center, + WarpRootParent, + WarpRoot, + Particle, + } + + public static class TransformTypeExtensions + { + public static bool PositionInput(this TransformType t) + { + return t == TransformType.WarpRoot; + } + + public static bool Movable(this TransformType t) + { + return t == TransformType.Particle; + } + + public static bool Writable(this TransformType t) + { + switch (t) + { + case TransformType.WarpRoot: + case TransformType.Particle: + return true; + default: + return false; + } + } + } + public class RotateParticleJobSystem : IRotateParticleSystem { Vrm10Instance _vrm; - public enum TransformType - { - WarpRoot, - Particle, - Center, - } - - public struct TransformIndo + public struct TransformInfo { public TransformType TransformType; - public int? ParentIndex; + public int ParentIndex; + public Quaternion InitLocalRotation; public Vector3 InitLocalPosition; - // DragForce: 1 で即時停止 - public float DragForce; + public Warp.ParticleSettings Settings; } public struct TransformData { public Matrix4x4 ToWorld; public Vector3 Position => ToWorld.GetPosition(); + public Quaternion Rotation => ToWorld.rotation; public Matrix4x4 ToLocal; public TransformData(TransformAccess t) @@ -50,27 +77,55 @@ namespace RotateParticle.Jobs } } - // [Input] + public struct WarpInfo + { + public int StartIndex; + public int EndIndex; + } + List _transforms; - int GetTransformIndex(Transform t, - TransformIndo info, - List infos, + (int index, bool isNew) GetTransformIndex(Transform t, + TransformInfo info, + List infos, List positions) { - if (t == null) return -1; + Debug.Assert(t != null); var i = _transforms.IndexOf(t); - if (i == -1) + if (i != -1) { - i = _transforms.Count; - _transforms.Add(t); - infos.Add(info); - positions.Add(t.position); + return (i, false); } - return i; + + i = _transforms.Count; + _transforms.Add(t); + infos.Add(info); + positions.Add(t.position); + return (i, true); } + NativeArray _warps; + TransformAccessArray _transformAccessArray; NativeArray _inputData; + NativeArray _info; + NativeArray _currentPositions; + NativeArray _prevPositions; + NativeArray _nextPositions; + NativeArray _nextRotations; + + void IDisposable.Dispose() + { + if (_warps.IsCreated) _warps.Dispose(); + if (_transformAccessArray.isCreated) _transformAccessArray.Dispose(); + if (_inputData.IsCreated) _inputData.Dispose(); + if (_info.IsCreated) _info.Dispose(); + if (_currentPositions.IsCreated) _currentPositions.Dispose(); + if (_prevPositions.IsCreated) _prevPositions.Dispose(); + if (_nextPositions.IsCreated) _nextPositions.Dispose(); + if (_nextRotations.IsCreated) _nextRotations.Dispose(); + } + + // [Input] public struct InputTransformJob : IJobParallelForTransform { [WriteOnly] public NativeArray InputData; @@ -80,103 +135,161 @@ namespace RotateParticle.Jobs } } - // [Output] - NativeArray _nextPositions; - public struct OutputTransformJob : IJobParallelForTransform - { - [ReadOnly] public NativeArray Info; - [ReadOnly] public NativeArray NextPositions; - public void Execute(int index, TransformAccess transform) - { - var info = Info[index]; - if (info.TransformType == TransformType.Particle) - { - transform.position = NextPositions[index]; - } - } - } - - NativeArray _info; - - // [Init/State] - // 初期化時に値を作って毎フレーム更新していく - // output と同じ長さ index - NativeArray _currentPositions; - NativeArray _prevPositions; public struct VerletJob : IJobParallelFor { public FrameInfo Frame; - [ReadOnly] public NativeArray Info; - [ReadOnly] public NativeArray Current; - [ReadOnly] public NativeArray Prev; - [WriteOnly] public NativeArray Next; + [ReadOnly] public NativeArray Info; + [ReadOnly] public NativeArray CurrentTransforms; + [ReadOnly] public NativeArray CurrentPositions; + [ReadOnly] public NativeArray PrevPositions; + [WriteOnly] public NativeArray NextPositions; + [WriteOnly] public NativeArray NextRotations; public void Execute(int index) { var particle = Info[index]; - if (particle.ParentIndex.HasValue) + if (particle.TransformType.Movable()) { - var velocity = Current[index] - Prev[index]; - velocity *= (1 - particle.DragForce); - var newPosition = Current[index] + velocity + Frame.Force * Frame.SqDeltaTime; + var parentIndex = particle.ParentIndex; + var parentPosition = CurrentPositions[parentIndex]; + var parent = Info[parentIndex]; + var parentParentRotation = CurrentTransforms[parent.ParentIndex].Rotation; - var parentIndex = particle.ParentIndex.Value; - var parentPosition = Current[parentIndex]; + var newPosition = CurrentPositions[index] + + (CurrentPositions[index] - PrevPositions[index]) * (1.0f - particle.Settings.DragForce) + + parentParentRotation * parent.InitLocalRotation * particle.InitLocalPosition * + particle.Settings.Stiffness * Frame.DeltaTime // 親の回転による子ボーンの移動目標 + + Frame.Force * Frame.SqDeltaTime + ; // 位置を長さで拘束 newPosition = parentPosition + (newPosition - parentPosition).normalized * particle.InitLocalPosition.magnitude; - Next[index] = newPosition; + NextPositions[index] = newPosition; } else { // kinematic - Next[index] = Current[index]; + NextPositions[index] = CurrentPositions[index]; + } + + NextRotations[index] = CurrentTransforms[index].Rotation; + } + } + + public struct ApplyRotationJob : IJobParallelFor + { + [ReadOnly] public NativeArray Warps; + [ReadOnly] public NativeArray Info; + [ReadOnly] public NativeArray CurrentTransforms; + [ReadOnly] public NativeArray NextPositions; + [NativeDisableParallelForRestriction] public NativeArray NextRotations; + public void Execute(int index) + { + // warp 一本を親から子に再帰的に実行して回転を確定させる + var warp = Warps[index]; + for (int i = warp.StartIndex; i < warp.EndIndex - 1; ++i) + { + //回転を適用 + var p = Info[i]; + var rotation = NextRotations[p.ParentIndex] * Info[i].InitLocalRotation; + NextRotations[i] = Quaternion.FromToRotation( + rotation * Info[i + 1].InitLocalPosition, + NextPositions[i + 1] - NextPositions[i]) * rotation; } } } - void IDisposable.Dispose() + // [Output] + public struct OutputTransformJob : IJobParallelForTransform { + [ReadOnly] public NativeArray Info; + [ReadOnly] public NativeArray NextRotations; + public void Execute(int index, TransformAccess transform) + { + var info = Info[index]; + if (info.TransformType.Writable()) + { + transform.rotation = NextRotations[index]; + } + } } async Task IRotateParticleSystem.InitializeAsync(Vrm10Instance vrm, IAwaitCaller awaitCaller) { _vrm = vrm; _transforms = new(); - List info = new(); + List info = new(); List positions = new(); + List warps = new(); var warpSrcs = vrm.GetComponentsInChildren(); for (int warpIndex = 0; warpIndex < warpSrcs.Length; ++warpIndex) { var warp = warpSrcs[warpIndex]; - var centerTransformIndex = GetTransformIndex(warp.Center, new TransformIndo { TransformType = TransformType.Center }, info, positions); - var warpRootTransformIndex = GetTransformIndex(warp.transform, new TransformIndo { TransformType = TransformType.WarpRoot }, info, positions); - Debug.Assert(warpRootTransformIndex != -1); + var start = _transforms.Count; - var parentIndex = warpRootTransformIndex; + if (warp.Center != null) + { + GetTransformIndex(warp.Center, new TransformInfo + { + TransformType = TransformType.Center + }, info, positions); + start += 1; + } + + var warpRootParentTransformIndex = GetTransformIndex(warp.transform.parent, new TransformInfo + { + TransformType = TransformType.WarpRootParent + }, info, positions); + Debug.Assert(warpRootParentTransformIndex.index != -1); + if (warpRootParentTransformIndex.isNew) + { + start += 1; + } + + var warpRootTransformIndex = GetTransformIndex(warp.transform, new TransformInfo + { + TransformType = TransformType.WarpRoot, + ParentIndex = warpRootParentTransformIndex.index, + InitLocalPosition = vrm.DefaultTransformStates[warp.transform].LocalPosition, + InitLocalRotation = vrm.DefaultTransformStates[warp.transform].LocalRotation, + }, info, positions); + Debug.Assert(warpRootTransformIndex.index != -1); + Debug.Assert(warpRootTransformIndex.isNew); + + var parentIndex = warpRootTransformIndex.index; foreach (var particle in warp.Particles) { if (particle != null && particle.Transform != null) { - var outputParticleTransformIndex = GetTransformIndex(particle.Transform, new TransformIndo + var outputParticleTransformIndex = GetTransformIndex(particle.Transform, new TransformInfo { TransformType = TransformType.Particle, ParentIndex = parentIndex, InitLocalPosition = vrm.DefaultTransformStates[particle.Transform].LocalPosition, - DragForce = particle.GetSettings(warp.BaseSettings).DragForce, + InitLocalRotation = vrm.DefaultTransformStates[particle.Transform].LocalRotation, + Settings = particle.GetSettings(warp.BaseSettings), }, info, positions); - parentIndex = outputParticleTransformIndex; + parentIndex = outputParticleTransformIndex.index; } } + + warps.Add(new WarpInfo + { + StartIndex = start, + EndIndex = _transforms.Count, + }); + await awaitCaller.NextFrame(); } + _warps = new(warps.ToArray(), Allocator.Persistent); _transformAccessArray = new(_transforms.ToArray(), 128); _inputData = new(_transforms.Count, Allocator.Persistent); var pos = positions.ToArray(); _currentPositions = new(pos, Allocator.Persistent); _prevPositions = new(pos, Allocator.Persistent); _nextPositions = new(pos.Length, Allocator.Persistent); + _nextRotations = new(pos.Length, Allocator.Persistent); _info = new(info.ToArray(), Allocator.Persistent); } @@ -194,7 +307,7 @@ namespace RotateParticle.Jobs for (int i = 0; i < _info.Length; ++i) { var particle = _info[i]; - if (particle.TransformType == TransformType.WarpRoot) + if (particle.TransformType.PositionInput()) { _currentPositions[i] = _inputData[i].ToWorld.GetPosition(); } @@ -205,16 +318,28 @@ namespace RotateParticle.Jobs { Frame = frame, Info = _info, - Prev = _prevPositions, - Current = _currentPositions, - Next = _nextPositions, + CurrentTransforms = _inputData, + PrevPositions = _prevPositions, + CurrentPositions = _currentPositions, + NextPositions = _nextPositions, + NextRotations = _nextRotations, }.Run(_info.Length); + // NextPositions から NextRotations を作る + new ApplyRotationJob + { + Warps = _warps, + Info = _info, + CurrentTransforms = _inputData, + NextPositions = _nextPositions, + NextRotations = _nextRotations, + }.Run(_warps.Length); + // output new OutputTransformJob { Info = _info, - NextPositions = _nextPositions, + NextRotations = _nextRotations, }.Schedule(_transformAccessArray, default).Complete(); // update state From fbc4f98f9d374dd9862ed163327676d4215b0ed4 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Wed, 20 Nov 2024 14:46:11 +0900 Subject: [PATCH 040/113] reset, reconstruct --- .../Runtime/Jobs/RotateParticleJobSystem.cs | 17 +++++++++++++++++ .../Runtime/RotateParticleSpringboneRuntime.cs | 14 +++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs index fa99ecb7d..bb509dabe 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs @@ -349,6 +349,23 @@ namespace RotateParticle.Jobs void IRotateParticleSystem.ResetInitialRotation() { + foreach (var warp in _warps) + { + for (int i = warp.StartIndex; i < warp.EndIndex; ++i) + { + var p = _info[i]; + var t = _transforms[i]; + switch (p.TransformType) + { + case TransformType.Particle: + t.localRotation = _vrm.DefaultTransformStates[t].LocalRotation; + _currentPositions[i] = t.position; + _prevPositions[i] = t.position; + _nextPositions[i] = t.position; + break; + } + } + } } void IRotateParticleSystem.DrawGizmos() diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs index 0a0914ce4..7385778fa 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs @@ -11,8 +11,10 @@ namespace RotateParticle { public class RotateParticleSpringboneRuntime : IVrm10SpringBoneRuntime { + Vrm10Instance _vrm; Action _onInit; IRotateParticleSystem _system; + bool _building = false; public RotateParticleSpringboneRuntime(Action onInit = null) { @@ -30,9 +32,12 @@ namespace RotateParticle public async Task InitializeAsync(Vrm10Instance vrm, IAwaitCaller awaitCaller) { + _building = true; + _vrm = vrm; if (_onInit != null) { _onInit(vrm); + _onInit = null; } #if USE_ROTATEPARTICLE_JOB @@ -41,6 +46,8 @@ namespace RotateParticle _system = new RotateParticleSystem(); #endif await _system.InitializeAsync(vrm, awaitCaller); + + _building = false; } public void Process() @@ -51,7 +58,12 @@ namespace RotateParticle public bool ReconstructSpringBone() { - return false; + if (_building) + { + return false; + } + var task = InitializeAsync(_vrm, new ImmediateCaller()); + return true; } public void RestoreInitialTransform() From 3ba6e82329d435b8657ec52d70ee402d2dce85e8 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Wed, 20 Nov 2024 15:24:54 +0900 Subject: [PATCH 041/113] SetJointLevel --- .../ClothSample/ClothViewer/ClothGuess.cs | 4 +- .../ClothViewer/ClothViewer.asmdef | 3 +- .../Editor/RotateParticle.Editor.asmdef | 3 +- .../RotateParticleRuntimeProviderEditor.cs | 5 +++ .../RotateParticle/Editor/WarpEditor.cs | 43 +++++++++++++++++++ .../RotateParticle/Editor/WarpEditor.cs.meta | 11 +++++ .../RotateParticleRuntimeProvider.cs | 14 +++--- .../RotateParticle/Runtime/Components/Warp.cs | 41 ++++++------------ .../Runtime/IRotateParticleSystem.cs | 4 ++ .../Runtime/Jobs/RotateParticleJobSystem.cs | 18 ++++++-- .../RotateParticle/Runtime/ParticleList.cs | 2 +- .../RotateParticleSpringboneRuntime.cs | 13 ++++++ .../Runtime/RotateParticleSystem.cs | 6 +++ 13 files changed, 124 insertions(+), 43 deletions(-) create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/WarpEditor.cs create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/WarpEditor.cs.meta diff --git a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothGuess.cs b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothGuess.cs index c1e18ddeb..590c7029b 100644 --- a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothGuess.cs +++ b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothGuess.cs @@ -140,7 +140,7 @@ namespace UniVRM10.Cloth.Viewer var warp = childchild.gameObject.AddComponent(); // Name = name, // CollisionMask = mask, - warp.BaseSettings.HitRadius = 0.02f; + warp.BaseSettings.radius = 0.02f; warp.AddParticleRecursive(); // Connection = type transforms.Add(warp); @@ -182,7 +182,7 @@ namespace UniVRM10.Cloth.Viewer if (warp != null) { // CollisionMask = mask, - warp.BaseSettings.HitRadius = 0.02f; + warp.BaseSettings.radius = 0.02f; warp.AddParticleRecursive(); // Connection = type transforms.Add(warp); diff --git a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewer.asmdef b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewer.asmdef index 75b04563e..619093ce2 100644 --- a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewer.asmdef +++ b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewer.asmdef @@ -6,7 +6,8 @@ "GUID:8d76e605759c3f64a957d63ef96ada7c", "GUID:1cd941934d098654fa21a13f28346412", "GUID:e47c917724578cc43b5506c17a27e9a0", - "GUID:308b348fb80d89d42a9620951b0f60db" + "GUID:308b348fb80d89d42a9620951b0f60db", + "GUID:3e5d614bc16b50d41bd94c8d7444ca46" ], "includePlatforms": [], "excludePlatforms": [], diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/RotateParticle.Editor.asmdef b/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/RotateParticle.Editor.asmdef index c91fbf05f..cc7849630 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/RotateParticle.Editor.asmdef +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/RotateParticle.Editor.asmdef @@ -3,7 +3,8 @@ "rootNamespace": "", "references": [ "GUID:308b348fb80d89d42a9620951b0f60db", - "GUID:e47c917724578cc43b5506c17a27e9a0" + "GUID:e47c917724578cc43b5506c17a27e9a0", + "GUID:3e5d614bc16b50d41bd94c8d7444ca46" ], "includePlatforms": [], "excludePlatforms": [], diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/RotateParticleRuntimeProviderEditor.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/RotateParticleRuntimeProviderEditor.cs index b730f3bf8..06c722cc4 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/RotateParticleRuntimeProviderEditor.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/RotateParticleRuntimeProviderEditor.cs @@ -57,6 +57,11 @@ namespace RotateParticle.Components } } + if (GUILayout.Button("Reset")) + { + provider.Reset(); + } + base.OnInspectorGUI(); } } diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/WarpEditor.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/WarpEditor.cs new file mode 100644 index 000000000..5d5c60a6b --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/WarpEditor.cs @@ -0,0 +1,43 @@ +using UnityEditor; +using UnityEngine; +using UniVRM10; + +namespace RotateParticle.Components +{ + [CustomEditor(typeof(Warp))] + class WarpEditor : Editor + { + private Warp m_target; + private Vrm10Instance m_vrm; + + void OnEnable() + { + if (target == null) + { + return; + } + m_target = (Warp)target; + m_vrm = m_target.GetComponentInParent(); + } + + public override void OnInspectorGUI() + { + var n = EditorUtility.GetDirtyCount(m_target.GetInstanceID()); + base.OnInspectorGUI(); + if (n != EditorUtility.GetDirtyCount(m_target.GetInstanceID())) + { + if (m_vrm != null) + { + if (Application.isPlaying) + { + m_vrm.Runtime.SpringBone.SetJointLevel(m_target.transform, m_target.BaseSettings); + foreach (var p in m_target.Particles) + { + m_vrm.Runtime.SpringBone.SetJointLevel(p.Transform, p.GetSettings(m_target.BaseSettings)); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/WarpEditor.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/WarpEditor.cs.meta new file mode 100644 index 000000000..df08113d4 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/WarpEditor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ea017d386e4fdee47b8a896571e2a0de +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RotateParticleRuntimeProvider.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RotateParticleRuntimeProvider.cs index 4acceea41..605713fd4 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RotateParticleRuntimeProvider.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RotateParticleRuntimeProvider.cs @@ -64,22 +64,22 @@ namespace RotateParticle.Components for (int i = 0; i < joints.Length; ++i) { var joint = joints[i]; - var settings = new Warp.ParticleSettings + var settings = new UniGLTF.SpringBoneJobs.Blittables.BlittableJointMutable { - DragForce = joint.m_dragForce, - GravityDir = joint.m_gravityDir, - GravityPower = joint.m_gravityPower, - Stiffness = joint.m_stiffnessForce, + dragForce = joint.m_dragForce, + gravityDir = joint.m_gravityDir, + gravityPower = joint.m_gravityPower, + stiffnessForce = joint.m_stiffnessForce, }; if (i == 0) { - settings.HitRadius = joints[0].m_jointRadius; + settings.radius = joints[0].m_jointRadius; warp.BaseSettings = settings; } else { // breaking change from vrm-1.0 - settings.HitRadius = joints[i - 1].m_jointRadius; + settings.radius = joints[i - 1].m_jointRadius; var useInheritSettings = warp.BaseSettings.Equals(settings); warp.Particles.Add(new Warp.Particle { diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Warp.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Warp.cs index 5a3d09599..609ca2bf2 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Warp.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Warp.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using UniGLTF.SpringBoneJobs.Blittables; using UnityEngine; using UniVRM10; @@ -10,31 +11,15 @@ namespace RotateParticle.Components [DisallowMultipleComponent] public class Warp : MonoBehaviour { - [Serializable] - public struct ParticleSettings + public static BlittableJointMutable DefaultSetting() { - [SerializeField] - public float Stiffness; - - [SerializeField] - public float GravityPower; - - [SerializeField] - public Vector3 GravityDir; - - [SerializeField, Range(0, 1)] - public float DragForce; - - [SerializeField] - public float HitRadius; - - public static ParticleSettings Default => new ParticleSettings + return new BlittableJointMutable { - Stiffness = 1.0f, - GravityPower = 0, - GravityDir = new Vector3(0, -1.0f, 0), - DragForce = 0.4f, - HitRadius = 0.02f, + stiffnessForce = 1.0f, + gravityPower = 0, + gravityDir = new Vector3(0, -1.0f, 0), + dragForce = 0.4f, + radius = 0.02f, }; } @@ -45,17 +30,17 @@ namespace RotateParticle.Components public class Particle { public bool useInheritSettings = true; - public ParticleSettings OverrideSettings = ParticleSettings.Default; + public BlittableJointMutable OverrideSettings = DefaultSetting(); public Transform Transform; - public ParticleSettings GetSettings(ParticleSettings baseSettings) + public BlittableJointMutable GetSettings(BlittableJointMutable baseSettings) { return useInheritSettings ? baseSettings : OverrideSettings; } } [SerializeField] - public ParticleSettings BaseSettings = ParticleSettings.Default; + public BlittableJointMutable BaseSettings = DefaultSetting(); /// /// null のときは world root ではなく model root で処理 @@ -110,14 +95,14 @@ namespace RotateParticle.Components public void OnDrawGizmosSelected() { - Gizmos.DrawSphere(transform.position, BaseSettings.HitRadius); + Gizmos.DrawSphere(transform.position, BaseSettings.radius); Transform prev = transform; foreach (var p in Particles) { if (p != null && p.Transform != null) { - Gizmos.DrawWireSphere(p.Transform.position, p.GetSettings(BaseSettings).HitRadius); + Gizmos.DrawWireSphere(p.Transform.position, p.GetSettings(BaseSettings).radius); if (prev != null) { diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/IRotateParticleSystem.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/IRotateParticleSystem.cs index 962b5e8e0..e3a9de42c 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/IRotateParticleSystem.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/IRotateParticleSystem.cs @@ -1,6 +1,8 @@ using System; using System.Threading.Tasks; using UniGLTF; +using UniGLTF.SpringBoneJobs.Blittables; +using UnityEngine; using UniVRM10; namespace RotateParticle @@ -11,5 +13,7 @@ namespace RotateParticle void Process(float deltaTime); void ResetInitialRotation(); void DrawGizmos(); + + void SetJointLevel(Transform joint, BlittableJointMutable jointSettings); } } \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs index bb509dabe..a312ee5c4 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Threading.Tasks; using RotateParticle.Components; using UniGLTF; +using UniGLTF.SpringBoneJobs.Blittables; using Unity.Collections; using Unity.Jobs; using UnityEngine; @@ -55,7 +56,7 @@ namespace RotateParticle.Jobs public int ParentIndex; public Quaternion InitLocalRotation; public Vector3 InitLocalPosition; - public Warp.ParticleSettings Settings; + public BlittableJointMutable Settings; } public struct TransformData @@ -156,9 +157,9 @@ namespace RotateParticle.Jobs var parentParentRotation = CurrentTransforms[parent.ParentIndex].Rotation; var newPosition = CurrentPositions[index] - + (CurrentPositions[index] - PrevPositions[index]) * (1.0f - particle.Settings.DragForce) + + (CurrentPositions[index] - PrevPositions[index]) * (1.0f - particle.Settings.dragForce) + parentParentRotation * parent.InitLocalRotation * particle.InitLocalPosition * - particle.Settings.Stiffness * Frame.DeltaTime // 親の回転による子ボーンの移動目標 + particle.Settings.stiffnessForce * Frame.DeltaTime // 親の回転による子ボーンの移動目標 + Frame.Force * Frame.SqDeltaTime ; @@ -371,5 +372,16 @@ namespace RotateParticle.Jobs void IRotateParticleSystem.DrawGizmos() { } + + public void SetJointLevel(Transform joint, BlittableJointMutable jointSettings) + { + var i = _transforms.IndexOf(joint); + if (i != -1) + { + var info = _info[i]; + info.Settings = jointSettings; + _info[i] = info; + } + } } } \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleList.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleList.cs index ca09d8c57..4b4e951e4 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleList.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleList.cs @@ -24,7 +24,7 @@ namespace RotateParticle foreach (var particle in warp.Particles) { var child_index = _MakeAParticle(joint, env, particle.Transform, - particle.GetSettings(warp.BaseSettings).HitRadius, 1); + particle.GetSettings(warp.BaseSettings).radius, 1); var child = _particles[child_index]; strand.Particles.Add(child); joint.Children.Add(child); diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs index 7385778fa..825760b8e 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs @@ -34,6 +34,12 @@ namespace RotateParticle { _building = true; _vrm = vrm; + + if (_system != null) + { + _system.Dispose(); + } + if (_onInit != null) { _onInit(vrm); @@ -58,6 +64,10 @@ namespace RotateParticle public bool ReconstructSpringBone() { + if (_vrm == null) + { + return false; + } if (_building) { return false; @@ -74,10 +84,13 @@ namespace RotateParticle public void SetJointLevel(Transform joint, BlittableJointMutable jointSettings) { + if (_system == null) return; + _system.SetJointLevel(joint, jointSettings); } public void SetModelLevel(Transform modelRoot, BlittableModelLevel modelSettings) { + if (_system == null) return; } public void DrawGizmos() diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs index 0999150dc..2b1bcdc6b 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs @@ -5,6 +5,7 @@ using System.Threading.Tasks; using RotateParticle.Components; using SphereTriangle; using UniGLTF; +using UniGLTF.SpringBoneJobs.Blittables; using UnityEngine; using UniVRM10; @@ -438,5 +439,10 @@ namespace RotateParticle _newPos.DrawGizmos(); } } + + public void SetJointLevel(Transform joint, BlittableJointMutable jointSettings) + { + throw new NotImplementedException(); + } } } \ No newline at end of file From 716283dcc0bc6df3743c64f2e7bcadfee98e141c Mon Sep 17 00:00:00 2001 From: ousttrue Date: Wed, 20 Nov 2024 15:34:17 +0900 Subject: [PATCH 042/113] external --- .../RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs index a312ee5c4..afa878002 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs @@ -156,11 +156,13 @@ namespace RotateParticle.Jobs var parent = Info[parentIndex]; var parentParentRotation = CurrentTransforms[parent.ParentIndex].Rotation; + var external = (particle.Settings.gravityDir * particle.Settings.gravityPower + Frame.Force) * Frame.DeltaTime; + var newPosition = CurrentPositions[index] + (CurrentPositions[index] - PrevPositions[index]) * (1.0f - particle.Settings.dragForce) + parentParentRotation * parent.InitLocalRotation * particle.InitLocalPosition * particle.Settings.stiffnessForce * Frame.DeltaTime // 親の回転による子ボーンの移動目標 - + Frame.Force * Frame.SqDeltaTime + + external ; // 位置を長さで拘束 From af24f798e5d20de2d6abb00561a8321adfff3ad0 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Wed, 20 Nov 2024 15:46:40 +0900 Subject: [PATCH 043/113] stiffnessForce --- .../Runtime/Components/RotateParticleRuntimeProvider.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RotateParticleRuntimeProvider.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RotateParticleRuntimeProvider.cs index 605713fd4..b36eb5a34 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RotateParticleRuntimeProvider.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RotateParticleRuntimeProvider.cs @@ -69,7 +69,8 @@ namespace RotateParticle.Components dragForce = joint.m_dragForce, gravityDir = joint.m_gravityDir, gravityPower = joint.m_gravityPower, - stiffnessForce = joint.m_stiffnessForce, + // mod + stiffnessForce = joint.m_stiffnessForce * 6, }; if (i == 0) { From d6bd6b53458de4e61f6c225008a895d026d718aa Mon Sep 17 00:00:00 2001 From: ousttrue Date: Wed, 20 Nov 2024 16:40:35 +0900 Subject: [PATCH 044/113] schedule --- .../Runtime/Jobs/RotateParticleJobSystem.cs | 58 +++++++++++++------ 1 file changed, 40 insertions(+), 18 deletions(-) diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs index afa878002..2736cb012 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs @@ -129,10 +129,19 @@ namespace RotateParticle.Jobs // [Input] public struct InputTransformJob : IJobParallelForTransform { + [ReadOnly] public NativeArray Info; [WriteOnly] public NativeArray InputData; + [WriteOnly] public NativeArray CurrentPositions; public void Execute(int index, TransformAccess transform) { InputData[index] = new TransformData(transform); + + var particle = Info[index]; + if (particle.TransformType.PositionInput()) + { + // only warp root position update + CurrentPositions[index] = transform.position; + } } } @@ -301,23 +310,15 @@ namespace RotateParticle.Jobs var frame = new FrameInfo(deltaTime, Vector3.zero); // input - new InputTransformJob + var handle = new InputTransformJob { + Info = _info, InputData = _inputData, - }.Schedule(_transformAccessArray, default).Complete(); - - // update root position - for (int i = 0; i < _info.Length; ++i) - { - var particle = _info[i]; - if (particle.TransformType.PositionInput()) - { - _currentPositions[i] = _inputData[i].ToWorld.GetPosition(); - } - } + CurrentPositions = _currentPositions, + }.Schedule(_transformAccessArray, default); // verlet - new VerletJob + handle = new VerletJob { Frame = frame, Info = _info, @@ -326,24 +327,26 @@ namespace RotateParticle.Jobs CurrentPositions = _currentPositions, NextPositions = _nextPositions, NextRotations = _nextRotations, - }.Run(_info.Length); + }.Schedule(_info.Length, 128, handle); // NextPositions から NextRotations を作る - new ApplyRotationJob + handle = new ApplyRotationJob { Warps = _warps, Info = _info, CurrentTransforms = _inputData, NextPositions = _nextPositions, NextRotations = _nextRotations, - }.Run(_warps.Length); + }.Schedule(_warps.Length, 1, handle); // output - new OutputTransformJob + handle = new OutputTransformJob { Info = _info, NextRotations = _nextRotations, - }.Schedule(_transformAccessArray, default).Complete(); + }.Schedule(_transformAccessArray, handle); + + handle.Complete(); // update state NativeArray.Copy(_currentPositions, _prevPositions); @@ -373,6 +376,25 @@ namespace RotateParticle.Jobs void IRotateParticleSystem.DrawGizmos() { + for (int i = 0; i < _info.Length; ++i) + { + var info = _info[i]; + var v = _currentPositions[i]; + switch (info.TransformType) + { + case TransformType.Center: + case TransformType.WarpRootParent: + break; + case TransformType.WarpRoot: + Gizmos.color = Color.white; + Gizmos.DrawSphere(v, info.Settings.radius); + break; + case TransformType.Particle: + Gizmos.color = Color.cyan; + Gizmos.DrawWireSphere(v, info.Settings.radius); + break; + } + } } public void SetJointLevel(Transform joint, BlittableJointMutable jointSettings) From b577c3bb9f1402236e91cb06889acb1f6a330e1c Mon Sep 17 00:00:00 2001 From: ousttrue Date: Wed, 20 Nov 2024 17:12:18 +0900 Subject: [PATCH 045/113] WIP collider --- .../Runtime/Jobs/RotateParticleJobSystem.cs | 280 ++++++------------ .../RotateParticle/Runtime/Jobs/Types.cs | 221 ++++++++++++++ .../RotateParticle/Runtime/Jobs/Types.cs.meta | 11 + 3 files changed, 321 insertions(+), 191 deletions(-) create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Types.cs create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Types.cs.meta diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs index 2736cb012..ecaadbeda 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs @@ -13,78 +13,41 @@ using UniVRM10; namespace RotateParticle.Jobs { - public enum TransformType - { - Center, - WarpRootParent, - WarpRoot, - Particle, - } - - public static class TransformTypeExtensions - { - public static bool PositionInput(this TransformType t) - { - return t == TransformType.WarpRoot; - } - - public static bool Movable(this TransformType t) - { - return t == TransformType.Particle; - } - - public static bool Writable(this TransformType t) - { - switch (t) - { - case TransformType.WarpRoot: - case TransformType.Particle: - return true; - default: - return false; - } - } - } - public class RotateParticleJobSystem : IRotateParticleSystem { Vrm10Instance _vrm; - public struct TransformInfo - { - public TransformType TransformType; - public int ParentIndex; - public Quaternion InitLocalRotation; - public Vector3 InitLocalPosition; - public BlittableJointMutable Settings; - } - - public struct TransformData - { - public Matrix4x4 ToWorld; - public Vector3 Position => ToWorld.GetPosition(); - public Quaternion Rotation => ToWorld.rotation; - public Matrix4x4 ToLocal; - - public TransformData(TransformAccess t) - { - ToWorld = t.localToWorldMatrix; - ToLocal = t.worldToLocalMatrix; - } - public TransformData(Transform t) - { - ToWorld = t.localToWorldMatrix; - ToLocal = t.worldToLocalMatrix; - } - } - - public struct WarpInfo - { - public int StartIndex; - public int EndIndex; - } + List _colliderTransforms; + TransformAccessArray _colliderTransformAccessArray; + NativeArray _currentColliders; + NativeArray _colliders; List _transforms; + TransformAccessArray _transformAccessArray; + NativeArray _inputData; + NativeArray _info; + NativeArray _currentPositions; + NativeArray _prevPositions; + NativeArray _nextPositions; + NativeArray _nextRotations; + + NativeArray _warps; + + void IDisposable.Dispose() + { + if (_colliderTransformAccessArray.isCreated) _colliderTransformAccessArray.Dispose(); + if (_currentColliders.IsCreated) _currentColliders.Dispose(); + + if (_warps.IsCreated) _warps.Dispose(); + if (_transformAccessArray.isCreated) _transformAccessArray.Dispose(); + if (_inputData.IsCreated) _inputData.Dispose(); + if (_info.IsCreated) _info.Dispose(); + if (_currentPositions.IsCreated) _currentPositions.Dispose(); + if (_prevPositions.IsCreated) _prevPositions.Dispose(); + if (_nextPositions.IsCreated) _nextPositions.Dispose(); + if (_nextRotations.IsCreated) _nextRotations.Dispose(); + } + (int index, bool isNew) GetTransformIndex(Transform t, TransformInfo info, List infos, @@ -104,132 +67,33 @@ namespace RotateParticle.Jobs return (i, true); } - NativeArray _warps; - - TransformAccessArray _transformAccessArray; - NativeArray _inputData; - NativeArray _info; - NativeArray _currentPositions; - NativeArray _prevPositions; - NativeArray _nextPositions; - NativeArray _nextRotations; - - void IDisposable.Dispose() - { - if (_warps.IsCreated) _warps.Dispose(); - if (_transformAccessArray.isCreated) _transformAccessArray.Dispose(); - if (_inputData.IsCreated) _inputData.Dispose(); - if (_info.IsCreated) _info.Dispose(); - if (_currentPositions.IsCreated) _currentPositions.Dispose(); - if (_prevPositions.IsCreated) _prevPositions.Dispose(); - if (_nextPositions.IsCreated) _nextPositions.Dispose(); - if (_nextRotations.IsCreated) _nextRotations.Dispose(); - } - - // [Input] - public struct InputTransformJob : IJobParallelForTransform - { - [ReadOnly] public NativeArray Info; - [WriteOnly] public NativeArray InputData; - [WriteOnly] public NativeArray CurrentPositions; - public void Execute(int index, TransformAccess transform) - { - InputData[index] = new TransformData(transform); - - var particle = Info[index]; - if (particle.TransformType.PositionInput()) - { - // only warp root position update - CurrentPositions[index] = transform.position; - } - } - } - - public struct VerletJob : IJobParallelFor - { - public FrameInfo Frame; - [ReadOnly] public NativeArray Info; - [ReadOnly] public NativeArray CurrentTransforms; - [ReadOnly] public NativeArray CurrentPositions; - [ReadOnly] public NativeArray PrevPositions; - [WriteOnly] public NativeArray NextPositions; - [WriteOnly] public NativeArray NextRotations; - - public void Execute(int index) - { - var particle = Info[index]; - if (particle.TransformType.Movable()) - { - var parentIndex = particle.ParentIndex; - var parentPosition = CurrentPositions[parentIndex]; - var parent = Info[parentIndex]; - var parentParentRotation = CurrentTransforms[parent.ParentIndex].Rotation; - - var external = (particle.Settings.gravityDir * particle.Settings.gravityPower + Frame.Force) * Frame.DeltaTime; - - var newPosition = CurrentPositions[index] - + (CurrentPositions[index] - PrevPositions[index]) * (1.0f - particle.Settings.dragForce) - + parentParentRotation * parent.InitLocalRotation * particle.InitLocalPosition * - particle.Settings.stiffnessForce * Frame.DeltaTime // 親の回転による子ボーンの移動目標 - + external - ; - - // 位置を長さで拘束 - newPosition = parentPosition + (newPosition - parentPosition).normalized * particle.InitLocalPosition.magnitude; - - NextPositions[index] = newPosition; - } - else - { - // kinematic - NextPositions[index] = CurrentPositions[index]; - } - - NextRotations[index] = CurrentTransforms[index].Rotation; - } - } - - public struct ApplyRotationJob : IJobParallelFor - { - [ReadOnly] public NativeArray Warps; - [ReadOnly] public NativeArray Info; - [ReadOnly] public NativeArray CurrentTransforms; - [ReadOnly] public NativeArray NextPositions; - [NativeDisableParallelForRestriction] public NativeArray NextRotations; - public void Execute(int index) - { - // warp 一本を親から子に再帰的に実行して回転を確定させる - var warp = Warps[index]; - for (int i = warp.StartIndex; i < warp.EndIndex - 1; ++i) - { - //回転を適用 - var p = Info[i]; - var rotation = NextRotations[p.ParentIndex] * Info[i].InitLocalRotation; - NextRotations[i] = Quaternion.FromToRotation( - rotation * Info[i + 1].InitLocalPosition, - NextPositions[i + 1] - NextPositions[i]) * rotation; - } - } - } - - // [Output] - public struct OutputTransformJob : IJobParallelForTransform - { - [ReadOnly] public NativeArray Info; - [ReadOnly] public NativeArray NextRotations; - public void Execute(int index, TransformAccess transform) - { - var info = Info[index]; - if (info.TransformType.Writable()) - { - transform.rotation = NextRotations[index]; - } - } - } - async Task IRotateParticleSystem.InitializeAsync(Vrm10Instance vrm, IAwaitCaller awaitCaller) { _vrm = vrm; + + // + // colliders + // + _colliderTransforms = new(); + List colliders = new(); + foreach (var collider in vrm.GetComponentsInChildren()) + { + colliders.Add(new BlittableCollider + { + offset = collider.Offset, + radius = collider.Radius, + tailOrNormal = collider.TailOrNormal, + colliderType = TranslateColliderType(collider.ColliderType) + }); + _colliderTransforms.Add(collider.transform); + } + _colliderTransformAccessArray = new(_colliderTransforms.ToArray(), 128); + _colliders = new(colliders.ToArray(), Allocator.Persistent); + _currentColliders = new(_colliderTransforms.Count, Allocator.Persistent); + + // + // warps + // _transforms = new(); List info = new(); List positions = new(); @@ -305,17 +169,43 @@ namespace RotateParticle.Jobs _info = new(info.ToArray(), Allocator.Persistent); } + private static BlittableColliderType TranslateColliderType(VRM10SpringBoneColliderTypes colliderType) + { + switch (colliderType) + { + case VRM10SpringBoneColliderTypes.Sphere: + return BlittableColliderType.Sphere; + case VRM10SpringBoneColliderTypes.Capsule: + return BlittableColliderType.Capsule; + case VRM10SpringBoneColliderTypes.Plane: + return BlittableColliderType.Plane; + case VRM10SpringBoneColliderTypes.SphereInside: + return BlittableColliderType.SphereInside; + case VRM10SpringBoneColliderTypes.CapsuleInside: + return BlittableColliderType.CapsuleInside; + default: + throw new ArgumentOutOfRangeException(); + } + } + void IRotateParticleSystem.Process(float deltaTime) { var frame = new FrameInfo(deltaTime, Vector3.zero); + JobHandle handle = default; + // input - var handle = new InputTransformJob + handle = new InputColliderJob + { + CurrentCollider = _currentColliders, + }.Schedule(_colliderTransformAccessArray, handle); + + handle = new InputTransformJob { Info = _info, InputData = _inputData, CurrentPositions = _currentPositions, - }.Schedule(_transformAccessArray, default); + }.Schedule(_transformAccessArray, handle); // verlet handle = new VerletJob @@ -329,6 +219,14 @@ namespace RotateParticle.Jobs NextRotations = _nextRotations, }.Schedule(_info.Length, 128, handle); + // collision + handle = new CollisionJob + { + Colliders = _colliders, + CurrentColliders = _currentColliders, + NextPositions = _nextPositions, + }.Schedule(_info.Length, 128, handle); + // NextPositions から NextRotations を作る handle = new ApplyRotationJob { diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Types.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Types.cs new file mode 100644 index 000000000..f81418139 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Types.cs @@ -0,0 +1,221 @@ +using System.Collections; +using System.Collections.Generic; +using UniGLTF.SpringBoneJobs.Blittables; +using Unity.Collections; +using Unity.Jobs; +using UnityEngine; +using UnityEngine.Jobs; + +namespace RotateParticle.Jobs +{ + public enum TransformType + { + Center, + WarpRootParent, + WarpRoot, + Particle, + } + + public static class TransformTypeExtensions + { + public static bool PositionInput(this TransformType t) + { + return t == TransformType.WarpRoot; + } + + public static bool Movable(this TransformType t) + { + return t == TransformType.Particle; + } + + public static bool Writable(this TransformType t) + { + switch (t) + { + case TransformType.WarpRoot: + case TransformType.Particle: + return true; + default: + return false; + } + } + } + + public struct TransformInfo + { + public TransformType TransformType; + public int ParentIndex; + public Quaternion InitLocalRotation; + public Vector3 InitLocalPosition; + public BlittableJointMutable Settings; + } + + public struct TransformData + { + public Matrix4x4 ToWorld; + public Vector3 Position => ToWorld.GetPosition(); + public Quaternion Rotation => ToWorld.rotation; + public Matrix4x4 ToLocal; + + public TransformData(TransformAccess t) + { + ToWorld = t.localToWorldMatrix; + ToLocal = t.worldToLocalMatrix; + } + public TransformData(Transform t) + { + ToWorld = t.localToWorldMatrix; + ToLocal = t.worldToLocalMatrix; + } + } + + public struct WarpInfo + { + public int StartIndex; + public int EndIndex; + } + + // [Input] + public struct InputColliderJob : IJobParallelForTransform + { + [WriteOnly] public NativeArray CurrentCollider; + + public void Execute(int index, TransformAccess transform) + { + CurrentCollider[index] = transform.localToWorldMatrix; + } + } + + public struct InputTransformJob : IJobParallelForTransform + { + [ReadOnly] public NativeArray Info; + [WriteOnly] public NativeArray InputData; + [WriteOnly] public NativeArray CurrentPositions; + public void Execute(int index, TransformAccess transform) + { + InputData[index] = new TransformData(transform); + + var particle = Info[index]; + if (particle.TransformType.PositionInput()) + { + // only warp root position update + CurrentPositions[index] = transform.position; + } + } + } + + public struct VerletJob : IJobParallelFor + { + public FrameInfo Frame; + [ReadOnly] public NativeArray Info; + [ReadOnly] public NativeArray CurrentTransforms; + [ReadOnly] public NativeArray CurrentPositions; + [ReadOnly] public NativeArray PrevPositions; + [WriteOnly] public NativeArray NextPositions; + [WriteOnly] public NativeArray NextRotations; + + public void Execute(int index) + { + var particle = Info[index]; + if (particle.TransformType.Movable()) + { + var parentIndex = particle.ParentIndex; + var parentPosition = CurrentPositions[parentIndex]; + var parent = Info[parentIndex]; + var parentParentRotation = CurrentTransforms[parent.ParentIndex].Rotation; + + var external = (particle.Settings.gravityDir * particle.Settings.gravityPower + Frame.Force) * Frame.DeltaTime; + + var newPosition = CurrentPositions[index] + + (CurrentPositions[index] - PrevPositions[index]) * (1.0f - particle.Settings.dragForce) + + parentParentRotation * parent.InitLocalRotation * particle.InitLocalPosition * + particle.Settings.stiffnessForce * Frame.DeltaTime // 親の回転による子ボーンの移動目標 + + external + ; + + // 位置を長さで拘束 + newPosition = parentPosition + (newPosition - parentPosition).normalized * particle.InitLocalPosition.magnitude; + + NextPositions[index] = newPosition; + } + else + { + // kinematic + NextPositions[index] = CurrentPositions[index]; + } + + NextRotations[index] = CurrentTransforms[index].Rotation; + } + } + + public struct CollisionJob : IJobParallelFor + { + [ReadOnly] public NativeArray Colliders; + [ReadOnly] public NativeArray CurrentColliders; + [WriteOnly] public NativeArray NextPositions; + + public void Execute(int index) + { + for (int i = 0; i < Colliders.Length; ++i) + { + var c = Colliders[i]; + switch (c.colliderType) + { + case BlittableColliderType.Sphere: + break; + + default: + // TODO + break; + } + } + // var d = Vector3.Distance(from, to); + // if (d > (ra + rb)) + // { + // resolved = default; + // return false; + // } + // Vector3 normal = (to - from).normalized; + // resolved = new(from, from + normal * (d - rb)); + // return true; + } + } + + public struct ApplyRotationJob : IJobParallelFor + { + [ReadOnly] public NativeArray Warps; + [ReadOnly] public NativeArray Info; + [ReadOnly] public NativeArray CurrentTransforms; + [ReadOnly] public NativeArray NextPositions; + [NativeDisableParallelForRestriction] public NativeArray NextRotations; + public void Execute(int index) + { + // warp 一本を親から子に再帰的に実行して回転を確定させる + var warp = Warps[index]; + for (int i = warp.StartIndex; i < warp.EndIndex - 1; ++i) + { + //回転を適用 + var p = Info[i]; + var rotation = NextRotations[p.ParentIndex] * Info[i].InitLocalRotation; + NextRotations[i] = Quaternion.FromToRotation( + rotation * Info[i + 1].InitLocalPosition, + NextPositions[i + 1] - NextPositions[i]) * rotation; + } + } + } + + // [Output] + public struct OutputTransformJob : IJobParallelForTransform + { + [ReadOnly] public NativeArray Info; + [ReadOnly] public NativeArray NextRotations; + public void Execute(int index, TransformAccess transform) + { + var info = Info[index]; + if (info.TransformType.Writable()) + { + transform.rotation = NextRotations[index]; + } + } + } +} diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Types.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Types.cs.meta new file mode 100644 index 000000000..7c59093ea --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Types.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 139cb8a384ad8c64abc4dcfab37bcaca +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: From 2100a04284b0202425c30178a142e212e52d376c Mon Sep 17 00:00:00 2001 From: ousttrue Date: Wed, 20 Nov 2024 20:12:37 +0900 Subject: [PATCH 046/113] separate --- .../RotateParticle/Runtime/Jobs/Collision.cs | 52 +++++++++++ .../Runtime/Jobs/Collision.cs.meta | 11 +++ .../Runtime/Jobs/{Types.cs => Particle.cs} | 87 +------------------ .../Runtime/Jobs/Particle.cs.meta | 11 +++ .../Runtime/Jobs/TransformType.cs | 35 ++++++++ .../Runtime/Jobs/TransformType.cs.meta | 11 +++ .../RotateParticle/Runtime/Jobs/Warp.cs | 8 ++ .../Jobs/{Types.cs.meta => Warp.cs.meta} | 0 8 files changed, 130 insertions(+), 85 deletions(-) create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Collision.cs create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Collision.cs.meta rename Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/{Types.cs => Particle.cs} (69%) create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Particle.cs.meta create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/TransformType.cs create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/TransformType.cs.meta create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Warp.cs rename Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/{Types.cs.meta => Warp.cs.meta} (100%) diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Collision.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Collision.cs new file mode 100644 index 000000000..111890ffa --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Collision.cs @@ -0,0 +1,52 @@ +using UniGLTF.SpringBoneJobs.Blittables; +using Unity.Collections; +using Unity.Jobs; +using UnityEngine; +using UnityEngine.Jobs; + + +namespace RotateParticle.Jobs +{ + public struct InputColliderJob : IJobParallelForTransform + { + [WriteOnly] public NativeArray CurrentCollider; + + public void Execute(int index, TransformAccess transform) + { + CurrentCollider[index] = transform.localToWorldMatrix; + } + } + + public struct CollisionJob : IJobParallelFor + { + [ReadOnly] public NativeArray Colliders; + [ReadOnly] public NativeArray CurrentColliders; + [WriteOnly] public NativeArray NextPositions; + + public void Execute(int index) + { + for (int i = 0; i < Colliders.Length; ++i) + { + var c = Colliders[i]; + switch (c.colliderType) + { + case BlittableColliderType.Sphere: + break; + + default: + // TODO + break; + } + } + // var d = Vector3.Distance(from, to); + // if (d > (ra + rb)) + // { + // resolved = default; + // return false; + // } + // Vector3 normal = (to - from).normalized; + // resolved = new(from, from + normal * (d - rb)); + // return true; + } + } +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Collision.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Collision.cs.meta new file mode 100644 index 000000000..46b06c78d --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Collision.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 874e448619fc4d54f900f52f83708a6c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Types.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Particle.cs similarity index 69% rename from Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Types.cs rename to Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Particle.cs index f81418139..38b8d05a3 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Types.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Particle.cs @@ -1,46 +1,12 @@ -using System.Collections; -using System.Collections.Generic; using UniGLTF.SpringBoneJobs.Blittables; using Unity.Collections; using Unity.Jobs; using UnityEngine; using UnityEngine.Jobs; + namespace RotateParticle.Jobs { - public enum TransformType - { - Center, - WarpRootParent, - WarpRoot, - Particle, - } - - public static class TransformTypeExtensions - { - public static bool PositionInput(this TransformType t) - { - return t == TransformType.WarpRoot; - } - - public static bool Movable(this TransformType t) - { - return t == TransformType.Particle; - } - - public static bool Writable(this TransformType t) - { - switch (t) - { - case TransformType.WarpRoot: - case TransformType.Particle: - return true; - default: - return false; - } - } - } - public struct TransformInfo { public TransformType TransformType; @@ -69,23 +35,7 @@ namespace RotateParticle.Jobs } } - public struct WarpInfo - { - public int StartIndex; - public int EndIndex; - } - // [Input] - public struct InputColliderJob : IJobParallelForTransform - { - [WriteOnly] public NativeArray CurrentCollider; - - public void Execute(int index, TransformAccess transform) - { - CurrentCollider[index] = transform.localToWorldMatrix; - } - } - public struct InputTransformJob : IJobParallelForTransform { [ReadOnly] public NativeArray Info; @@ -148,39 +98,6 @@ namespace RotateParticle.Jobs } } - public struct CollisionJob : IJobParallelFor - { - [ReadOnly] public NativeArray Colliders; - [ReadOnly] public NativeArray CurrentColliders; - [WriteOnly] public NativeArray NextPositions; - - public void Execute(int index) - { - for (int i = 0; i < Colliders.Length; ++i) - { - var c = Colliders[i]; - switch (c.colliderType) - { - case BlittableColliderType.Sphere: - break; - - default: - // TODO - break; - } - } - // var d = Vector3.Distance(from, to); - // if (d > (ra + rb)) - // { - // resolved = default; - // return false; - // } - // Vector3 normal = (to - from).normalized; - // resolved = new(from, from + normal * (d - rb)); - // return true; - } - } - public struct ApplyRotationJob : IJobParallelFor { [ReadOnly] public NativeArray Warps; @@ -218,4 +135,4 @@ namespace RotateParticle.Jobs } } } -} +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Particle.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Particle.cs.meta new file mode 100644 index 000000000..9db266542 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Particle.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 69453c7639ad8df4c94cbe3dae50e72c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/TransformType.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/TransformType.cs new file mode 100644 index 000000000..008fcf961 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/TransformType.cs @@ -0,0 +1,35 @@ +namespace RotateParticle.Jobs +{ + public enum TransformType + { + Center, + WarpRootParent, + WarpRoot, + Particle, + } + + public static class TransformTypeExtensions + { + public static bool PositionInput(this TransformType t) + { + return t == TransformType.WarpRoot; + } + + public static bool Movable(this TransformType t) + { + return t == TransformType.Particle; + } + + public static bool Writable(this TransformType t) + { + switch (t) + { + case TransformType.WarpRoot: + case TransformType.Particle: + return true; + default: + return false; + } + } + } +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/TransformType.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/TransformType.cs.meta new file mode 100644 index 000000000..024088d6c --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/TransformType.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 56860caf8e0babc41807521ed55a4f20 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Warp.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Warp.cs new file mode 100644 index 000000000..3d314bfdb --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Warp.cs @@ -0,0 +1,8 @@ +namespace RotateParticle.Jobs +{ + public struct WarpInfo + { + public int StartIndex; + public int EndIndex; + } +} diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Types.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Warp.cs.meta similarity index 100% rename from Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Types.cs.meta rename to Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Warp.cs.meta From 423830cc762b8a6cb16083b69c65717c06a295ea Mon Sep 17 00:00:00 2001 From: ousttrue Date: Wed, 20 Nov 2024 20:42:39 +0900 Subject: [PATCH 047/113] Sphere x Sphere --- .../RotateParticle/Runtime/Jobs/Collision.cs | 25 +++++++++++-------- .../Runtime/Jobs/RotateParticleJobSystem.cs | 3 ++- .../Runtime/RotateParticleSystem.cs | 2 ++ 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Collision.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Collision.cs index 111890ffa..b2e7893c2 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Collision.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Collision.cs @@ -21,16 +21,29 @@ namespace RotateParticle.Jobs { [ReadOnly] public NativeArray Colliders; [ReadOnly] public NativeArray CurrentColliders; - [WriteOnly] public NativeArray NextPositions; + [ReadOnly] public NativeArray Info; + [NativeDisableParallelForRestriction] public NativeArray NextPositions; public void Execute(int index) { + var info = Info[index]; + var pos = NextPositions[index]; for (int i = 0; i < Colliders.Length; ++i) { var c = Colliders[i]; switch (c.colliderType) { case BlittableColliderType.Sphere: + { + var col_pos = CurrentColliders[i].MultiplyPoint(c.offset); + var d = Vector3.Distance(pos, col_pos); + var min_d = info.Settings.radius + c.radius; + if (d < min_d) + { + Vector3 normal = (pos - col_pos).normalized; + pos += normal * (min_d - d); + } + } break; default: @@ -38,15 +51,7 @@ namespace RotateParticle.Jobs break; } } - // var d = Vector3.Distance(from, to); - // if (d > (ra + rb)) - // { - // resolved = default; - // return false; - // } - // Vector3 normal = (to - from).normalized; - // resolved = new(from, from + normal * (d - rb)); - // return true; + NextPositions[index] = pos; } } } \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs index ecaadbeda..ef5fd41b7 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs @@ -222,8 +222,9 @@ namespace RotateParticle.Jobs // collision handle = new CollisionJob { - Colliders = _colliders, + Colliders = _colliders, CurrentColliders = _currentColliders, + Info = _info, NextPositions = _nextPositions, }.Schedule(_info.Length, 128, handle); diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs index 2b1bcdc6b..97ff35657 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs @@ -173,6 +173,8 @@ namespace RotateParticle { c.InitializeColliderSide(_newPos, _colliderGroups); } + + await awaitCaller.NextFrame(); } /// From e2674dda417531b42ebdad8e72075ed3df5b5aa1 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Wed, 20 Nov 2024 20:57:08 +0900 Subject: [PATCH 048/113] ParentLengthConstraintJob --- .../RotateParticle/Runtime/Jobs/Particle.cs | 30 +++++++++++++++---- .../Runtime/Jobs/RotateParticleJobSystem.cs | 10 ++++++- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Particle.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Particle.cs index 38b8d05a3..e64eead76 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Particle.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Particle.cs @@ -83,9 +83,6 @@ namespace RotateParticle.Jobs + external ; - // 位置を長さで拘束 - newPosition = parentPosition + (newPosition - parentPosition).normalized * particle.InitLocalPosition.magnitude; - NextPositions[index] = newPosition; } else @@ -98,16 +95,39 @@ namespace RotateParticle.Jobs } } + /// + /// 親の位置に依存。再帰 + /// + public struct ParentLengthConstraintJob : IJobParallelFor + { + [ReadOnly] public NativeArray Warps; + [ReadOnly] public NativeArray Info; + [NativeDisableParallelForRestriction] public NativeArray NextPositions; + public void Execute(int index) + { + var warp = Warps[index]; + for (int i = warp.StartIndex; i < warp.EndIndex - 1; ++i) + { + // 位置を長さで拘束 + NextPositions[i + 1] = NextPositions[i] + + (NextPositions[i + 1] - NextPositions[i]).normalized + * Info[i + 1].InitLocalPosition.magnitude; + } + } + } + + /// + /// 親の回転に依存。再帰 + /// public struct ApplyRotationJob : IJobParallelFor { [ReadOnly] public NativeArray Warps; [ReadOnly] public NativeArray Info; [ReadOnly] public NativeArray CurrentTransforms; - [ReadOnly] public NativeArray NextPositions; + [NativeDisableParallelForRestriction] public NativeArray NextPositions; [NativeDisableParallelForRestriction] public NativeArray NextRotations; public void Execute(int index) { - // warp 一本を親から子に再帰的に実行して回転を確定させる var warp = Warps[index]; for (int i = warp.StartIndex; i < warp.EndIndex - 1; ++i) { diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs index ef5fd41b7..dca1527fa 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs @@ -219,10 +219,18 @@ namespace RotateParticle.Jobs NextRotations = _nextRotations, }.Schedule(_info.Length, 128, handle); + // 親子の長さで拘束 + handle = new ParentLengthConstraintJob + { + Warps = _warps, + Info = _info, + NextPositions = _nextPositions, + }.Schedule(_warps.Length, 1, handle); + // collision handle = new CollisionJob { - Colliders = _colliders, + Colliders = _colliders, CurrentColliders = _currentColliders, Info = _info, NextPositions = _nextPositions, From 2ad810d27deda03ae53f272ce6c08cf18b7af9b6 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Thu, 21 Nov 2024 02:18:46 +0900 Subject: [PATCH 049/113] VisualElement --- .../RotateParticle/Editor/WarpEditor.cs | 56 +++++++++++++------ .../Runtime/Jobs/RotateParticleJobSystem.cs | 4 +- 2 files changed, 41 insertions(+), 19 deletions(-) diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/WarpEditor.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/WarpEditor.cs index 5d5c60a6b..f0616bc3a 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/WarpEditor.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/WarpEditor.cs @@ -1,5 +1,7 @@ using UnityEditor; +using UnityEditor.UIElements; using UnityEngine; +using UnityEngine.UIElements; using UniVRM10; namespace RotateParticle.Components @@ -20,24 +22,44 @@ namespace RotateParticle.Components m_vrm = m_target.GetComponentInParent(); } - public override void OnInspectorGUI() + // public override void OnInspectorGUI() + // { + // var n = EditorUtility.GetDirtyCount(m_target.GetInstanceID()); + // base.OnInspectorGUI(); + // if (n != EditorUtility.GetDirtyCount(m_target.GetInstanceID())) + // { + // if (m_vrm != null) + // { + // if (Application.isPlaying) + // { + // m_vrm.Runtime.SpringBone.SetJointLevel(m_target.transform, m_target.BaseSettings); + // foreach (var p in m_target.Particles) + // { + // m_vrm.Runtime.SpringBone.SetJointLevel(p.Transform, p.GetSettings(m_target.BaseSettings)); + // } + // } + // } + // } + // } + + public override VisualElement CreateInspectorGUI() { - var n = EditorUtility.GetDirtyCount(m_target.GetInstanceID()); - base.OnInspectorGUI(); - if (n != EditorUtility.GetDirtyCount(m_target.GetInstanceID())) - { - if (m_vrm != null) - { - if (Application.isPlaying) - { - m_vrm.Runtime.SpringBone.SetJointLevel(m_target.transform, m_target.BaseSettings); - foreach (var p in m_target.Particles) - { - m_vrm.Runtime.SpringBone.SetJointLevel(p.Transform, p.GetSettings(m_target.BaseSettings)); - } - } - } - } + var root = new VisualElement(); + + // var container = new IMGUIContainer(OnInspectorGUI); + // root.Add(container); + + root.Bind(serializedObject); + + var s = new PropertyField { bindingPath = "m_Script" }; + s.SetEnabled(false); + root.Add(s); + root.Add(new PropertyField { bindingPath = nameof(Warp.BaseSettings) }); + root.Add(new PropertyField { bindingPath = nameof(Warp.Center) }); + root.Add(new PropertyField { bindingPath = nameof(Warp.Particles) }); + root.Add(new PropertyField { bindingPath = nameof(Warp.ColliderGroups) }); + + return root; } } } \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs index dca1527fa..2f868d2d4 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs @@ -225,7 +225,7 @@ namespace RotateParticle.Jobs Warps = _warps, Info = _info, NextPositions = _nextPositions, - }.Schedule(_warps.Length, 1, handle); + }.Schedule(_warps.Length, 16, handle); // collision handle = new CollisionJob @@ -244,7 +244,7 @@ namespace RotateParticle.Jobs CurrentTransforms = _inputData, NextPositions = _nextPositions, NextRotations = _nextRotations, - }.Schedule(_warps.Length, 1, handle); + }.Schedule(_warps.Length, 16, handle); // output handle = new OutputTransformJob From 77ba330ba5e36ef5a2b72d33d9d0a51533a14d0c Mon Sep 17 00:00:00 2001 From: ousttrue Date: Thu, 21 Nov 2024 10:57:08 +0900 Subject: [PATCH 050/113] WIP table --- .../RotateParticle/Editor/WarpEditor.cs | 73 +++++++++++++++++-- .../RotateParticle/Runtime/Components/Warp.cs | 16 ++++ 2 files changed, 83 insertions(+), 6 deletions(-) diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/WarpEditor.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/WarpEditor.cs index f0616bc3a..8972f31a7 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/WarpEditor.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/WarpEditor.cs @@ -1,3 +1,6 @@ +using System; +using System.Collections.Generic; +using System.Linq; using UnityEditor; using UnityEditor.UIElements; using UnityEngine; @@ -11,6 +14,7 @@ namespace RotateParticle.Components { private Warp m_target; private Vrm10Instance m_vrm; + private Transform[] m_items; void OnEnable() { @@ -18,8 +22,10 @@ namespace RotateParticle.Components { return; } + m_target = (Warp)target; m_vrm = m_target.GetComponentInParent(); + m_items = m_target.GetComponentsInChildren().Skip(1).ToArray(); } // public override void OnInspectorGUI() @@ -46,17 +52,72 @@ namespace RotateParticle.Components { var root = new VisualElement(); - // var container = new IMGUIContainer(OnInspectorGUI); - // root.Add(container); - root.Bind(serializedObject); - var s = new PropertyField { bindingPath = "m_Script" }; - s.SetEnabled(false); - root.Add(s); + { + var s = new PropertyField { bindingPath = "m_Script" }; + s.SetEnabled(false); + root.Add(s); + } root.Add(new PropertyField { bindingPath = nameof(Warp.BaseSettings) }); root.Add(new PropertyField { bindingPath = nameof(Warp.Center) }); + root.Add(new PropertyField { bindingPath = nameof(Warp.Particles) }); + { + + var listview = new MultiColumnListView(); + listview.columns.Add(new Column + { + title = "Transform", + width = 80, + makeCell = () => new ObjectField(), + bindCell = (v, i) => + { + v.SetEnabled(false); + (v as ObjectField).value = m_items[i]; + }, + }); + listview.columns.Add(new Column + { + title = "Mode", + width = 60, + makeCell = () => new EnumField(default(Warp.ParticleMode)), + }); + listview.columns.Add(new Column + { + title = "stiffnessForce", + width = 20, + makeCell = () => new FloatField(), + }); + listview.columns.Add(new Column + { + title = "gravityPower", + width = 20, + makeCell = () => new FloatField(), + }); + listview.columns.Add(new Column + { + title = "gravityDir", + width = 20, + makeCell = () => new Vector3Field(), + }); + listview.columns.Add(new Column + { + title = "dragForce", + width = 20, + makeCell = () => new FloatField(), + }); + listview.columns.Add(new Column + { + title = "radius", + width = 20, + makeCell = () => new FloatField(), + }); + + listview.itemsSource = m_items; + root.Add(listview); + } + root.Add(new PropertyField { bindingPath = nameof(Warp.ColliderGroups) }); return root; diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Warp.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Warp.cs index 609ca2bf2..f7d67a89c 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Warp.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Warp.cs @@ -23,6 +23,22 @@ namespace RotateParticle.Components }; } + public enum ParticleMode + { + /// + /// Use BaseSettings + /// + UseBase, + /// + /// Use specific settings + /// + Override, + /// + /// no animation + /// + Disabled, + } + /// /// VRM10SpringBoneJoint に相当する /// From 335beede4bb38c822db2968f2195ebca67c67471 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Thu, 21 Nov 2024 15:25:00 +0900 Subject: [PATCH 051/113] WarpRoot --- .../ClothSample/ClothViewer/ClothGuess.cs | 14 +- .../ClothSample/ClothViewer/ClothViewerUI.cs | 6 +- .../RotateParticleRuntimeProviderEditor.cs | 2 +- .../{WarpEditor.cs => WarpRootEditor.cs} | 68 ++++-- ...pEditor.cs.meta => WarpRootEditor.cs.meta} | 0 .../Runtime/Components/RectCloth.cs | 84 +++---- .../RotateParticleRuntimeProvider.cs | 20 +- .../RotateParticle/Runtime/Components/Warp.cs | 132 ----------- .../Runtime/Components/WarpRoot.cs | 223 ++++++++++++++++++ .../{Warp.cs.meta => WarpRoot.cs.meta} | 0 .../Runtime/Jobs/RotateParticleJobSystem.cs | 6 +- .../RotateParticle/Runtime/ParticleList.cs | 4 +- .../Runtime/RotateParticleSystem.cs | 8 +- 13 files changed, 338 insertions(+), 229 deletions(-) rename Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/{WarpEditor.cs => WarpRootEditor.cs} (66%) rename Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/{WarpEditor.cs.meta => WarpRootEditor.cs.meta} (100%) delete mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Warp.cs create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/WarpRoot.cs rename Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/{Warp.cs.meta => WarpRoot.cs.meta} (100%) diff --git a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothGuess.cs b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothGuess.cs index 590c7029b..47f210bc4 100644 --- a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothGuess.cs +++ b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothGuess.cs @@ -113,7 +113,7 @@ namespace UniVRM10.Cloth.Viewer static bool TryAddGroupChildChild( Animator animator, HumanBodyBones humanBone, string[] targets, string[] excludes, - out List group) + out List group) { var bone = animator.GetBoneTransform(humanBone); if (bone == null) @@ -123,7 +123,7 @@ namespace UniVRM10.Cloth.Viewer return false; } - List transforms = new(); + List transforms = new(); foreach (Transform child in bone) { foreach (Transform childchild in child) @@ -137,11 +137,10 @@ namespace UniVRM10.Cloth.Viewer { if (childchild.name.ToLower().Contains(target.ToLower())) { - var warp = childchild.gameObject.AddComponent(); + var warp = childchild.gameObject.AddComponent(); // Name = name, // CollisionMask = mask, warp.BaseSettings.radius = 0.02f; - warp.AddParticleRecursive(); // Connection = type transforms.Add(warp); break; @@ -161,7 +160,7 @@ namespace UniVRM10.Cloth.Viewer } static bool TryAddGroup(Animator animator, HumanBodyBones humanBone, string[] targets, - out List group) + out List group) { var bone = animator.GetBoneTransform(humanBone); if (bone == null) @@ -171,19 +170,18 @@ namespace UniVRM10.Cloth.Viewer return false; } - List transforms = new(); + List transforms = new(); foreach (Transform child in bone) { foreach (var target in targets) { if (child.name.ToLower().Contains(target.ToLower())) { - var warp = child.gameObject.AddComponent(); + var warp = child.gameObject.AddComponent(); if (warp != null) { // CollisionMask = mask, warp.BaseSettings.radius = 0.02f; - warp.AddParticleRecursive(); // Connection = type transforms.Add(warp); } diff --git a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewerUI.cs b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewerUI.cs index 310375276..26bfeda76 100644 --- a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewerUI.cs +++ b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewerUI.cs @@ -263,7 +263,6 @@ namespace UniVRM10.Cloth.Viewer Loaded m_loaded; RotateParticle.HumanoidPose m_init; - int m_springFrame = 0; static class ArgumentChecker { @@ -556,7 +555,7 @@ namespace UniVRM10.Cloth.Viewer if (vrm.SpringBone.ColliderGroups.Count == 0) { HumanoidCollider.AddColliders(animator); - var warps = animator.GetComponentsInChildren(); + var warps = animator.GetComponentsInChildren(); var colliderGroups = animator.GetComponentsInChildren(); foreach (var warp in warps) { @@ -567,7 +566,7 @@ namespace UniVRM10.Cloth.Viewer else { RotateParticleRuntimeProvider.FromVrm10(vrm, - go => go.AddComponent(), + go => go.AddComponent(), o => GameObject.DestroyImmediate(o)); } } @@ -613,7 +612,6 @@ namespace UniVRM10.Cloth.Viewer instance.EnableUpdateWhenOffscreen(); m_loaded = new Loaded(instance, m_target.transform); m_init = new RotateParticle.HumanoidPose(vrm10Instance.GetComponent()); - m_springFrame = 0; m_showBoxMan.isOn = false; } catch (Exception ex) diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/RotateParticleRuntimeProviderEditor.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/RotateParticleRuntimeProviderEditor.cs index 06c722cc4..49ba25654 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/RotateParticleRuntimeProviderEditor.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/RotateParticleRuntimeProviderEditor.cs @@ -39,7 +39,7 @@ namespace RotateParticle.Components var undo = Undo.GetCurrentGroup(); Undo.RegisterCompleteObjectUndo(instance, "RegisterCompleteObjectUndo"); - RotateParticleRuntimeProvider.FromVrm10(instance, Undo.AddComponent, Undo.DestroyObjectImmediate); + RotateParticleRuntimeProvider.FromVrm10(instance, Undo.AddComponent, Undo.DestroyObjectImmediate); Undo.RegisterFullObjectHierarchyUndo(instance.gameObject, "RegisterFullObjectHierarchyUndo"); Undo.RegisterCompleteObjectUndo(provider, "RegisterCompleteObjectUndo"); diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/WarpEditor.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/WarpRootEditor.cs similarity index 66% rename from Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/WarpEditor.cs rename to Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/WarpRootEditor.cs index 8972f31a7..173c7b57c 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/WarpEditor.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/WarpRootEditor.cs @@ -9,12 +9,12 @@ using UniVRM10; namespace RotateParticle.Components { - [CustomEditor(typeof(Warp))] - class WarpEditor : Editor + [CustomEditor(typeof(WarpRoot))] + class WarpRootEditor : Editor { - private Warp m_target; + private WarpRoot m_target; private Vrm10Instance m_vrm; - private Transform[] m_items; + private MultiColumnTreeView m_treeview; void OnEnable() { @@ -23,9 +23,8 @@ namespace RotateParticle.Components return; } - m_target = (Warp)target; + m_target = (WarpRoot)target; m_vrm = m_target.GetComponentInParent(); - m_items = m_target.GetComponentsInChildren().Skip(1).ToArray(); } // public override void OnInspectorGUI() @@ -59,68 +58,89 @@ namespace RotateParticle.Components s.SetEnabled(false); root.Add(s); } - root.Add(new PropertyField { bindingPath = nameof(Warp.BaseSettings) }); - root.Add(new PropertyField { bindingPath = nameof(Warp.Center) }); + root.Add(new PropertyField { bindingPath = nameof(WarpRoot.BaseSettings) }); + root.Add(new PropertyField { bindingPath = nameof(WarpRoot.Center) }); - root.Add(new PropertyField { bindingPath = nameof(Warp.Particles) }); + root.Add(new PropertyField { bindingPath = nameof(WarpRoot.Particles) }); { - - var listview = new MultiColumnListView(); - listview.columns.Add(new Column + m_treeview = new MultiColumnTreeView(); + m_treeview.columns.Add(new Column { title = "Transform", - width = 80, + width = 160, makeCell = () => new ObjectField(), bindCell = (v, i) => { v.SetEnabled(false); - (v as ObjectField).value = m_items[i]; + (v as ObjectField).value = m_target.GetParticle(i).Transform; }, }); - listview.columns.Add(new Column + m_treeview.columns.Add(new Column { title = "Mode", width = 60, - makeCell = () => new EnumField(default(Warp.ParticleMode)), + makeCell = () => new EnumField(default(WarpRoot.ParticleMode)), }); - listview.columns.Add(new Column + m_treeview.columns.Add(new Column { title = "stiffnessForce", width = 20, makeCell = () => new FloatField(), }); - listview.columns.Add(new Column + m_treeview.columns.Add(new Column { title = "gravityPower", width = 20, makeCell = () => new FloatField(), }); - listview.columns.Add(new Column + m_treeview.columns.Add(new Column { title = "gravityDir", width = 20, makeCell = () => new Vector3Field(), }); - listview.columns.Add(new Column + m_treeview.columns.Add(new Column { title = "dragForce", width = 20, makeCell = () => new FloatField(), }); - listview.columns.Add(new Column + m_treeview.columns.Add(new Column { title = "radius", width = 20, makeCell = () => new FloatField(), }); - listview.itemsSource = m_items; - root.Add(listview); + m_treeview.autoExpand = true; + m_treeview.SetRootItems(m_target.m_rootitems); + root.Add(m_treeview); } - root.Add(new PropertyField { bindingPath = nameof(Warp.ColliderGroups) }); + root.Add(new PropertyField { bindingPath = nameof(WarpRoot.ColliderGroups) }); return root; } + + public void OnSceneGUI() + { + if (m_treeview == null) + { + return; + } + + var item = m_treeview.selectedItem; + if (item == null) + { + return; + } + + if (item is WarpRoot.Particle p) + { + var t = p.Transform; + Handles.color = Color.green; + Handles.SphereHandleCap(t.GetInstanceID(), t.position, t.rotation, p.Settings.radius * 2, EventType.Repaint); + } + } } } \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/WarpEditor.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/WarpRootEditor.cs.meta similarity index 100% rename from Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/WarpEditor.cs.meta rename to Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/WarpRootEditor.cs.meta diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RectCloth.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RectCloth.cs index cf5208cba..254a336dc 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RectCloth.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RectCloth.cs @@ -12,63 +12,63 @@ namespace RotateParticle.Components public bool LoopIsClosed = false; [SerializeField] - public List Warps = new(); + public List Warps = new(); void Reset() { for (int i = 0; i < transform.childCount; ++i) { var child = transform.GetChild(i); - if (child.TryGetComponent(out var warp)) + if (child.TryGetComponent(out var warp)) { Warps.Add(warp); } } } - public void OnDrawGizmosSelected() - { - if (Warps.Count == 0) - { - return; - } + // public void OnDrawGizmosSelected() + // { + // if (Warps.Count == 0) + // { + // return; + // } - // Gizmos.color = Color.red; - Gizmos.color = new Color(1, 0.5f, 0); - for (int i = 0; i < Warps.Count; ++i) - { - if (i + 1 == Warps.Count) - { - if (LoopIsClosed) - { - DrawWeft(Warps[i], Warps[0]); - } - } - else - { - DrawWeft(Warps[i], Warps[i + 1]); - } - } - } + // // Gizmos.color = Color.red; + // Gizmos.color = new Color(1, 0.5f, 0); + // for (int i = 0; i < Warps.Count; ++i) + // { + // if (i + 1 == Warps.Count) + // { + // if (LoopIsClosed) + // { + // DrawWeft(Warps[i], Warps[0]); + // } + // } + // else + // { + // DrawWeft(Warps[i], Warps[i + 1]); + // } + // } + // } - void DrawWeft(Warp w0, Warp w1) - { - if (w0 == null || w1 == null) - { - return; - } + // void DrawWeft(WarpR w0, Warp w1) + // { + // if (w0 == null || w1 == null) + // { + // return; + // } - Gizmos.DrawLine(w0.transform.position, w1.transform.position); + // Gizmos.DrawLine(w0.transform.position, w1.transform.position); - for (int i = 0; i < w0.Particles.Count && i < w1.Particles.Count; ++i) - { - var p0 = w0.Particles[i]; - var p1 = w1.Particles[i]; - if (p0 != null && p0.Transform != null && p1 != null && p1.Transform != null) - { - Gizmos.DrawLine(p0.Transform.position, p1.Transform.position); - } - } - } + // for (int i = 0; i < w0.Particles.Count && i < w1.Particles.Count; ++i) + // { + // var p0 = w0.Particles[i]; + // var p1 = w1.Particles[i]; + // if (p0 != null && p0.Transform != null && p1 != null && p1.Transform != null) + // { + // Gizmos.DrawLine(p0.Transform.position, p1.Transform.position); + // } + // } + // } } } \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RotateParticleRuntimeProvider.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RotateParticleRuntimeProvider.cs index b36eb5a34..349d547f1 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RotateParticleRuntimeProvider.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RotateParticleRuntimeProvider.cs @@ -11,7 +11,7 @@ namespace RotateParticle.Components public class RotateParticleRuntimeProvider : MonoBehaviour, IVrm10SpringBoneRuntimeProvider { [SerializeField] - public List Warps = new(); + public List Warps = new(); [SerializeField] public List Cloths = new(); @@ -25,7 +25,7 @@ namespace RotateParticle.Components public void Reset() { - Warps = GetComponentsInChildren().ToList(); + Warps = GetComponentsInChildren().ToList(); Cloths = GetComponentsInChildren().ToList(); } @@ -39,7 +39,7 @@ namespace RotateParticle.Components } public static void FromVrm10(Vrm10Instance instance, - Func addWarp, + Func addWarp, Action deleteObject) { foreach (var spring in instance.SpringBone.Springs) @@ -55,7 +55,7 @@ namespace RotateParticle.Components continue; } - var warp = root_joint.GetComponent(); + var warp = root_joint.GetComponent(); if (warp == null) { // var warp = Undo.AddComponent(root_joint); @@ -82,12 +82,14 @@ namespace RotateParticle.Components // breaking change from vrm-1.0 settings.radius = joints[i - 1].m_jointRadius; var useInheritSettings = warp.BaseSettings.Equals(settings); - warp.Particles.Add(new Warp.Particle + if (useInheritSettings) { - useInheritSettings = useInheritSettings, - OverrideSettings = settings, - Transform = joint.transform, - }); + warp.UseBaseSettings(joint.transform); + } + else + { + warp.SetSettings(joint.transform, settings); + } } // Undo.DestroyObjectImmediate(joint); deleteObject(joint); diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Warp.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Warp.cs deleted file mode 100644 index f7d67a89c..000000000 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Warp.cs +++ /dev/null @@ -1,132 +0,0 @@ -using System; -using System.Collections.Generic; -using UniGLTF.SpringBoneJobs.Blittables; -using UnityEngine; -using UniVRM10; - - -namespace RotateParticle.Components -{ - [AddComponentMenu("RotateParticle/Warp")] - [DisallowMultipleComponent] - public class Warp : MonoBehaviour - { - public static BlittableJointMutable DefaultSetting() - { - return new BlittableJointMutable - { - stiffnessForce = 1.0f, - gravityPower = 0, - gravityDir = new Vector3(0, -1.0f, 0), - dragForce = 0.4f, - radius = 0.02f, - }; - } - - public enum ParticleMode - { - /// - /// Use BaseSettings - /// - UseBase, - /// - /// Use specific settings - /// - Override, - /// - /// no animation - /// - Disabled, - } - - /// - /// VRM10SpringBoneJoint に相当する - /// - [Serializable] - public class Particle - { - public bool useInheritSettings = true; - public BlittableJointMutable OverrideSettings = DefaultSetting(); - public Transform Transform; - - public BlittableJointMutable GetSettings(BlittableJointMutable baseSettings) - { - return useInheritSettings ? baseSettings : OverrideSettings; - } - } - - [SerializeField] - public BlittableJointMutable BaseSettings = DefaultSetting(); - - /// - /// null のときは world root ではなく model root で処理 - /// - [SerializeField] - public Transform Center; - - /// - /// 枝分かれ不可 - /// - [SerializeField] - public List Particles = new(); - - [SerializeField] - public List ColliderGroups = new(); - - void Reset() - { - // Debug.Log("Warp.Reset"); - } - - public void AddParticleRecursive() - { - if (transform.childCount > 0) - { - AddParticleRecursive(transform.GetChild(0)); - } - } - - public void AddParticleRecursive(Transform t) - { - Particles.Add(new Particle - { - Transform = t, - }); - if (t.childCount > 0) - { - AddParticleRecursive(t.GetChild(0)); - } - } - - void OnValidate() - { - // TODO: 枝分かれを削除 - // Debug.Log("Warp.OnValidate"); - } - - internal List ToList() - { - throw new NotImplementedException(); - } - - public void OnDrawGizmosSelected() - { - Gizmos.DrawSphere(transform.position, BaseSettings.radius); - - Transform prev = transform; - foreach (var p in Particles) - { - if (p != null && p.Transform != null) - { - Gizmos.DrawWireSphere(p.Transform.position, p.GetSettings(BaseSettings).radius); - - if (prev != null) - { - Gizmos.DrawLine(prev.position, p.Transform.position); - } - } - prev = p.Transform; - } - } - } -} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/WarpRoot.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/WarpRoot.cs new file mode 100644 index 000000000..e35ea9ee1 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/WarpRoot.cs @@ -0,0 +1,223 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using UniGLTF.SpringBoneJobs.Blittables; +using UnityEngine; +using UnityEngine.UIElements; +using UniVRM10; + + +namespace RotateParticle.Components +{ + [AddComponentMenu("RotateParticle/WarpRoot")] + [DisallowMultipleComponent] + /// + /// Warp の root にアタッチする。 + /// 子孫の Transform がすべて登録される。 + /// + public class WarpRoot : MonoBehaviour + { + public static BlittableJointMutable DefaultSetting() + { + return new BlittableJointMutable + { + stiffnessForce = 1.0f, + gravityPower = 0, + gravityDir = new Vector3(0, -1.0f, 0), + dragForce = 0.4f, + radius = 0.02f, + }; + } + + public enum ParticleMode + { + /// + /// Use BaseSettings + /// + Base, + /// + /// Use specific settings + /// + Override, + /// + /// no animation + /// + Disabled, + } + + /// + /// VRM10SpringBoneJoint に相当する + /// + [Serializable] + public struct Particle + { + public Transform Transform; + public ParticleMode Mode; + public BlittableJointMutable Settings; + + public Particle(Transform t, ParticleMode mode, BlittableJointMutable settings) + { + Transform = t; + Mode = mode; + Settings = settings; + } + + public Particle(Transform t, BlittableJointMutable settings) + : this(t, ParticleMode.Override, settings) + { + } + + public Particle(Transform t) + : this(t, ParticleMode.Base, DefaultSetting()) + { + } + } + + [SerializeField] + public BlittableJointMutable BaseSettings = DefaultSetting(); + + /// + /// null のときは world root ではなく model root で処理 + /// + [SerializeField] + public Transform Center; + + /// + /// 枝分かれ不可 + /// + [SerializeField] + private List m_particles = new(); + public IReadOnlyList Particles => m_particles; + + [SerializeField] + public List ColliderGroups = new(); + + // uitool kit 向け + public List> m_rootitems; + + // 逆引き + Dictionary m_map = new(); + + void Reset() + { + m_particles = GetComponentsInChildren().Skip(1).Select(x => new Particle(x)).ToList(); + } + + void OnValidate() + { + m_map.Clear(); + for (int i = 0; i < m_particles.Count; ++i) + { + var p = m_particles[i]; + if (p.Mode == ParticleMode.Base) + { + p.Settings = BaseSettings; + m_particles[i] = p; + } + m_map.Add(p.Transform, i); + } + + m_rootitems = MakeTree(-1); + } + + public List> MakeTree(int id) + { + List> items = new(); + foreach (Transform child_transform in id==-1 ? transform : m_particles[id].Transform) + { + var child_id = m_map[child_transform]; + var item = (child_transform.childCount > 0) + ? new TreeViewItemData(child_id, m_particles[child_id], MakeTree(child_id)) + : new TreeViewItemData(child_id, m_particles[child_id]) + ; + items.Add(item); + } + return items; + } + + public Particle GetParticle(int id) + { + return m_particles[id]; + } + + public void UseBaseSettings(Transform t) + { + if (t == null) return; + for (int i = 0; i < m_particles.Count; ++i) + { + var p = m_particles[i]; + if (p.Transform == t) + { + p.Mode = ParticleMode.Base; + p.Settings = BaseSettings; + m_particles[i] = p; + break; + } + } + } + + public void SetSettings(Transform t, BlittableJointMutable settings) + { + if (t == null) return; + for (int i = 0; i < m_particles.Count; ++i) + { + var p = m_particles[i]; + if (p.Transform == t) + { + p.Mode = ParticleMode.Override; + p.Settings = settings; + m_particles[i] = p; + break; + } + } + } + + + // internal List ToList() + // { + // throw new NotImplementedException(); + // } + + public void OnDrawGizmosSelected() + { + Gizmos.DrawSphere(transform.position, BaseSettings.radius); + + foreach (var p in Particles) + { + if (p.Transform == null || p.Mode == ParticleMode.Disabled) + { + continue; + } + Gizmos.DrawWireSphere(p.Transform.position, p.Settings.radius); + + if (TryGetClosestParent(p.Transform, out var parent)) + { + Gizmos.DrawLine(p.Transform.position, parent.position); + } + } + } + + bool TryGetClosestParent(Transform t, out Transform parent) + { + var current = t.parent; + while (current != null) + { + if (current == transform) + { + parent = transform; + return true; + } + + var index = m_map[current]; + var p = m_particles[index]; + if (p.Mode != ParticleMode.Disabled) + { + parent = p.Transform; + return true; + } + } + parent = default; + return false; + } + } +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Warp.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/WarpRoot.cs.meta similarity index 100% rename from Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/Warp.cs.meta rename to Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/WarpRoot.cs.meta diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs index 2f868d2d4..95f9e8004 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs @@ -98,7 +98,7 @@ namespace RotateParticle.Jobs List info = new(); List positions = new(); List warps = new(); - var warpSrcs = vrm.GetComponentsInChildren(); + var warpSrcs = vrm.GetComponentsInChildren(); for (int warpIndex = 0; warpIndex < warpSrcs.Length; ++warpIndex) { var warp = warpSrcs[warpIndex]; @@ -136,7 +136,7 @@ namespace RotateParticle.Jobs var parentIndex = warpRootTransformIndex.index; foreach (var particle in warp.Particles) { - if (particle != null && particle.Transform != null) + if (particle.Transform != null && particle.Mode!=WarpRoot.ParticleMode.Disabled) { var outputParticleTransformIndex = GetTransformIndex(particle.Transform, new TransformInfo { @@ -144,7 +144,7 @@ namespace RotateParticle.Jobs ParentIndex = parentIndex, InitLocalPosition = vrm.DefaultTransformStates[particle.Transform].LocalPosition, InitLocalRotation = vrm.DefaultTransformStates[particle.Transform].LocalRotation, - Settings = particle.GetSettings(warp.BaseSettings), + Settings = particle.Settings, }, info, positions); parentIndex = outputParticleTransformIndex.index; } diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleList.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleList.cs index 4b4e951e4..0fced8f4f 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleList.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/ParticleList.cs @@ -12,7 +12,7 @@ namespace RotateParticle public List _particles = new(); public List _particleTransforms = new(); - public Strand MakeParticleStrand(SimulationEnv env, Warp warp) + public Strand MakeParticleStrand(SimulationEnv env, WarpRoot warp) { var strand = new Strand(); @@ -24,7 +24,7 @@ namespace RotateParticle foreach (var particle in warp.Particles) { var child_index = _MakeAParticle(joint, env, particle.Transform, - particle.GetSettings(warp.BaseSettings).radius, 1); + particle.Settings.radius, 1); var child = _particles[child_index]; strand.Particles.Add(child); joint.Children.Add(child); diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs index 97ff35657..974b69426 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs @@ -20,7 +20,7 @@ namespace RotateParticle Stiffness = 0.07f, }; - readonly List _warps = new(); + readonly List _warps = new(); readonly List _cloths = new(); public List _colliderGroups = new(); @@ -65,7 +65,7 @@ namespace RotateParticle RectCloth cloth, ParticleList list, List<(SpringConstraint, ClothRectCollision)> clothRects, - Dictionary strandMap) + Dictionary strandMap) { for (int i = 1; i < cloth.Warps.Count; ++i) { @@ -139,8 +139,8 @@ namespace RotateParticle async Task IRotateParticleSystem.InitializeAsync(Vrm10Instance vrm, IAwaitCaller awaitCaller) { - var strandMap = new Dictionary(); - var warps = vrm.GetComponentsInChildren(); + var strandMap = new Dictionary(); + var warps = vrm.GetComponentsInChildren(); foreach (var warp in warps) { var strands = new List(); From 3bb9a637b43f014f702ec4df69a5cc8831d17560 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Thu, 21 Nov 2024 19:53:44 +0900 Subject: [PATCH 052/113] bindCell --- .../RotateParticle/Editor/WarpRootEditor.cs | 55 +++++++++++++++++-- .../Runtime/Components/WarpRoot.cs | 31 ++++++----- 2 files changed, 69 insertions(+), 17 deletions(-) diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/WarpRootEditor.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/WarpRootEditor.cs index 173c7b57c..604e45713 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/WarpRootEditor.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/WarpRootEditor.cs @@ -51,6 +51,8 @@ namespace RotateParticle.Components { var root = new VisualElement(); + root.TrackSerializedObjectValue(serializedObject, OnValueChanged); + root.Bind(serializedObject); { @@ -61,25 +63,46 @@ namespace RotateParticle.Components root.Add(new PropertyField { bindingPath = nameof(WarpRoot.BaseSettings) }); root.Add(new PropertyField { bindingPath = nameof(WarpRoot.Center) }); - root.Add(new PropertyField { bindingPath = nameof(WarpRoot.Particles) }); + root.Add(new PropertyField { bindingPath = "m_particles" }); + { m_treeview = new MultiColumnTreeView(); m_treeview.columns.Add(new Column { title = "Transform", width = 160, - makeCell = () => new ObjectField(), + makeCell = () => new ObjectField + { + }, bindCell = (v, i) => { v.SetEnabled(false); - (v as ObjectField).value = m_target.GetParticle(i).Transform; + // var prop = serializedObject.FindProperty($"m_particles.Array.data[{i}].Transform"); + // Debug.Log($"{i} => {prop}"); + if (v is ObjectField prop) + { + // prop.bindingPath = $"m_particles.Array.data[{i}].Transform"; + prop.BindProperty(serializedObject.FindProperty($"m_particles.Array.data[{i}].Transform")); + } }, }); m_treeview.columns.Add(new Column { title = "Mode", width = 60, - makeCell = () => new EnumField(default(WarpRoot.ParticleMode)), + // makeCell = () => new EnumField(default(WarpRoot.ParticleMode)), + makeCell = () => new EnumField + { + // bindingPath = $"m_particles.Array.data[0].Mode", + }, + bindCell = (v, i) => + { + if (v is EnumField prop) + { + prop.bindingPath = $"m_particles.Array.data[{i}].Mode"; + prop.Bind(serializedObject); + } + }, }); m_treeview.columns.Add(new Column { @@ -110,6 +133,14 @@ namespace RotateParticle.Components title = "radius", width = 20, makeCell = () => new FloatField(), + bindCell = (v, i) => + { + if (v is FloatField prop) + { + prop.BindProperty(serializedObject.FindProperty($"m_particles.Array.data[{i}].Settings.radius")); + prop.SetEnabled(m_target.Particles[i].Mode == WarpRoot.ParticleMode.Custom); + } + }, }); m_treeview.autoExpand = true; @@ -122,8 +153,23 @@ namespace RotateParticle.Components return root; } + private void OnValueChanged(SerializedObject so) + { + Debug.Log("Name changed: " + so.targetObject.name); + // var nameProperty = so.FindProperty("m_Name"); + + // if (nameProperty.stringValue.Contains(" ")) + // _textField.style.backgroundColor = Color.red; + // else + // _textField.style.backgroundColor = StyleKeyword.Null; + m_treeview.RefreshItems(); + // m_treeview.SetRootItems(m_target.m_rootitems); + Repaint(); + } + public void OnSceneGUI() { + HandleUtility.Repaint(); if (m_treeview == null) { return; @@ -137,6 +183,7 @@ namespace RotateParticle.Components if (item is WarpRoot.Particle p) { + p = m_target.GetParticleFromTransform(p.Transform); var t = p.Transform; Handles.color = Color.green; Handles.SphereHandleCap(t.GetInstanceID(), t.position, t.rotation, p.Settings.radius * 2, EventType.Repaint); diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/WarpRoot.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/WarpRoot.cs index e35ea9ee1..1904e21b1 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/WarpRoot.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/WarpRoot.cs @@ -38,7 +38,7 @@ namespace RotateParticle.Components /// /// Use specific settings /// - Override, + Custom, /// /// no animation /// @@ -63,7 +63,7 @@ namespace RotateParticle.Components } public Particle(Transform t, BlittableJointMutable settings) - : this(t, ParticleMode.Override, settings) + : this(t, ParticleMode.Custom, settings) { } @@ -123,7 +123,7 @@ namespace RotateParticle.Components public List> MakeTree(int id) { List> items = new(); - foreach (Transform child_transform in id==-1 ? transform : m_particles[id].Transform) + foreach (Transform child_transform in id == -1 ? transform : m_particles[id].Transform) { var child_id = m_map[child_transform]; var item = (child_transform.childCount > 0) @@ -135,11 +135,23 @@ namespace RotateParticle.Components return items; } - public Particle GetParticle(int id) + public Particle GetParticleFromId(int id) { return m_particles[id]; } + public Particle GetParticleFromTransform(Transform t) + { + foreach (var p in m_particles) + { + if (p.Transform == t) + { + return p; + } + } + return default; + } + public void UseBaseSettings(Transform t) { if (t == null) return; @@ -164,7 +176,7 @@ namespace RotateParticle.Components var p = m_particles[i]; if (p.Transform == t) { - p.Mode = ParticleMode.Override; + p.Mode = ParticleMode.Custom; p.Settings = settings; m_particles[i] = p; break; @@ -172,12 +184,6 @@ namespace RotateParticle.Components } } - - // internal List ToList() - // { - // throw new NotImplementedException(); - // } - public void OnDrawGizmosSelected() { Gizmos.DrawSphere(transform.position, BaseSettings.radius); @@ -199,8 +205,7 @@ namespace RotateParticle.Components bool TryGetClosestParent(Transform t, out Transform parent) { - var current = t.parent; - while (current != null) + for (var current = t.parent; current != null; current = current.parent) { if (current == transform) { From 41cc04a906241dbb9875d0264d4f7314a6944182 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Thu, 21 Nov 2024 20:38:45 +0900 Subject: [PATCH 053/113] BindColumn --- .../RotateParticle/Editor/WarpRootEditor.cs | 115 ++++++------------ 1 file changed, 38 insertions(+), 77 deletions(-) diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/WarpRootEditor.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/WarpRootEditor.cs index 604e45713..a0b1896e9 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/WarpRootEditor.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Editor/WarpRootEditor.cs @@ -47,6 +47,31 @@ namespace RotateParticle.Components // } // } + void BindColumn(string title, int width, Func makeVisualELmeent, Func enableFunc, string subpath) where T : BindableElement + { + m_treeview.columns.Add(new Column + { + title = title, + width = width, + makeCell = makeVisualELmeent, + bindCell = (v, i) => + { + if (v is T prop) + { + var sb = new System.Text.StringBuilder(); + sb.Append("m_particles.Array.data["); + sb.Append(i); + sb.Append("]."); + sb.Append(subpath); + var s = sb.ToString(); + // Debug.Log(s); + prop.BindProperty(serializedObject.FindProperty(s)); + prop.SetEnabled(enableFunc(i)); + } + }, + }); + } + public override VisualElement CreateInspectorGUI() { var root = new VisualElement(); @@ -63,85 +88,21 @@ namespace RotateParticle.Components root.Add(new PropertyField { bindingPath = nameof(WarpRoot.BaseSettings) }); root.Add(new PropertyField { bindingPath = nameof(WarpRoot.Center) }); - root.Add(new PropertyField { bindingPath = "m_particles" }); - + // root.Add(new PropertyField { bindingPath = "m_particles" }); { + Func isCustom = (i) => + { + return m_target.Particles[i].Mode == WarpRoot.ParticleMode.Custom; + }; + m_treeview = new MultiColumnTreeView(); - m_treeview.columns.Add(new Column - { - title = "Transform", - width = 160, - makeCell = () => new ObjectField - { - }, - bindCell = (v, i) => - { - v.SetEnabled(false); - // var prop = serializedObject.FindProperty($"m_particles.Array.data[{i}].Transform"); - // Debug.Log($"{i} => {prop}"); - if (v is ObjectField prop) - { - // prop.bindingPath = $"m_particles.Array.data[{i}].Transform"; - prop.BindProperty(serializedObject.FindProperty($"m_particles.Array.data[{i}].Transform")); - } - }, - }); - m_treeview.columns.Add(new Column - { - title = "Mode", - width = 60, - // makeCell = () => new EnumField(default(WarpRoot.ParticleMode)), - makeCell = () => new EnumField - { - // bindingPath = $"m_particles.Array.data[0].Mode", - }, - bindCell = (v, i) => - { - if (v is EnumField prop) - { - prop.bindingPath = $"m_particles.Array.data[{i}].Mode"; - prop.Bind(serializedObject); - } - }, - }); - m_treeview.columns.Add(new Column - { - title = "stiffnessForce", - width = 20, - makeCell = () => new FloatField(), - }); - m_treeview.columns.Add(new Column - { - title = "gravityPower", - width = 20, - makeCell = () => new FloatField(), - }); - m_treeview.columns.Add(new Column - { - title = "gravityDir", - width = 20, - makeCell = () => new Vector3Field(), - }); - m_treeview.columns.Add(new Column - { - title = "dragForce", - width = 20, - makeCell = () => new FloatField(), - }); - m_treeview.columns.Add(new Column - { - title = "radius", - width = 20, - makeCell = () => new FloatField(), - bindCell = (v, i) => - { - if (v is FloatField prop) - { - prop.BindProperty(serializedObject.FindProperty($"m_particles.Array.data[{i}].Settings.radius")); - prop.SetEnabled(m_target.Particles[i].Mode == WarpRoot.ParticleMode.Custom); - } - }, - }); + BindColumn("Transform", 120, () => new ObjectField(), (_) => false, "Transform"); + BindColumn("Mode", 40, () => new EnumField(), (_) => true, "Mode"); + BindColumn("stiffnessForce", 40, () => new FloatField(), isCustom, "Settings.stiffnessForce"); + BindColumn("gravityPower", 40, () => new FloatField(), isCustom, "Settings.gravityPower"); + BindColumn("gravityDir", 120, () => new Vector3Field(), isCustom, "Settings.gravityDir"); + BindColumn("dragForce", 40, () => new FloatField(), isCustom, "Settings.dragForce"); + BindColumn("radius", 40, () => new FloatField(), isCustom, "Settings.radius"); m_treeview.autoExpand = true; m_treeview.SetRootItems(m_target.m_rootitems); From e79117a3a698dcc23894fa29d348adc637055442 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Fri, 22 Nov 2024 19:55:16 +0900 Subject: [PATCH 054/113] RectCloth.OnDrawGizmosSelected --- .../Runtime/Components/RectCloth.cs | 80 +++++++++---------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RectCloth.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RectCloth.cs index 254a336dc..f1f5c71de 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RectCloth.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Components/RectCloth.cs @@ -26,49 +26,49 @@ namespace RotateParticle.Components } } - // public void OnDrawGizmosSelected() - // { - // if (Warps.Count == 0) - // { - // return; - // } + public void OnDrawGizmosSelected() + { + if (Warps.Count == 0) + { + return; + } - // // Gizmos.color = Color.red; - // Gizmos.color = new Color(1, 0.5f, 0); - // for (int i = 0; i < Warps.Count; ++i) - // { - // if (i + 1 == Warps.Count) - // { - // if (LoopIsClosed) - // { - // DrawWeft(Warps[i], Warps[0]); - // } - // } - // else - // { - // DrawWeft(Warps[i], Warps[i + 1]); - // } - // } - // } + // Gizmos.color = Color.red; + Gizmos.color = new Color(1, 0.5f, 0); + for (int i = 0; i < Warps.Count; ++i) + { + if (i + 1 == Warps.Count) + { + if (LoopIsClosed) + { + DrawWeft(Warps[i], Warps[0]); + } + } + else + { + DrawWeft(Warps[i], Warps[i + 1]); + } + } + } - // void DrawWeft(WarpR w0, Warp w1) - // { - // if (w0 == null || w1 == null) - // { - // return; - // } + void DrawWeft(WarpRoot w0, WarpRoot w1) + { + if (w0 == null || w1 == null) + { + return; + } - // Gizmos.DrawLine(w0.transform.position, w1.transform.position); + Gizmos.DrawLine(w0.transform.position, w1.transform.position); - // for (int i = 0; i < w0.Particles.Count && i < w1.Particles.Count; ++i) - // { - // var p0 = w0.Particles[i]; - // var p1 = w1.Particles[i]; - // if (p0 != null && p0.Transform != null && p1 != null && p1.Transform != null) - // { - // Gizmos.DrawLine(p0.Transform.position, p1.Transform.position); - // } - // } - // } + for (int i = 0; i < w0.Particles.Count && i < w1.Particles.Count; ++i) + { + var p0 = w0.Particles[i]; + var p1 = w1.Particles[i]; + if (p0.Transform != null && p1.Transform != null) + { + Gizmos.DrawLine(p0.Transform.position, p1.Transform.position); + } + } + } } } \ No newline at end of file From 9bb914c9b37f7b7fd1b39438daf4c43b9a8fb7f6 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Fri, 22 Nov 2024 20:17:09 +0900 Subject: [PATCH 055/113] SpringConstraint --- .../RotateParticleSpringboneRuntime.cs | 2 +- .../Runtime/RotateParticleSystem.cs | 17 +++++++--- .../Runtime/SpringConstraint.cs | 34 ++++++++++--------- 3 files changed, 31 insertions(+), 22 deletions(-) diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs index 825760b8e..66e68f51f 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs @@ -1,4 +1,4 @@ -#define USE_ROTATEPARTICLE_JOB +// #define USE_ROTATEPARTICLE_JOB using System; using System.Threading.Tasks; using UniGLTF; diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs index 974b69426..42ea86b07 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs @@ -93,8 +93,11 @@ namespace RotateParticle } clothRects.Add(( new SpringConstraint( - list._particles[a.Init.Index], - list._particles[b.Init.Index]), + a.Init.Index, + b.Init.Index, + Vector3.Distance( + list._particles[a.Init.Index].State.Current, + list._particles[b.Init.Index].State.Current)), new ClothRectCollision( a.Init.Index, b.Init.Index, c.Init.Index, d.Init.Index))); } @@ -126,8 +129,12 @@ namespace RotateParticle } clothRects.Add(( new SpringConstraint( - list._particles[a.Init.Index], - list._particles[b.Init.Index]), + a.Init.Index, + b.Init.Index, + Vector3.Distance( + list._particles[a.Init.Index].State.Current, + list._particles[b.Init.Index].State.Current) + ), new ClothRectCollision( a.Init.Index, b.Init.Index, c.Init.Index, d.Init.Index ) @@ -225,7 +232,7 @@ namespace RotateParticle foreach (var (spring, collision) in _clothRects) { // cloth constraint - spring.Resolve(time, _clothFactor); + spring.Resolve(time, _clothFactor, _list._particles); } _list.Verlet(Env, time, _newPos.Init); // 長さで拘束 diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SpringConstraint.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SpringConstraint.cs index cec219e18..9aa8dd2a0 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SpringConstraint.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SpringConstraint.cs @@ -1,41 +1,43 @@ -using System; +using System.Collections.Generic; using UnityEngine; + namespace RotateParticle { - public class SpringConstraint + public struct SpringConstraint { - RotateParticle _p0; + int _p0; - RotateParticle _p1; + int _p1; // 初期長さ float _rest; - public SpringConstraint(RotateParticle p0, RotateParticle p1) + public SpringConstraint(int p0, int p1, float d) { _p0 = p0; _p1 = p1; - _rest = Vector3.Distance(p0.State.Current, p1.State.Current); + _rest = d; } /// /// フックの法則 /// /// - public void Resolve(FrameTime time, float hookean) + public void Resolve(FrameTime time, float hookean, List list) { - var d = Vector3.Distance(_p0.State.Current, _p1.State.Current); + var p0 = list[_p0]; + var p1 = list[_p1]; + var d = Vector3.Distance(p0.State.Current, p1.State.Current); var f = (d - _rest) * hookean; - var dx = (_p1.State.Current - _p0.State.Current).normalized * f / time.SqDt; - - _p0.Force += dx; - _p1.Force -= dx; + var dx = (p1.State.Current - p0.State.Current).normalized * f / time.SqDt; + p0.Force += dx; + p1.Force -= dx; } - public void DrawGizmo() - { - Gizmos.DrawLine(_p0.State.Current, _p1.State.Current); - } + // public void DrawGizmo(List list) + // { + // Gizmos.DrawLine(list[_p0].State.Current, list[_p1].State.Current); + // } } } \ No newline at end of file From 895dba230b6f59afc953a1f824b1b755450ecb2d Mon Sep 17 00:00:00 2001 From: ousttrue Date: Fri, 22 Nov 2024 20:33:26 +0900 Subject: [PATCH 056/113] struct --- .../Runtime/RotateParticleSystem.cs | 35 +++++---- .../SphereTriangle/ClothRectCollision.cs | 72 +++++++++---------- .../Runtime/SphereTriangle/PositionList.cs | 15 +++- 3 files changed, 66 insertions(+), 56 deletions(-) diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs index 42ea86b07..7b5cd1e48 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs @@ -30,7 +30,8 @@ namespace RotateParticle // runtime public List _strands = new List(); public ParticleList _list = new(); - public List<(SpringConstraint, ClothRectCollision)> _clothRects = new(); + public List<(SpringConstraint, ClothRect)> _clothRects = new(); + public List _clothRectCollisions = new(); public PositionList _newPos; Vector3[] _restPositions; @@ -64,7 +65,6 @@ namespace RotateParticle public void InitializeCloth( RectCloth cloth, ParticleList list, - List<(SpringConstraint, ClothRectCollision)> clothRects, Dictionary strandMap) { for (int i = 1; i < cloth.Warps.Count; ++i) @@ -91,15 +91,16 @@ namespace RotateParticle (a, b) = (b, a); (c, d) = (d, c); } - clothRects.Add(( + _clothRects.Add(( new SpringConstraint( a.Init.Index, b.Init.Index, Vector3.Distance( list._particles[a.Init.Index].State.Current, list._particles[b.Init.Index].State.Current)), - new ClothRectCollision( + new ClothRect( a.Init.Index, b.Init.Index, c.Init.Index, d.Init.Index))); + _clothRectCollisions.Add(new()); } } @@ -127,7 +128,7 @@ namespace RotateParticle (a, b) = (b, a); (c, d) = (d, c); } - clothRects.Add(( + _clothRects.Add(( new SpringConstraint( a.Init.Index, b.Init.Index, @@ -135,10 +136,11 @@ namespace RotateParticle list._particles[a.Init.Index].State.Current, list._particles[b.Init.Index].State.Current) ), - new ClothRectCollision( + new ClothRect( a.Init.Index, b.Init.Index, c.Init.Index, d.Init.Index ) )); + _clothRectCollisions.Add(new()); } } } @@ -168,7 +170,7 @@ namespace RotateParticle var cloths = vrm.GetComponentsInChildren(); foreach (var cloth in cloths) { - InitializeCloth(cloth, _list, _clothRects, strandMap); + InitializeCloth(cloth, _list, strandMap); } _newPos = new(_list._particles.Count); @@ -176,9 +178,11 @@ namespace RotateParticle _restPositions = new Vector3[_list._particles.Count]; _newPos.EndInitialize(); - foreach (var (s, c) in _clothRects) + for (int i = 0; i < _clothRects.Count; ++i) { - c.InitializeColliderSide(_newPos, _colliderGroups); + var (s, r) = _clothRects[i]; + var c = _clothRectCollisions[i]; + c.InitializeColliderSide(_newPos, _colliderGroups, r); } await awaitCaller.NextFrame(); @@ -249,16 +253,17 @@ namespace RotateParticle { var g = _colliderGroups[i]; - - foreach (var (spring, rect) in _clothRects) + for (int j = 0; j < _clothRects.Count; ++j) { + var (spring, rect) = _clothRects[j]; + var collision = _clothRectCollisions[j]; // using var prof = new ProfileSample("Collision: Cloth"); // 頂点 abcd は同じ CollisionMask // TODO: // if (_list._particles[rect._a].Init.CollisionMask.HasFlag((CollisionGroupMask)(i + 1))) { // cloth - rect.Collide(_newPos, g.Colliders); + collision.Collide(_newPos, g.Colliders, rect); } } @@ -438,9 +443,11 @@ namespace RotateParticle { _list.DrawGizmos(); - foreach (var (spring, rect) in _clothRects) + for (int i = 0; i < _clothRects.Count; ++i) { - rect.DrawGizmos(); + // var (spring, rect) = _clothRects[i]; + var collision = _clothRectCollisions[i]; + collision.DrawGizmos(); } if (_newPos != null) diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/ClothRectCollision.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/ClothRectCollision.cs index b5d4f9924..4560707c0 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/ClothRectCollision.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/ClothRectCollision.cs @@ -4,7 +4,7 @@ using UniVRM10; namespace SphereTriangle { - public class ClothRectCollision + public struct ClothRect { // 2枚の三角形 // abc @@ -15,17 +15,6 @@ namespace SphereTriangle public readonly int _c; public readonly int _d; - Triangle _triangle0; - float _trinagle0Collision; - Triangle _triangle1; - float _triangle1Collision; - - TriangleCapsuleCollisionSolver _s0 = new(); - TriangleCapsuleCollisionSolver _s1 = new(); - - // 各コライダーが初期姿勢で三角形ABCの法線の正か負のどちらにあるのかを記録する - Dictionary _initialColliderNormalSide = new(); - /// /// two triangles /// d x-x c @@ -36,7 +25,7 @@ namespace SphereTriangle /// /// /// - public ClothRectCollision( + public ClothRect( int a, int b, int c, int d) { _a = a; @@ -44,13 +33,27 @@ namespace SphereTriangle _c = c; _d = d; } + } - public void InitializeColliderSide(PositionList list, IReadOnlyList colliderGroups) + public class ClothRectCollision + { + Triangle _triangle0; + float _trinagle0Collision; + Triangle _triangle1; + float _triangle1Collision; + + TriangleCapsuleCollisionSolver _s0 = new(); + TriangleCapsuleCollisionSolver _s1 = new(); + + // 各コライダーが初期姿勢で三角形ABCの法線の正か負のどちらにあるのかを記録する + Dictionary _initialColliderNormalSide = new(); + + public void InitializeColliderSide(PositionList list, IReadOnlyList colliderGroups, ClothRect _rect) { - var a = list.Get(_a); - var b = list.Get(_b); - var c = list.Get(_c); - var d = list.Get(_d); + var a = list.Get(_rect._a); + var b = list.Get(_rect._b); + var c = list.Get(_rect._c); + var d = list.Get(_rect._d); // x c // /| @@ -68,26 +71,17 @@ namespace SphereTriangle } } - public Bounds GetBoundsFrom4(in Vector3 a, in Vector3 b, in Vector3 c, in Vector3 d) - { - var aabb = new Bounds(a, Vector3.zero); - aabb.Encapsulate(b); - aabb.Encapsulate(c); - aabb.Encapsulate(d); - return aabb; - } - - public void Collide(PositionList list, IList colliders) + public void Collide(PositionList list, IList colliders, ClothRect _rect) { // using (new ProfileSample("Rect: Prepare")) { _s0.BeginFrame(); _s1.BeginFrame(); - var a = list.Get(_a); - var b = list.Get(_b); - var c = list.Get(_c); - var d = list.Get(_d); + var a = list.Get(_rect._a); + var b = list.Get(_rect._b); + var c = list.Get(_rect._c); + var d = list.Get(_rect._d); // d x-x c // |/ @@ -111,7 +105,7 @@ namespace SphereTriangle // using (new ProfileSample("Rect: Collide")) { - var aabb = list.GetBounds(this); + var aabb = list.GetBounds(_rect); for (int i = 0; i < colliders.Count; ++i) { @@ -135,16 +129,16 @@ namespace SphereTriangle if (TryCollide(_s0, collider, _triangle0, out var l0)) { _trinagle0Collision = 1.0f; - list.CollisionMove(_a, l0, collider.Radius); - list.CollisionMove(_b, l0, collider.Radius); - list.CollisionMove(_c, l0, collider.Radius); + list.CollisionMove(_rect._a, l0, collider.Radius); + list.CollisionMove(_rect._b, l0, collider.Radius); + list.CollisionMove(_rect._c, l0, collider.Radius); } if (TryCollide(_s1, collider, _triangle1, out var l1)) { _triangle1Collision = 1.0f; - list.CollisionMove(_c, l1, collider.Radius); - list.CollisionMove(_d, l1, collider.Radius); - list.CollisionMove(_a, l1, collider.Radius); + list.CollisionMove(_rect._c, l1, collider.Radius); + list.CollisionMove(_rect._d, l1, collider.Radius); + list.CollisionMove(_rect._a, l1, collider.Radius); } } } diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/PositionList.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/PositionList.cs index 0377300ad..e35deba49 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/PositionList.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/PositionList.cs @@ -30,9 +30,18 @@ namespace SphereTriangle Result = new Vector3[count]; } - public Dictionary BoundsCache = new(); + public Dictionary BoundsCache = new(); - public Bounds GetBounds(ClothRectCollision rect) + public Bounds GetBoundsFrom4(in Vector3 a, in Vector3 b, in Vector3 c, in Vector3 d) + { + var aabb = new Bounds(a, Vector3.zero); + aabb.Encapsulate(b); + aabb.Encapsulate(c); + aabb.Encapsulate(d); + return aabb; + } + + public Bounds GetBounds(ClothRect rect) { if (BoundsCache.TryGetValue(rect, out var b)) { @@ -40,7 +49,7 @@ namespace SphereTriangle } else { - b = rect.GetBoundsFrom4(Get(rect._a), Get(rect._b), Get(rect._c), Get(rect._d)); + b = GetBoundsFrom4(Get(rect._a), Get(rect._b), Get(rect._c), Get(rect._d)); BoundsCache.Add(rect, b); return b; } From 67004592e713581cd69589424a02500d92720bb9 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Fri, 22 Nov 2024 20:45:44 +0900 Subject: [PATCH 057/113] _clothRects --- .../Runtime/Jobs/RotateParticleJobSystem.cs | 98 ++++++++++++++++++- .../RotateParticleSpringboneRuntime.cs | 2 +- .../Runtime/RotateParticleSystem.cs | 66 ++++++------- 3 files changed, 130 insertions(+), 36 deletions(-) diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs index 95f9e8004..5fe5fc812 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Threading.Tasks; using RotateParticle.Components; using UniGLTF; @@ -33,6 +34,12 @@ namespace RotateParticle.Jobs NativeArray _warps; + // + // cloth + // + NativeArray _clothUsedParticles = new(); + NativeArray<(SpringConstraint, SphereTriangle.ClothRect)> _clothRects = new(); + void IDisposable.Dispose() { if (_colliderTransformAccessArray.isCreated) _colliderTransformAccessArray.Dispose(); @@ -136,7 +143,7 @@ namespace RotateParticle.Jobs var parentIndex = warpRootTransformIndex.index; foreach (var particle in warp.Particles) { - if (particle.Transform != null && particle.Mode!=WarpRoot.ParticleMode.Disabled) + if (particle.Transform != null && particle.Mode != WarpRoot.ParticleMode.Disabled) { var outputParticleTransformIndex = GetTransformIndex(particle.Transform, new TransformInfo { @@ -167,6 +174,95 @@ namespace RotateParticle.Jobs _nextPositions = new(pos.Length, Allocator.Persistent); _nextRotations = new(pos.Length, Allocator.Persistent); _info = new(info.ToArray(), Allocator.Persistent); + + // + // cloths + // + HashSet clothUsedParticles = new(); + List<(SpringConstraint, SphereTriangle.ClothRect)> clothRects = new(); + var cloths = vrm.GetComponentsInChildren(); + foreach (var cloth in cloths) + { + for (int i = 1; i < cloth.Warps.Count; ++i) + { + var s0 = cloth.Warps[i - 1]; + var s1 = cloth.Warps[i]; + for (int j = 1; j < s0.Particles.Count && j < s1.Particles.Count; ++j) + { + // d x x c + // | | + // a x-x b + var a = s0.Particles[j]; + var b = s1.Particles[j]; + var c = s1.Particles[j - 1]; + var d = s0.Particles[j - 1]; + clothUsedParticles.Add(_transforms.IndexOf(a.Transform)); + clothUsedParticles.Add(_transforms.IndexOf(b.Transform)); + clothUsedParticles.Add(_transforms.IndexOf(c.Transform)); + clothUsedParticles.Add(_transforms.IndexOf(d.Transform)); + if (i % 2 == 1) + { + // 互い違いに + // abcd to badc + (a, b) = (b, a); + (c, d) = (d, c); + } + clothRects.Add(( + new SpringConstraint( + _transforms.IndexOf(a.Transform), + _transforms.IndexOf(b.Transform), + Vector3.Distance( + vrm.DefaultTransformStates[a.Transform].Position, + vrm.DefaultTransformStates[b.Transform].Position)), + new SphereTriangle.ClothRect( + _transforms.IndexOf(a.Transform), + _transforms.IndexOf(b.Transform), + _transforms.IndexOf(c.Transform), + _transforms.IndexOf(d.Transform)))); + } + } + + if (cloth.Warps.Count >= 3 && cloth.LoopIsClosed) + { + // close loop + var i = cloth.Warps.Count; + var s0 = cloth.Warps.Last(); + var s1 = cloth.Warps.First(); + for (int j = 1; j < s0.Particles.Count && j < s1.Particles.Count; ++j) + { + var a = s0.Particles[j]; + var b = s1.Particles[j]; + var c = s1.Particles[j - 1]; + var d = s0.Particles[j - 1]; + clothUsedParticles.Add(_transforms.IndexOf(a.Transform)); + clothUsedParticles.Add(_transforms.IndexOf(b.Transform)); + clothUsedParticles.Add(_transforms.IndexOf(c.Transform)); + clothUsedParticles.Add(_transforms.IndexOf(d.Transform)); + if (i % 2 == 1) + { + // 互い違いに + // abcd to badc + (a, b) = (b, a); + (c, d) = (d, c); + } + clothRects.Add(( + new SpringConstraint( + _transforms.IndexOf(a.Transform), + _transforms.IndexOf(b.Transform), + Vector3.Distance( + vrm.DefaultTransformStates[a.Transform].Position, + vrm.DefaultTransformStates[b.Transform].Position) + ), + new SphereTriangle.ClothRect( + _transforms.IndexOf(a.Transform), + _transforms.IndexOf(b.Transform), + _transforms.IndexOf(c.Transform), + _transforms.IndexOf(d.Transform) + ) + )); + } + } + } } private static BlittableColliderType TranslateColliderType(VRM10SpringBoneColliderTypes colliderType) diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs index 66e68f51f..825760b8e 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSpringboneRuntime.cs @@ -1,4 +1,4 @@ -// #define USE_ROTATEPARTICLE_JOB +#define USE_ROTATEPARTICLE_JOB using System; using System.Threading.Tasks; using UniGLTF; diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs index 7b5cd1e48..50f3296ff 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs @@ -104,44 +104,42 @@ namespace RotateParticle } } - if (cloth.Warps.Count >= 3) + if (cloth.Warps.Count >= 3 && cloth.LoopIsClosed) { - if (cloth.LoopIsClosed) + // close loop + var i = cloth.Warps.Count; + var s0 = strandMap[cloth.Warps.Last()]; + var s1 = strandMap[cloth.Warps.First()]; + for (int j = 1; j < s0.Particles.Count && j < s1.Particles.Count; ++j) { - var i = cloth.Warps.Count; - var s0 = strandMap[cloth.Warps.Last()]; - var s1 = strandMap[cloth.Warps.First()]; - for (int j = 1; j < s0.Particles.Count && j < s1.Particles.Count; ++j) + var a = s0.Particles[j]; + var b = s1.Particles[j]; + var c = s1.Particles[j - 1]; + var d = s0.Particles[j - 1]; + _clothUsedParticles.Add(a.Init.Index); + _clothUsedParticles.Add(b.Init.Index); + _clothUsedParticles.Add(c.Init.Index); + _clothUsedParticles.Add(d.Init.Index); + if (i % 2 == 1) { - var a = s0.Particles[j]; - var b = s1.Particles[j]; - var c = s1.Particles[j - 1]; - var d = s0.Particles[j - 1]; - _clothUsedParticles.Add(a.Init.Index); - _clothUsedParticles.Add(b.Init.Index); - _clothUsedParticles.Add(c.Init.Index); - _clothUsedParticles.Add(d.Init.Index); - if (i % 2 == 1) - { - // 互い違いに - // abcd to badc - (a, b) = (b, a); - (c, d) = (d, c); - } - _clothRects.Add(( - new SpringConstraint( - a.Init.Index, - b.Init.Index, - Vector3.Distance( - list._particles[a.Init.Index].State.Current, - list._particles[b.Init.Index].State.Current) - ), - new ClothRect( - a.Init.Index, b.Init.Index, c.Init.Index, d.Init.Index - ) - )); - _clothRectCollisions.Add(new()); + // 互い違いに + // abcd to badc + (a, b) = (b, a); + (c, d) = (d, c); } + _clothRects.Add(( + new SpringConstraint( + a.Init.Index, + b.Init.Index, + Vector3.Distance( + list._particles[a.Init.Index].State.Current, + list._particles[b.Init.Index].State.Current) + ), + new ClothRect( + a.Init.Index, b.Init.Index, c.Init.Index, d.Init.Index + ) + )); + _clothRectCollisions.Add(new()); } } } From 1970b44cd7e0193ac4e3db16361e8948226d9121 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Fri, 22 Nov 2024 21:13:52 +0900 Subject: [PATCH 058/113] _clothRects --- .../Runtime/Jobs/RotateParticleJobSystem.cs | 26 +++++++++++-------- .../Runtime/RotateParticleSystem.cs | 21 ++++++++------- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs index 5fe5fc812..05fac9621 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs @@ -37,8 +37,8 @@ namespace RotateParticle.Jobs // // cloth // - NativeArray _clothUsedParticles = new(); - NativeArray<(SpringConstraint, SphereTriangle.ClothRect)> _clothRects = new(); + NativeArray _clothUsedParticles; + NativeArray<(SpringConstraint, SphereTriangle.ClothRect)> _clothRects; void IDisposable.Dispose() { @@ -53,6 +53,9 @@ namespace RotateParticle.Jobs if (_prevPositions.IsCreated) _prevPositions.Dispose(); if (_nextPositions.IsCreated) _nextPositions.Dispose(); if (_nextRotations.IsCreated) _nextRotations.Dispose(); + + if (_clothUsedParticles.IsCreated) _clothUsedParticles.Dispose(); + if (_clothRects.IsCreated) _clothRects.Dispose(); } (int index, bool isNew) GetTransformIndex(Transform t, @@ -178,8 +181,8 @@ namespace RotateParticle.Jobs // // cloths // - HashSet clothUsedParticles = new(); List<(SpringConstraint, SphereTriangle.ClothRect)> clothRects = new(); + _clothUsedParticles = new(_transforms.Count, Allocator.Persistent); var cloths = vrm.GetComponentsInChildren(); foreach (var cloth in cloths) { @@ -196,10 +199,10 @@ namespace RotateParticle.Jobs var b = s1.Particles[j]; var c = s1.Particles[j - 1]; var d = s0.Particles[j - 1]; - clothUsedParticles.Add(_transforms.IndexOf(a.Transform)); - clothUsedParticles.Add(_transforms.IndexOf(b.Transform)); - clothUsedParticles.Add(_transforms.IndexOf(c.Transform)); - clothUsedParticles.Add(_transforms.IndexOf(d.Transform)); + _clothUsedParticles[_transforms.IndexOf(a.Transform)] = true; + _clothUsedParticles[_transforms.IndexOf(b.Transform)] = true; + _clothUsedParticles[_transforms.IndexOf(c.Transform)] = true; + _clothUsedParticles[_transforms.IndexOf(d.Transform)] = true; if (i % 2 == 1) { // 互い違いに @@ -234,10 +237,10 @@ namespace RotateParticle.Jobs var b = s1.Particles[j]; var c = s1.Particles[j - 1]; var d = s0.Particles[j - 1]; - clothUsedParticles.Add(_transforms.IndexOf(a.Transform)); - clothUsedParticles.Add(_transforms.IndexOf(b.Transform)); - clothUsedParticles.Add(_transforms.IndexOf(c.Transform)); - clothUsedParticles.Add(_transforms.IndexOf(d.Transform)); + _clothUsedParticles[_transforms.IndexOf(a.Transform)] = true; + _clothUsedParticles[_transforms.IndexOf(b.Transform)] = true; + _clothUsedParticles[_transforms.IndexOf(c.Transform)] = true; + _clothUsedParticles[_transforms.IndexOf(d.Transform)] = true; if (i % 2 == 1) { // 互い違いに @@ -263,6 +266,7 @@ namespace RotateParticle.Jobs } } } + _clothRects = new(clothRects.ToArray(), Allocator.Persistent); } private static BlittableColliderType TranslateColliderType(VRM10SpringBoneColliderTypes colliderType) diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs index 50f3296ff..2ad1aa1f3 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleSystem.cs @@ -56,7 +56,7 @@ namespace RotateParticle return Color.gray; } - HashSet _clothUsedParticles = new(); + bool[] _clothUsedParticles; void IDisposable.Dispose() { @@ -67,6 +67,7 @@ namespace RotateParticle ParticleList list, Dictionary strandMap) { + _clothUsedParticles = new bool[_list._particles.Count]; for (int i = 1; i < cloth.Warps.Count; ++i) { var s0 = strandMap[cloth.Warps[i - 1]]; @@ -80,10 +81,10 @@ namespace RotateParticle var b = s1.Particles[j]; var c = s1.Particles[j - 1]; var d = s0.Particles[j - 1]; - _clothUsedParticles.Add(a.Init.Index); - _clothUsedParticles.Add(b.Init.Index); - _clothUsedParticles.Add(c.Init.Index); - _clothUsedParticles.Add(d.Init.Index); + _clothUsedParticles[a.Init.Index] = true; + _clothUsedParticles[b.Init.Index] = true; + _clothUsedParticles[c.Init.Index] = true; + _clothUsedParticles[d.Init.Index] = true; if (i % 2 == 1) { // 互い違いに @@ -116,10 +117,10 @@ namespace RotateParticle var b = s1.Particles[j]; var c = s1.Particles[j - 1]; var d = s0.Particles[j - 1]; - _clothUsedParticles.Add(a.Init.Index); - _clothUsedParticles.Add(b.Init.Index); - _clothUsedParticles.Add(c.Init.Index); - _clothUsedParticles.Add(d.Init.Index); + _clothUsedParticles[a.Init.Index] = true; + _clothUsedParticles[b.Init.Index] = true; + _clothUsedParticles[c.Init.Index] = true; + _clothUsedParticles[d.Init.Index] = true; if (i % 2 == 1) { // 互い違いに @@ -268,7 +269,7 @@ namespace RotateParticle for (int j = 0; j < _list._particles.Count; ++j) { // using var prof = new ProfileSample("Collision: Strand"); - if (_clothUsedParticles.Contains(j)) + if (_clothUsedParticles[j]) { // 布で処理された continue; From 2a6f71df88befca4e94ac1c13b722f70ce49212d Mon Sep 17 00:00:00 2001 From: ousttrue Date: Fri, 22 Nov 2024 21:29:24 +0900 Subject: [PATCH 059/113] index --- .../RotateParticle/Runtime/Jobs/Collision.cs | 18 +++--- .../RotateParticle/Runtime/Jobs/Particle.cs | 56 +++++++++---------- 2 files changed, 37 insertions(+), 37 deletions(-) diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Collision.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Collision.cs index b2e7893c2..81cfaa6e7 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Collision.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Collision.cs @@ -11,9 +11,9 @@ namespace RotateParticle.Jobs { [WriteOnly] public NativeArray CurrentCollider; - public void Execute(int index, TransformAccess transform) + public void Execute(int colliderIndex, TransformAccess transform) { - CurrentCollider[index] = transform.localToWorldMatrix; + CurrentCollider[colliderIndex] = transform.localToWorldMatrix; } } @@ -24,18 +24,18 @@ namespace RotateParticle.Jobs [ReadOnly] public NativeArray Info; [NativeDisableParallelForRestriction] public NativeArray NextPositions; - public void Execute(int index) + public void Execute(int particleIndex) { - var info = Info[index]; - var pos = NextPositions[index]; - for (int i = 0; i < Colliders.Length; ++i) + var info = Info[particleIndex]; + var pos = NextPositions[particleIndex]; + for (int colliderIndex = 0; colliderIndex < Colliders.Length; ++colliderIndex) { - var c = Colliders[i]; + var c = Colliders[colliderIndex]; switch (c.colliderType) { case BlittableColliderType.Sphere: { - var col_pos = CurrentColliders[i].MultiplyPoint(c.offset); + var col_pos = CurrentColliders[colliderIndex].MultiplyPoint(c.offset); var d = Vector3.Distance(pos, col_pos); var min_d = info.Settings.radius + c.radius; if (d < min_d) @@ -51,7 +51,7 @@ namespace RotateParticle.Jobs break; } } - NextPositions[index] = pos; + NextPositions[particleIndex] = pos; } } } \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Particle.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Particle.cs index e64eead76..64d99fe7f 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Particle.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Particle.cs @@ -41,15 +41,15 @@ namespace RotateParticle.Jobs [ReadOnly] public NativeArray Info; [WriteOnly] public NativeArray InputData; [WriteOnly] public NativeArray CurrentPositions; - public void Execute(int index, TransformAccess transform) + public void Execute(int particleIndex, TransformAccess transform) { - InputData[index] = new TransformData(transform); + InputData[particleIndex] = new TransformData(transform); - var particle = Info[index]; + var particle = Info[particleIndex]; if (particle.TransformType.PositionInput()) { // only warp root position update - CurrentPositions[index] = transform.position; + CurrentPositions[particleIndex] = transform.position; } } } @@ -64,9 +64,9 @@ namespace RotateParticle.Jobs [WriteOnly] public NativeArray NextPositions; [WriteOnly] public NativeArray NextRotations; - public void Execute(int index) + public void Execute(int particleIndex) { - var particle = Info[index]; + var particle = Info[particleIndex]; if (particle.TransformType.Movable()) { var parentIndex = particle.ParentIndex; @@ -76,22 +76,22 @@ namespace RotateParticle.Jobs var external = (particle.Settings.gravityDir * particle.Settings.gravityPower + Frame.Force) * Frame.DeltaTime; - var newPosition = CurrentPositions[index] - + (CurrentPositions[index] - PrevPositions[index]) * (1.0f - particle.Settings.dragForce) + var newPosition = CurrentPositions[particleIndex] + + (CurrentPositions[particleIndex] - PrevPositions[particleIndex]) * (1.0f - particle.Settings.dragForce) + parentParentRotation * parent.InitLocalRotation * particle.InitLocalPosition * particle.Settings.stiffnessForce * Frame.DeltaTime // 親の回転による子ボーンの移動目標 + external ; - NextPositions[index] = newPosition; + NextPositions[particleIndex] = newPosition; } else { // kinematic - NextPositions[index] = CurrentPositions[index]; + NextPositions[particleIndex] = CurrentPositions[particleIndex]; } - NextRotations[index] = CurrentTransforms[index].Rotation; + NextRotations[particleIndex] = CurrentTransforms[particleIndex].Rotation; } } @@ -103,15 +103,15 @@ namespace RotateParticle.Jobs [ReadOnly] public NativeArray Warps; [ReadOnly] public NativeArray Info; [NativeDisableParallelForRestriction] public NativeArray NextPositions; - public void Execute(int index) + public void Execute(int warpIndex) { - var warp = Warps[index]; - for (int i = warp.StartIndex; i < warp.EndIndex - 1; ++i) + var warp = Warps[warpIndex]; + for (int particleIndex = warp.StartIndex; particleIndex < warp.EndIndex - 1; ++particleIndex) { // 位置を長さで拘束 - NextPositions[i + 1] = NextPositions[i] + - (NextPositions[i + 1] - NextPositions[i]).normalized - * Info[i + 1].InitLocalPosition.magnitude; + NextPositions[particleIndex + 1] = NextPositions[particleIndex] + + (NextPositions[particleIndex + 1] - NextPositions[particleIndex]).normalized + * Info[particleIndex + 1].InitLocalPosition.magnitude; } } } @@ -126,17 +126,17 @@ namespace RotateParticle.Jobs [ReadOnly] public NativeArray CurrentTransforms; [NativeDisableParallelForRestriction] public NativeArray NextPositions; [NativeDisableParallelForRestriction] public NativeArray NextRotations; - public void Execute(int index) + public void Execute(int warpIndex) { - var warp = Warps[index]; - for (int i = warp.StartIndex; i < warp.EndIndex - 1; ++i) + var warp = Warps[warpIndex]; + for (int particleIndex = warp.StartIndex; particleIndex < warp.EndIndex - 1; ++particleIndex) { //回転を適用 - var p = Info[i]; - var rotation = NextRotations[p.ParentIndex] * Info[i].InitLocalRotation; - NextRotations[i] = Quaternion.FromToRotation( - rotation * Info[i + 1].InitLocalPosition, - NextPositions[i + 1] - NextPositions[i]) * rotation; + var p = Info[particleIndex]; + var rotation = NextRotations[p.ParentIndex] * Info[particleIndex].InitLocalRotation; + NextRotations[particleIndex] = Quaternion.FromToRotation( + rotation * Info[particleIndex + 1].InitLocalPosition, + NextPositions[particleIndex + 1] - NextPositions[particleIndex]) * rotation; } } } @@ -146,12 +146,12 @@ namespace RotateParticle.Jobs { [ReadOnly] public NativeArray Info; [ReadOnly] public NativeArray NextRotations; - public void Execute(int index, TransformAccess transform) + public void Execute(int particleIndex, TransformAccess transform) { - var info = Info[index]; + var info = Info[particleIndex]; if (info.TransformType.Writable()) { - transform.rotation = NextRotations[index]; + transform.rotation = NextRotations[particleIndex]; } } } From 42e781973343a9de11fd983e0a7798ced7466e7c Mon Sep 17 00:00:00 2001 From: ousttrue Date: Sat, 23 Nov 2024 03:25:41 +0900 Subject: [PATCH 060/113] WIP cloth --- .../RotateParticle/Runtime/Jobs/Collision.cs | 197 ++++++++++++++++-- .../Runtime/Jobs/RotateParticleJobSystem.cs | 4 +- .../Runtime/SphereTriangle/PositionList.cs | 2 +- 3 files changed, 183 insertions(+), 20 deletions(-) diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Collision.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Collision.cs index 81cfaa6e7..80712377d 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Collision.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Collision.cs @@ -1,3 +1,5 @@ +using System; +using SphereTriangle; using UniGLTF.SpringBoneJobs.Blittables; using Unity.Collections; using Unity.Jobs; @@ -19,39 +21,198 @@ namespace RotateParticle.Jobs public struct CollisionJob : IJobParallelFor { + // collider [ReadOnly] public NativeArray Colliders; [ReadOnly] public NativeArray CurrentColliders; + + // particle [ReadOnly] public NativeArray Info; [NativeDisableParallelForRestriction] public NativeArray NextPositions; - public void Execute(int particleIndex) + // cloth + [ReadOnly] public NativeArray ClothUsedParticles; + [ReadOnly] public NativeArray<(SpringConstraint, ClothRect)> ClothRects; + + public void Execute(int colliderIndex) { - var info = Info[particleIndex]; - var pos = NextPositions[particleIndex]; - for (int colliderIndex = 0; colliderIndex < Colliders.Length; ++colliderIndex) + var collider = Colliders[colliderIndex]; + var col_pos = CurrentColliders[colliderIndex].MultiplyPoint(collider.offset); + switch (collider.colliderType) { - var c = Colliders[colliderIndex]; - switch (c.colliderType) - { - case BlittableColliderType.Sphere: + case BlittableColliderType.Sphere: + { + for (int particleIndex = 0; particleIndex < NextPositions.Length; ++particleIndex) { - var col_pos = CurrentColliders[colliderIndex].MultiplyPoint(c.offset); - var d = Vector3.Distance(pos, col_pos); - var min_d = info.Settings.radius + c.radius; - if (d < min_d) + if (ClothUsedParticles[particleIndex]) { - Vector3 normal = (pos - col_pos).normalized; - pos += normal * (min_d - d); + var info = Info[particleIndex]; + var pos = NextPositions[particleIndex]; + + var d = Vector3.Distance(pos, col_pos); + var min_d = info.Settings.radius + collider.radius; + if (d < min_d) + { + Vector3 normal = (pos - col_pos).normalized; + pos += normal * (min_d - d); + } + NextPositions[particleIndex] = pos; } } - break; - default: + for (int rectIndex = 0; rectIndex < ClothRects.Length; ++rectIndex) + { + var (spring, rect) = ClothRects[rectIndex]; + + // using (new ProfileSample("Rect: Prepare")) + // _s0.BeginFrame(); + // _s1.BeginFrame(); + + var a = NextPositions[rect._a]; + var b = NextPositions[rect._b]; + var c = NextPositions[rect._c]; + var d = NextPositions[rect._d]; + + // d x-x c + // |/ + // a x + var _triangle1 = new Triangle(c, d, a); + // x c + // /| + // a x-x b + var _triangle0 = new Triangle(a, b, c); + + // using (new ProfileSample("Rect: Collide")) + { + var aabb = GetBoundsFrom4(a, b, c, d); + + if (!aabb.Intersects(GetBounds(collider, col_pos))) + { + continue; + } + + // 面の片側だけにヒットさせる + // 行き過ぎて戻るときに素通りする + // var p = _triangle0.Plane.ClosestPointOnPlane(col_pos); + // var dot = Vector3.Dot(_triangle0.Plane.normal, col_pos - p); + // if (_initialColliderNormalSide[collider] * dot < 0) + // { + // // 片側 + // continue; + // } + } + + if (TryCollide(collider, col_pos, _triangle0, out var l0)) + { + // _trinagle0Collision = 1.0f; + NextPositions[rect._a] = l0.GetPoint(collider.radius); + // NextPositions[rect._b]= l0, collider.Radius); + // NextPositions[rect._c]= l0, collider.Radius); + } + if (TryCollide(collider, col_pos, _triangle1, out var l1)) + { + // _triangle1Collision = 1.0f; + NextPositions[rect._c] = l1.GetPoint(collider.radius); + // list.CollisionMove(_rect._d, l1, collider.Radius); + // list.CollisionMove(_rect._a, l1, collider.Radius); + } + } // TODO break; - } + } + + default: + break; + } + } + + static bool TryCollide(BlittableCollider collider, Vector3 col_pos, in Triangle t, out LineSegment l) + { + if (collider.colliderType == BlittableColliderType.Capsule) + { + throw new NotImplementedException(); + // // capsule + // TriangleCapsuleCollisionSolver.Result result = default; + // // using (new ProfileSample("Capsule: Collide")) + // { + // result = solver.Collide(t, collider, new(collider.HeadWorldPosition, collider.TailWorldPosition), collider.Radius); + // } + // // using (new ProfileSample("Capsule: TryGetClosest")) + // { + // var type = result.TryGetClosest(out l); + // return type.HasValue; + // } + } + else + { + // sphere + // using var profile = new ProfileSample("Sphere"); + return TryCollideSphere(t, col_pos, collider.radius, out l); + } + } + + /// + /// + /// + /// + /// + /// + /// collider => 衝突点 への線分を返す + static bool TryCollideSphere(in Triangle triangle, in Vector3 collider, float radius, out LineSegment l) + { + var p = triangle.Plane.ClosestPointOnPlane(collider); + var distance = Vector3.Distance(p, collider); + if (distance > radius) + { + l = default; + return false; + } + + if (triangle.IsSameSide(p)) + { + l = new LineSegment(collider, p); + return true; + } + + var (closestPoint, d) = triangle.GetClosest(collider); + if (d > radius) + { + l = default; + return false; + } + l = new LineSegment(collider, closestPoint); + return true; + } + + public static Bounds GetBoundsFrom4(in Vector3 a, in Vector3 b, in Vector3 c, in Vector3 d) + { + var aabb = new Bounds(a, Vector3.zero); + aabb.Encapsulate(b); + aabb.Encapsulate(c); + aabb.Encapsulate(d); + return aabb; + } + + public static Bounds GetBounds(BlittableCollider collider, Vector3 col_pos) + { + switch (collider.colliderType) + { + case BlittableColliderType.Capsule: + { + // var h = HeadWorldPosition; + // var t = TailWorldPosition; + // var d = h - t; + // var aabb = new Bounds((h + t) * 0.5f, new Vector3(Mathf.Abs(d.x), Mathf.Abs(d.y), Mathf.Abs(d.z))); + // aabb.Expand(Radius * 2); + // return aabb; + throw new NotImplementedException(); + } + + case BlittableColliderType.Sphere: + return new Bounds(col_pos, new Vector3(collider.radius, collider.radius, collider.radius)); + + default: + throw new NotImplementedException(); } - NextPositions[particleIndex] = pos; } } } \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs index 05fac9621..01c62eb7d 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs @@ -334,7 +334,9 @@ namespace RotateParticle.Jobs CurrentColliders = _currentColliders, Info = _info, NextPositions = _nextPositions, - }.Schedule(_info.Length, 128, handle); + ClothUsedParticles = _clothUsedParticles, + ClothRects = _clothRects, + }.Schedule(_colliders.Length, 128, handle); // NextPositions から NextRotations を作る handle = new ApplyRotationJob diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/PositionList.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/PositionList.cs index e35deba49..49498e591 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/PositionList.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SphereTriangle/PositionList.cs @@ -32,7 +32,7 @@ namespace SphereTriangle public Dictionary BoundsCache = new(); - public Bounds GetBoundsFrom4(in Vector3 a, in Vector3 b, in Vector3 c, in Vector3 d) + public static Bounds GetBoundsFrom4(in Vector3 a, in Vector3 b, in Vector3 c, in Vector3 d) { var aabb = new Bounds(a, Vector3.zero); aabb.Encapsulate(b); From fd7f6e47ba50d40f47990354abb000eec79638e0 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Sun, 24 Nov 2024 00:49:32 +0900 Subject: [PATCH 061/113] cloth collision --- .../RotateParticle/Runtime/Jobs/Collision.cs | 157 ++++++++++++------ .../RotateParticle/Runtime/Jobs/Constraint.cs | 52 ++++++ .../Runtime/Jobs/Constraint.cs.meta | 11 ++ .../RotateParticle/Runtime/Jobs/Particle.cs | 54 +----- .../Runtime/Jobs/RotateParticleJobSystem.cs | 69 +++++++- 5 files changed, 238 insertions(+), 105 deletions(-) create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Constraint.cs create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Constraint.cs.meta diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Collision.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Collision.cs index 80712377d..b5df60225 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Collision.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Collision.cs @@ -19,7 +19,7 @@ namespace RotateParticle.Jobs } } - public struct CollisionJob : IJobParallelFor + public struct StrandCollisionJob : IJobParallelFor { // collider [ReadOnly] public NativeArray Colliders; @@ -27,27 +27,24 @@ namespace RotateParticle.Jobs // particle [ReadOnly] public NativeArray Info; - [NativeDisableParallelForRestriction] public NativeArray NextPositions; - - // cloth + [ReadOnly] public NativeArray NextPositions; [ReadOnly] public NativeArray ClothUsedParticles; - [ReadOnly] public NativeArray<(SpringConstraint, ClothRect)> ClothRects; + [WriteOnly] public NativeArray StrandCollision; - public void Execute(int colliderIndex) + public void Execute(int particleIndex) { - var collider = Colliders[colliderIndex]; - var col_pos = CurrentColliders[colliderIndex].MultiplyPoint(collider.offset); - switch (collider.colliderType) + if (!ClothUsedParticles[particleIndex]) { - case BlittableColliderType.Sphere: + var info = Info[particleIndex]; + var pos = NextPositions[particleIndex]; + for (int colliderIndex = 0; colliderIndex < Colliders.Length; ++colliderIndex) + { + var collider = Colliders[colliderIndex]; + var col_pos = CurrentColliders[colliderIndex].MultiplyPoint(collider.offset); + switch (collider.colliderType) { - for (int particleIndex = 0; particleIndex < NextPositions.Length; ++particleIndex) - { - if (ClothUsedParticles[particleIndex]) + case BlittableColliderType.Sphere: { - var info = Info[particleIndex]; - var pos = NextPositions[particleIndex]; - var d = Vector3.Distance(pos, col_pos); var min_d = info.Settings.radius + collider.radius; if (d < min_d) @@ -55,31 +52,69 @@ namespace RotateParticle.Jobs Vector3 normal = (pos - col_pos).normalized; pos += normal * (min_d - d); } - NextPositions[particleIndex] = pos; + break; } - } - for (int rectIndex = 0; rectIndex < ClothRects.Length; ++rectIndex) + default: + break; + } + } + StrandCollision[particleIndex] = pos; + } + } + } + + public struct ClothCollisionJob : IJobParallelFor + { + // collider + [ReadOnly] public NativeArray Colliders; + [ReadOnly] public NativeArray CurrentColliders; + + // particle + [ReadOnly] public NativeArray Info; + [ReadOnly] public NativeArray NextPositions; + [NativeDisableParallelForRestriction] public NativeArray CollisionCount; + [NativeDisableParallelForRestriction] public NativeArray CollisionDelta; + + // cloth + [ReadOnly] public NativeArray<(SpringConstraint, ClothRect)> ClothRects; + + private void CollisionMove(int particleIndex, Vector3 delta) + { + CollisionCount[particleIndex] += 1; + CollisionDelta[particleIndex] += delta; + } + + public void Execute(int rectIndex) + { + var (spring, rect) = ClothRects[rectIndex]; + + // using (new ProfileSample("Rect: Prepare")) + // _s0.BeginFrame(); + // _s1.BeginFrame(); + + var a = NextPositions[rect._a]; + var b = NextPositions[rect._b]; + var c = NextPositions[rect._c]; + var d = NextPositions[rect._d]; + + // d x-x c + // |/ + // a x + var _triangle1 = new Triangle(c, d, a); + // x c + // /| + // a x-x b + var _triangle0 = new Triangle(a, b, c); + + for (int colliderIndex = 0; colliderIndex < Colliders.Length; ++colliderIndex) + { + var collider = Colliders[colliderIndex]; + var col_pos = CurrentColliders[colliderIndex].MultiplyPoint(collider.offset); + switch (collider.colliderType) + { + case BlittableColliderType.Sphere: { - var (spring, rect) = ClothRects[rectIndex]; - - // using (new ProfileSample("Rect: Prepare")) - // _s0.BeginFrame(); - // _s1.BeginFrame(); - - var a = NextPositions[rect._a]; - var b = NextPositions[rect._b]; - var c = NextPositions[rect._c]; - var d = NextPositions[rect._d]; - - // d x-x c - // |/ - // a x - var _triangle1 = new Triangle(c, d, a); - // x c - // /| - // a x-x b - var _triangle0 = new Triangle(a, b, c); // using (new ProfileSample("Rect: Collide")) { @@ -103,25 +138,22 @@ namespace RotateParticle.Jobs if (TryCollide(collider, col_pos, _triangle0, out var l0)) { - // _trinagle0Collision = 1.0f; - NextPositions[rect._a] = l0.GetPoint(collider.radius); - // NextPositions[rect._b]= l0, collider.Radius); - // NextPositions[rect._c]= l0, collider.Radius); + CollisionMove(rect._a, l0.GetDelta(collider.radius)); + CollisionMove(rect._b, l0.GetDelta(collider.radius)); + CollisionMove(rect._c, l0.GetDelta(collider.radius)); } if (TryCollide(collider, col_pos, _triangle1, out var l1)) { - // _triangle1Collision = 1.0f; - NextPositions[rect._c] = l1.GetPoint(collider.radius); - // list.CollisionMove(_rect._d, l1, collider.Radius); - // list.CollisionMove(_rect._a, l1, collider.Radius); + CollisionMove(rect._c, l0.GetDelta(collider.radius)); + CollisionMove(rect._d, l0.GetDelta(collider.radius)); + CollisionMove(rect._a, l0.GetDelta(collider.radius)); } } - // TODO break; - } - default: - break; + default: + break; + } } } @@ -214,5 +246,30 @@ namespace RotateParticle.Jobs throw new NotImplementedException(); } } + + } + + public struct CollisionApplyJob : IJobParallelFor + { + [ReadOnly] public NativeArray ClothUsedParticles; + [ReadOnly] public NativeArray StrandCollision; + [ReadOnly] public NativeArray ClothCollisionCount; + [ReadOnly] public NativeArray ClothCollisionDelta; + [NativeDisableParallelForRestriction] public NativeArray NextPosition; + + public void Execute(int particleIndex) + { + if (ClothUsedParticles[particleIndex]) + { + if (ClothCollisionCount[particleIndex] > 0) + { + NextPosition[particleIndex] += (ClothCollisionDelta[particleIndex] / ClothCollisionCount[particleIndex]); + } + } + else + { + NextPosition[particleIndex] = StrandCollision[particleIndex]; + } + } } } \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Constraint.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Constraint.cs new file mode 100644 index 000000000..f76cd35d6 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Constraint.cs @@ -0,0 +1,52 @@ +using Unity.Collections; +using Unity.Jobs; +using UnityEngine; + +namespace RotateParticle.Jobs +{ + /// + /// 親の位置に依存。再帰 + /// + public struct ParentLengthConstraintJob : IJobParallelFor + { + [ReadOnly] public NativeArray Warps; + [ReadOnly] public NativeArray Info; + [NativeDisableParallelForRestriction] public NativeArray NextPositions; + public void Execute(int warpIndex) + { + var warp = Warps[warpIndex]; + for (int particleIndex = warp.StartIndex; particleIndex < warp.EndIndex - 1; ++particleIndex) + { + // 位置を長さで拘束 + NextPositions[particleIndex + 1] = NextPositions[particleIndex] + + (NextPositions[particleIndex + 1] - NextPositions[particleIndex]).normalized + * Info[particleIndex + 1].InitLocalPosition.magnitude; + } + } + } + + /// + /// 親の回転に依存。再帰 + /// + public struct ApplyRotationJob : IJobParallelFor + { + [ReadOnly] public NativeArray Warps; + [ReadOnly] public NativeArray Info; + [ReadOnly] public NativeArray CurrentTransforms; + [NativeDisableParallelForRestriction] public NativeArray NextPositions; + [NativeDisableParallelForRestriction] public NativeArray NextRotations; + public void Execute(int warpIndex) + { + var warp = Warps[warpIndex]; + for (int particleIndex = warp.StartIndex; particleIndex < warp.EndIndex - 1; ++particleIndex) + { + //回転を適用 + var p = Info[particleIndex]; + var rotation = NextRotations[p.ParentIndex] * Info[particleIndex].InitLocalRotation; + NextRotations[particleIndex] = Quaternion.FromToRotation( + rotation * Info[particleIndex + 1].InitLocalPosition, + NextPositions[particleIndex + 1] - NextPositions[particleIndex]) * rotation; + } + } + } +} \ No newline at end of file diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Constraint.cs.meta b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Constraint.cs.meta new file mode 100644 index 000000000..aeda428d0 --- /dev/null +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Constraint.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 658703b04bb98bc438094be1f7959d73 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Particle.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Particle.cs index 64d99fe7f..2bb53acbd 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Particle.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Particle.cs @@ -41,6 +41,10 @@ namespace RotateParticle.Jobs [ReadOnly] public NativeArray Info; [WriteOnly] public NativeArray InputData; [WriteOnly] public NativeArray CurrentPositions; + + [WriteOnly] public NativeArray CollisionCount; + [WriteOnly] public NativeArray CollisionDelta; + public void Execute(int particleIndex, TransformAccess transform) { InputData[particleIndex] = new TransformData(transform); @@ -51,6 +55,10 @@ namespace RotateParticle.Jobs // only warp root position update CurrentPositions[particleIndex] = transform.position; } + + // clear cloth + CollisionCount[particleIndex] = 0; + CollisionDelta[particleIndex] = Vector3.zero; } } @@ -95,52 +103,6 @@ namespace RotateParticle.Jobs } } - /// - /// 親の位置に依存。再帰 - /// - public struct ParentLengthConstraintJob : IJobParallelFor - { - [ReadOnly] public NativeArray Warps; - [ReadOnly] public NativeArray Info; - [NativeDisableParallelForRestriction] public NativeArray NextPositions; - public void Execute(int warpIndex) - { - var warp = Warps[warpIndex]; - for (int particleIndex = warp.StartIndex; particleIndex < warp.EndIndex - 1; ++particleIndex) - { - // 位置を長さで拘束 - NextPositions[particleIndex + 1] = NextPositions[particleIndex] + - (NextPositions[particleIndex + 1] - NextPositions[particleIndex]).normalized - * Info[particleIndex + 1].InitLocalPosition.magnitude; - } - } - } - - /// - /// 親の回転に依存。再帰 - /// - public struct ApplyRotationJob : IJobParallelFor - { - [ReadOnly] public NativeArray Warps; - [ReadOnly] public NativeArray Info; - [ReadOnly] public NativeArray CurrentTransforms; - [NativeDisableParallelForRestriction] public NativeArray NextPositions; - [NativeDisableParallelForRestriction] public NativeArray NextRotations; - public void Execute(int warpIndex) - { - var warp = Warps[warpIndex]; - for (int particleIndex = warp.StartIndex; particleIndex < warp.EndIndex - 1; ++particleIndex) - { - //回転を適用 - var p = Info[particleIndex]; - var rotation = NextRotations[p.ParentIndex] * Info[particleIndex].InitLocalRotation; - NextRotations[particleIndex] = Quaternion.FromToRotation( - rotation * Info[particleIndex + 1].InitLocalPosition, - NextPositions[particleIndex + 1] - NextPositions[particleIndex]) * rotation; - } - } - } - // [Output] public struct OutputTransformJob : IJobParallelForTransform { diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs index 01c62eb7d..4ac049121 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs @@ -18,11 +18,17 @@ namespace RotateParticle.Jobs { Vrm10Instance _vrm; + // + // collider + // List _colliderTransforms; TransformAccessArray _colliderTransformAccessArray; NativeArray _currentColliders; NativeArray _colliders; + // + // particle + // List _transforms; TransformAccessArray _transformAccessArray; NativeArray _inputData; @@ -32,6 +38,13 @@ namespace RotateParticle.Jobs NativeArray _nextPositions; NativeArray _nextRotations; + NativeArray _strandCollision; + NativeArray _clothCollisionCount; + NativeArray _clothCollisionDelta; + + // + // warp + // NativeArray _warps; // @@ -53,6 +66,11 @@ namespace RotateParticle.Jobs if (_prevPositions.IsCreated) _prevPositions.Dispose(); if (_nextPositions.IsCreated) _nextPositions.Dispose(); if (_nextRotations.IsCreated) _nextRotations.Dispose(); + if (_strandCollision.IsCreated) _strandCollision.Dispose(); + if (_clothCollisionCount.IsCreated) _clothCollisionCount.Dispose(); + if (_clothCollisionDelta.IsCreated) _clothCollisionDelta.Dispose(); + + if (_warps.IsCreated) _warps.Dispose(); if (_clothUsedParticles.IsCreated) _clothUsedParticles.Dispose(); if (_clothRects.IsCreated) _clothRects.Dispose(); @@ -177,6 +195,9 @@ namespace RotateParticle.Jobs _nextPositions = new(pos.Length, Allocator.Persistent); _nextRotations = new(pos.Length, Allocator.Persistent); _info = new(info.ToArray(), Allocator.Persistent); + _strandCollision = new(pos.Length, Allocator.Persistent); + _clothCollisionCount = new(pos.Length, Allocator.Persistent); + _clothCollisionDelta = new(pos.Length, Allocator.Persistent); // // cloths @@ -305,7 +326,10 @@ namespace RotateParticle.Jobs Info = _info, InputData = _inputData, CurrentPositions = _currentPositions, - }.Schedule(_transformAccessArray, handle); + + CollisionCount = _clothCollisionCount, + CollisionDelta = _clothCollisionDelta, + }.Schedule(_transformAccessArray, handle); // verlet handle = new VerletJob @@ -328,15 +352,42 @@ namespace RotateParticle.Jobs }.Schedule(_warps.Length, 16, handle); // collision - handle = new CollisionJob { - Colliders = _colliders, - CurrentColliders = _currentColliders, - Info = _info, - NextPositions = _nextPositions, - ClothUsedParticles = _clothUsedParticles, - ClothRects = _clothRects, - }.Schedule(_colliders.Length, 128, handle); + var handle0 = new StrandCollisionJob + { + Colliders = _colliders, + CurrentColliders = _currentColliders, + + Info = _info, + NextPositions = _nextPositions, + ClothUsedParticles = _clothUsedParticles, + StrandCollision = _strandCollision, + }.Schedule(_info.Length, 128, handle); + + var handle1 = new ClothCollisionJob + { + Colliders = _colliders, + CurrentColliders = _currentColliders, + + Info = _info, + NextPositions = _nextPositions, + CollisionCount = _clothCollisionCount, + CollisionDelta = _clothCollisionDelta, + + ClothRects = _clothRects, + }.Schedule(_clothRects.Length, 128, handle); + + handle = JobHandle.CombineDependencies(handle0, handle1); + + handle = new CollisionApplyJob + { + ClothUsedParticles = _clothUsedParticles, + StrandCollision = _strandCollision, + ClothCollisionCount = _clothCollisionCount, + ClothCollisionDelta = _clothCollisionDelta, + NextPosition = _nextPositions, + }.Schedule(_info.Length, 128, handle); + } // NextPositions から NextRotations を作る handle = new ApplyRotationJob From 9f96479f16b7365d3d693ee687a4c27f237335b4 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Sun, 24 Nov 2024 02:33:46 +0900 Subject: [PATCH 062/113] WeftConstraintJob --- .../RotateParticle/Runtime/Jobs/Collision.cs | 10 ++++----- .../RotateParticle/Runtime/Jobs/Constraint.cs | 22 +++++++++++++++++++ .../RotateParticle/Runtime/Jobs/Particle.cs | 5 ++++- .../Runtime/Jobs/RotateParticleJobSystem.cs | 17 +++++++++++++- .../Runtime/SpringConstraint.cs | 6 ++--- 5 files changed, 49 insertions(+), 11 deletions(-) diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Collision.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Collision.cs index b5df60225..0b55d184a 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Collision.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Collision.cs @@ -97,6 +97,7 @@ namespace RotateParticle.Jobs var b = NextPositions[rect._b]; var c = NextPositions[rect._c]; var d = NextPositions[rect._d]; + var aabb = GetBoundsFrom4(a, b, c, d); // d x-x c // |/ @@ -115,11 +116,8 @@ namespace RotateParticle.Jobs { case BlittableColliderType.Sphere: { - // using (new ProfileSample("Rect: Collide")) { - var aabb = GetBoundsFrom4(a, b, c, d); - if (!aabb.Intersects(GetBounds(collider, col_pos))) { continue; @@ -144,9 +142,9 @@ namespace RotateParticle.Jobs } if (TryCollide(collider, col_pos, _triangle1, out var l1)) { - CollisionMove(rect._c, l0.GetDelta(collider.radius)); - CollisionMove(rect._d, l0.GetDelta(collider.radius)); - CollisionMove(rect._a, l0.GetDelta(collider.radius)); + CollisionMove(rect._c, l1.GetDelta(collider.radius)); + CollisionMove(rect._d, l1.GetDelta(collider.radius)); + CollisionMove(rect._a, l1.GetDelta(collider.radius)); } } break; diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Constraint.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Constraint.cs index f76cd35d6..ab1eed9a3 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Constraint.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Constraint.cs @@ -1,3 +1,4 @@ +using SphereTriangle; using Unity.Collections; using Unity.Jobs; using UnityEngine; @@ -25,6 +26,27 @@ namespace RotateParticle.Jobs } } + public struct WeftConstraintJob : IJobParallelFor + { + public float Hookean; + FrameInfo Frame; + [ReadOnly] public NativeArray<(SpringConstraint, ClothRect)> ClothRects; + [ReadOnly] public NativeArray CurrentPositions; + [NativeDisableParallelForRestriction] public NativeArray Force; + + public void Execute(int rectIndex) + { + var (spring, rect) = ClothRects[rectIndex]; + var p0 = CurrentPositions[spring._p0]; + var p1 = CurrentPositions[spring._p1]; + var d = Vector3.Distance(p0, p1); + var f = (d - spring._rest) * Hookean; + var dx = (p1 - p0).normalized * f / Frame.SqDeltaTime; + Force[spring._p0] += dx; + Force[spring._p1] -= dx; + } + } + /// /// 親の回転に依存。再帰 /// diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Particle.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Particle.cs index 2bb53acbd..bdf3fb62e 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Particle.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/Particle.cs @@ -44,6 +44,7 @@ namespace RotateParticle.Jobs [WriteOnly] public NativeArray CollisionCount; [WriteOnly] public NativeArray CollisionDelta; + [WriteOnly] public NativeArray Forces; public void Execute(int particleIndex, TransformAccess transform) { @@ -59,6 +60,7 @@ namespace RotateParticle.Jobs // clear cloth CollisionCount[particleIndex] = 0; CollisionDelta[particleIndex] = Vector3.zero; + Forces[particleIndex] = Vector3.zero; } } @@ -67,6 +69,7 @@ namespace RotateParticle.Jobs public FrameInfo Frame; [ReadOnly] public NativeArray Info; [ReadOnly] public NativeArray CurrentTransforms; + [ReadOnly] public NativeArray Forces; [ReadOnly] public NativeArray CurrentPositions; [ReadOnly] public NativeArray PrevPositions; [WriteOnly] public NativeArray NextPositions; @@ -78,7 +81,7 @@ namespace RotateParticle.Jobs if (particle.TransformType.Movable()) { var parentIndex = particle.ParentIndex; - var parentPosition = CurrentPositions[parentIndex]; + // var parentPosition = CurrentPositions[parentIndex]; var parent = Info[parentIndex]; var parentParentRotation = CurrentTransforms[parent.ParentIndex].Rotation; diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs index 4ac049121..90d9bad0c 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/Jobs/RotateParticleJobSystem.cs @@ -41,6 +41,7 @@ namespace RotateParticle.Jobs NativeArray _strandCollision; NativeArray _clothCollisionCount; NativeArray _clothCollisionDelta; + NativeArray _forces; // // warp @@ -69,6 +70,7 @@ namespace RotateParticle.Jobs if (_strandCollision.IsCreated) _strandCollision.Dispose(); if (_clothCollisionCount.IsCreated) _clothCollisionCount.Dispose(); if (_clothCollisionDelta.IsCreated) _clothCollisionDelta.Dispose(); + if (_forces.IsCreated) _forces.Dispose(); if (_warps.IsCreated) _warps.Dispose(); @@ -198,6 +200,7 @@ namespace RotateParticle.Jobs _strandCollision = new(pos.Length, Allocator.Persistent); _clothCollisionCount = new(pos.Length, Allocator.Persistent); _clothCollisionDelta = new(pos.Length, Allocator.Persistent); + _forces = new(pos.Length, Allocator.Persistent); // // cloths @@ -326,10 +329,20 @@ namespace RotateParticle.Jobs Info = _info, InputData = _inputData, CurrentPositions = _currentPositions, + Forces = _forces, CollisionCount = _clothCollisionCount, CollisionDelta = _clothCollisionDelta, - }.Schedule(_transformAccessArray, handle); + }.Schedule(_transformAccessArray, handle); + + // spring(cloth weft) + handle = new WeftConstraintJob + { + ClothRects = _clothRects, + CurrentPositions = _currentPositions, + + Force = _forces, + }.Schedule(_clothRects.Length, 128, handle); // verlet handle = new VerletJob @@ -339,6 +352,8 @@ namespace RotateParticle.Jobs CurrentTransforms = _inputData, PrevPositions = _prevPositions, CurrentPositions = _currentPositions, + Forces = _forces, + NextPositions = _nextPositions, NextRotations = _nextRotations, }.Schedule(_info.Length, 128, handle); diff --git a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SpringConstraint.cs b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SpringConstraint.cs index 9aa8dd2a0..b2d26100a 100644 --- a/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SpringConstraint.cs +++ b/Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/SpringConstraint.cs @@ -6,12 +6,12 @@ namespace RotateParticle { public struct SpringConstraint { - int _p0; + public int _p0; - int _p1; + public int _p1; // 初期長さ - float _rest; + public float _rest; public SpringConstraint(int p0, int p1, float d) { From b47ab9abb76dde04bf4d2a5f1dc08ca940e0c104 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Mon, 25 Nov 2024 14:38:25 +0900 Subject: [PATCH 063/113] m_useJob --- .../ClothSample/ClothViewer/ClothViewer.unity | 676 ++++++++++-------- .../ClothSample/ClothViewer/ClothViewerUI.cs | 329 +++------ .../ClothSample/ClothViewer/TextFields.cs | 141 ++++ .../ClothViewer/TextFields.cs.meta | 11 + .../Runtime/Components/RectCloth.cs | 2 +- .../Runtime/Components/WarpRoot.cs | 8 +- .../Runtime/RotateParticleJobRuntime.cs | 97 +++ .../Runtime/RotateParticleJobRuntime.cs.meta | 11 + .../RotateParticleSpringboneRuntime.cs | 6 +- .../Runtime/RotateParticleSystem.cs | 12 +- 10 files changed, 762 insertions(+), 531 deletions(-) create mode 100644 Assets/VRM10_Samples/ClothSample/ClothViewer/TextFields.cs create mode 100644 Assets/VRM10_Samples/ClothSample/ClothViewer/TextFields.cs.meta create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleJobRuntime.cs create mode 100644 Assets/VRM10_Samples/ClothSample/RotateParticle/Runtime/RotateParticleJobRuntime.cs.meta diff --git a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewer.unity b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewer.unity index c52c3e245..75d5db057 100644 --- a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewer.unity +++ b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewer.unity @@ -38,7 +38,6 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 0} - m_IndirectSpecularColor: {r: 0.18028381, g: 0.22571406, b: 0.30692294, a: 1} m_UseRadianceAmbientProbe: 0 --- !u!157 &3 LightmapSettings: @@ -105,7 +104,7 @@ NavMeshSettings: serializedVersion: 2 m_ObjectHideFlags: 0 m_BuildSettings: - serializedVersion: 2 + serializedVersion: 3 agentTypeID: 0 agentRadius: 0.5 agentHeight: 2 @@ -118,7 +117,7 @@ NavMeshSettings: cellSize: 0.16666667 manualTileSize: 0 tileSize: 256 - accuratePlacement: 0 + buildHeightMesh: 0 maxJobWorkers: 0 preserveTilesOutsideBounds: 0 debug: @@ -156,7 +155,6 @@ RectTransform: m_Children: - {fileID: 1189866557} m_Father: {fileID: 1767738854} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} @@ -232,7 +230,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 339774397} - m_RootOrder: 18 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -314,13 +311,98 @@ RectTransform: - {fileID: 644517400} - {fileID: 1268276255} m_Father: {fileID: 1787938566} - 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!1 &135168671 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 135168672} + - component: {fileID: 135168673} + m_Layer: 5 + m_Name: UseJob + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &135168672 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 135168671} + 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_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 469489023} + - {fileID: 1437601637} + m_Father: {fileID: 339774397} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 162, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &135168673 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 135168671} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9085046f02f69544eb97fd06b6048fe2, 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: Highlighted + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 469489024} + toggleTransition: 1 + graphic: {fileID: 1684483643} + m_Group: {fileID: 0} + onValueChanged: + m_PersistentCalls: + m_Calls: [] + m_IsOn: 0 --- !u!1 &153452228 GameObject: m_ObjectHideFlags: 0 @@ -353,7 +435,6 @@ RectTransform: - {fileID: 1263556355} - {fileID: 1422965364} m_Father: {fileID: 339774397} - m_RootOrder: 7 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -403,7 +484,7 @@ MonoBehaviour: m_TargetGraphic: {fileID: 1263556356} toggleTransition: 1 graphic: {fileID: 962537953} - m_Group: {fileID: 224350194} + m_Group: {fileID: 0} onValueChanged: m_PersistentCalls: m_Calls: [] @@ -440,7 +521,6 @@ RectTransform: m_Children: - {fileID: 1270311309} m_Father: {fileID: 602093298} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} @@ -518,7 +598,6 @@ RectTransform: m_Children: - {fileID: 1923525315} m_Father: {fileID: 339774397} - m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -639,7 +718,6 @@ RectTransform: m_Children: - {fileID: 450042406} m_Father: {fileID: 935566651} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} @@ -715,7 +793,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 2010083454} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} @@ -820,13 +897,13 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 204388501} + serializedVersion: 2 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &224350190 GameObject: @@ -860,7 +937,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 339774397} - m_RootOrder: 8 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -945,6 +1021,7 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 241398688} + serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 1.2, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} @@ -952,7 +1029,6 @@ Transform: m_Children: - {fileID: 1629460662} m_Father: {fileID: 0} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &251940583 GameObject: @@ -985,7 +1061,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 452923209} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} @@ -1062,7 +1137,6 @@ RectTransform: m_Children: - {fileID: 800895692} m_Father: {fileID: 644517400} - m_RootOrder: 7 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -1142,7 +1216,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 644517400} - m_RootOrder: 8 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -1217,13 +1290,13 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 322182884} + serializedVersion: 2 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!23 &322182886 MeshRenderer: @@ -1275,9 +1348,17 @@ MeshCollider: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 322182884} m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 m_IsTrigger: 0 + m_ProvidesContacts: 0 m_Enabled: 1 - serializedVersion: 4 + serializedVersion: 5 m_Convex: 0 m_CookingOptions: 30 m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} @@ -1321,28 +1402,26 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: - {fileID: 1621794411} + - {fileID: 602093298} - {fileID: 2009818432} - - {fileID: 168425995} - - {fileID: 1307084561} + - {fileID: 1767706907} - {fileID: 947409974} + - {fileID: 135168672} - {fileID: 2144476967} - {fileID: 1194499280} - {fileID: 153452229} - {fileID: 224350191} + - {fileID: 168425995} + - {fileID: 1307084561} - {fileID: 1791103379} - {fileID: 1311520909} - - {fileID: 1557052150} - - {fileID: 1767706907} - - {fileID: 974864191} - {fileID: 597950322} - {fileID: 935566651} - {fileID: 634488421} - {fileID: 1767738854} - {fileID: 103723704} - {fileID: 1438613464} - - {fileID: 602093298} m_Father: {fileID: 124675794} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 1} @@ -1444,7 +1523,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1434602809} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -1562,7 +1640,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 175751363} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} @@ -1601,7 +1678,6 @@ RectTransform: m_Children: - {fileID: 251940584} m_Father: {fileID: 1438613464} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} @@ -1646,6 +1722,82 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 452923208} m_CullTransparentMesh: 0 +--- !u!1 &469489022 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 469489023} + - component: {fileID: 469489025} + - component: {fileID: 469489024} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &469489023 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 469489022} + 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_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1684483642} + m_Father: {fileID: 135168672} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 10, y: -10} + m_SizeDelta: {x: 20, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &469489024 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 469489022} + 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 &469489025 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 469489022} + m_CullTransparentMesh: 0 --- !u!1 &488934504 GameObject: m_ObjectHideFlags: 0 @@ -1677,7 +1829,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1166391799} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} @@ -1753,7 +1904,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 644517400} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -1833,7 +1983,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1922159876} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -1913,7 +2062,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 339774397} - m_RootOrder: 14 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -1994,7 +2142,6 @@ RectTransform: - {fileID: 154330168} - {fileID: 1954133885} m_Father: {fileID: 339774397} - m_RootOrder: 20 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -2081,7 +2228,6 @@ RectTransform: - {fileID: 2010083454} - {fileID: 1081455630} m_Father: {fileID: 339774397} - m_RootOrder: 16 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -2167,7 +2313,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1767706907} - m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -2266,7 +2411,6 @@ RectTransform: - {fileID: 1007924636} - {fileID: 1199975013} m_Father: {fileID: 124675794} - m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 1, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -2369,7 +2513,6 @@ RectTransform: m_Children: - {fileID: 852999695} m_Father: {fileID: 644517400} - m_RootOrder: 12 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -2449,7 +2592,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 284921871} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 1, y: 1} m_AnchorMax: {x: 1, y: 1} @@ -2561,9 +2703,17 @@ SphereCollider: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 802105000} m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 m_IsTrigger: 0 + m_ProvidesContacts: 0 m_Enabled: 1 - serializedVersion: 2 + serializedVersion: 3 m_Radius: 0.5 m_Center: {x: 0, y: 0, z: 0} --- !u!33 &802105003 @@ -2581,13 +2731,13 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 802105000} + serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 0.1, y: 0.1, z: 0.1} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &802105005 MonoBehaviour: @@ -2637,7 +2787,6 @@ RectTransform: m_Children: - {fileID: 1181308132} m_Father: {fileID: 644517400} - m_RootOrder: 6 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -2718,7 +2867,6 @@ RectTransform: m_Children: - {fileID: 1987265555} m_Father: {fileID: 1767706907} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} @@ -2795,7 +2943,6 @@ RectTransform: m_Children: - {fileID: 854014594} m_Father: {fileID: 644517400} - m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -2875,7 +3022,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 773923919} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -2955,7 +3101,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 827174941} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -3035,7 +3180,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1307084561} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -3117,7 +3261,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 644517400} - m_RootOrder: 15 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -3198,7 +3341,6 @@ RectTransform: m_Children: - {fileID: 933018278} m_Father: {fileID: 644517400} - m_RootOrder: 11 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -3278,7 +3420,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 928757301} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -3359,7 +3500,6 @@ RectTransform: m_Children: - {fileID: 1242458543} m_Father: {fileID: 644517400} - m_RootOrder: 10 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -3488,7 +3628,6 @@ RectTransform: - {fileID: 175751363} - {fileID: 1904789319} m_Father: {fileID: 339774397} - m_RootOrder: 15 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -3527,7 +3666,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 339774397} - m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -3622,7 +3760,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1263556355} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} @@ -3667,86 +3804,6 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 962537951} m_CullTransparentMesh: 0 ---- !u!1 &974864190 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 974864191} - - component: {fileID: 974864193} - - component: {fileID: 974864192} - m_Layer: 5 - m_Name: _ - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &974864191 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 974864190} - 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_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 339774397} - m_RootOrder: 13 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 178, y: 30} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!114 &974864192 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 974864190} - 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: 1 - 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: ---- !u!222 &974864193 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 974864190} - m_CullTransparentMesh: 0 --- !u!1 &1007924635 GameObject: m_ObjectHideFlags: 0 @@ -3779,7 +3836,6 @@ RectTransform: m_Children: - {fileID: 1476033061} m_Father: {fileID: 644517400} - m_RootOrder: 16 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -3859,7 +3915,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1767738854} - m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -3939,7 +3994,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 2105159132} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -4019,7 +4073,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 634488421} - m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -4099,7 +4152,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 124675794} - m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -4179,7 +4231,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1199975013} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -4301,7 +4352,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1636340564} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -4339,7 +4389,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1791103379} - m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -4420,7 +4469,6 @@ RectTransform: m_Children: - {fileID: 488934505} m_Father: {fileID: 1791103379} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} @@ -4497,7 +4545,6 @@ RectTransform: m_Children: - {fileID: 1289294208} m_Father: {fileID: 644517400} - m_RootOrder: 13 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -4577,7 +4624,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 806723449} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -4657,7 +4703,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 62367395} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} @@ -4735,7 +4780,6 @@ RectTransform: m_Children: - {fileID: 1255857727} m_Father: {fileID: 339774397} - m_RootOrder: 6 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -4856,7 +4900,6 @@ RectTransform: m_Children: - {fileID: 1104290797} m_Father: {fileID: 644517400} - m_RootOrder: 17 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -4936,7 +4979,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 2144476967} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -5016,7 +5058,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 935554081} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -5096,7 +5137,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1194499280} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -5177,7 +5217,6 @@ RectTransform: m_Children: - {fileID: 962537952} m_Father: {fileID: 153452229} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} @@ -5253,7 +5292,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 124675794} - m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 0} @@ -5333,7 +5371,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 154330168} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} @@ -5409,7 +5446,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1172469239} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -5491,7 +5527,6 @@ RectTransform: m_Children: - {fileID: 910859648} m_Father: {fileID: 339774397} - m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -5611,7 +5646,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1866921958} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} @@ -5688,7 +5722,6 @@ RectTransform: - {fileID: 1866921958} - {fileID: 1767669911} m_Father: {fileID: 339774397} - m_RootOrder: 10 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -5774,7 +5807,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1633219308} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -5847,13 +5879,13 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1407428956} + serializedVersion: 2 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 6 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &1407428959 MonoBehaviour: @@ -5903,7 +5935,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 153452229} - m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -5984,7 +6015,6 @@ RectTransform: m_Children: - {fileID: 427963461} m_Father: {fileID: 644517400} - m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -6033,6 +6063,85 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1434602808} m_CullTransparentMesh: 0 +--- !u!1 &1437601636 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1437601637} + - component: {fileID: 1437601639} + - component: {fileID: 1437601638} + m_Layer: 5 + m_Name: Label + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1437601637 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1437601636} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 135168672} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 9, y: -0.5} + m_SizeDelta: {x: -28, y: -3} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1437601638 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1437601636} + 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: 0 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Use Job +--- !u!222 &1437601639 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1437601636} + m_CullTransparentMesh: 0 --- !u!1 &1438613463 GameObject: m_ObjectHideFlags: 0 @@ -6065,7 +6174,6 @@ RectTransform: - {fileID: 452923209} - {fileID: 2090837017} m_Father: {fileID: 339774397} - m_RootOrder: 19 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -6151,7 +6259,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1007924636} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -6200,86 +6307,6 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1476033060} m_CullTransparentMesh: 0 ---- !u!1 &1557052149 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1557052150} - - component: {fileID: 1557052152} - - component: {fileID: 1557052151} - m_Layer: 5 - m_Name: _ - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &1557052150 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1557052149} - 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_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 339774397} - m_RootOrder: 11 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 178, y: 30} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!114 &1557052151 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1557052149} - 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: 1 - 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: ---- !u!222 &1557052152 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1557052149} - m_CullTransparentMesh: 0 --- !u!1 &1621794410 GameObject: m_ObjectHideFlags: 0 @@ -6311,7 +6338,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 339774397} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -6398,13 +6424,21 @@ Camera: m_Enabled: 1 serializedVersion: 2 m_ClearFlags: 1 - m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_BackGroundColor: {r: 0, g: 0, b: 0, a: 1} m_projectionMatrixMode: 1 m_GateFitMode: 2 m_FOVAxisMode: 0 + m_Iso: 200 + m_ShutterSpeed: 0.005 + m_Aperture: 16 + m_FocusDistance: 10 + m_FocalLength: 50 + m_BladeCount: 5 + m_Curvature: {x: 2, y: 11} + m_BarrelClipping: 0.25 + m_Anamorphism: 0 m_SensorSize: {x: 36, y: 24} m_LensShift: {x: 0, y: 0} - m_FocalLength: 50 m_NormalizedViewPortRect: serializedVersion: 2 x: 0 @@ -6438,13 +6472,13 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1629460656} + serializedVersion: 2 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 241398689} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &1629460663 MonoBehaviour: @@ -6476,9 +6510,20 @@ MonoBehaviour: m_Dithering: 0 m_ClearDepth: 1 m_AllowXRRendering: 1 + m_AllowHDROutput: 1 + m_UseScreenCoordOverride: 0 + m_ScreenSizeOverride: {x: 0, y: 0, z: 0, w: 0} + m_ScreenCoordScaleBias: {x: 0, y: 0, z: 0, w: 0} m_RequiresDepthTexture: 0 m_RequiresColorTexture: 0 m_Version: 2 + m_TaaSettings: + m_Quality: 3 + m_FrameInfluence: 0.1 + m_JitterScale: 1 + m_MipBias: 0 + m_VarianceClampScale: 0.9 + m_ContrastAdaptiveSharpening: 0 --- !u!114 &1629460664 MonoBehaviour: m_ObjectHideFlags: 0 @@ -6526,7 +6571,6 @@ RectTransform: m_Children: - {fileID: 1322834810} m_Father: {fileID: 644517400} - m_RootOrder: 9 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -6607,7 +6651,6 @@ RectTransform: m_Children: - {fileID: 1111491927} m_Father: {fileID: 644517400} - m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -6656,6 +6699,81 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1636340563} m_CullTransparentMesh: 0 +--- !u!1 &1684483641 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1684483642} + - component: {fileID: 1684483644} + - component: {fileID: 1684483643} + m_Layer: 5 + m_Name: Checkmark + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1684483642 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1684483641} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 469489023} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 20, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1684483643 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1684483641} + 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: 10901, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 0 + 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 &1684483644 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1684483641} + m_CullTransparentMesh: 0 --- !u!1 &1761414315 GameObject: m_ObjectHideFlags: 0 @@ -6687,7 +6805,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 644517400} - m_RootOrder: 14 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -6767,7 +6884,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1311520909} - m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -6848,7 +6964,6 @@ RectTransform: - {fileID: 826167456} - {fileID: 642985708} m_Father: {fileID: 339774397} - m_RootOrder: 12 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -6935,7 +7050,6 @@ RectTransform: - {fileID: 62367395} - {fileID: 1037763549} m_Father: {fileID: 339774397} - m_RootOrder: 17 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -7067,7 +7181,9 @@ Canvas: m_OverrideSorting: 0 m_OverridePixelPerfect: 0 m_SortingBucketNormalizedSize: 0 + m_VertexColorAlwaysGammaSpace: 0 m_AdditionalShaderChannelsFlag: 0 + m_UpdateRectTransformForStandalone: 0 m_SortingLayerID: 0 m_SortingOrder: 0 m_TargetDisplay: 0 @@ -7085,7 +7201,6 @@ RectTransform: m_Children: - {fileID: 124675794} m_Father: {fileID: 0} - m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -7105,17 +7220,21 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_version: {fileID: 1268276256} + m_useAsync: {fileID: 602093299} m_openModel: {fileID: 2009818433} - m_openMotion: {fileID: 168425996} - m_pastePose: {fileID: 1307084564} + m_showBoxMan: {fileID: 1767706908} + m_useJob: {fileID: 135168673} m_reconstructSprngBone: {fileID: 2144476968} m_resetSpringBone: {fileID: 1194499281} - m_showBoxMan: {fileID: 1767706908} + m_pauseSpringBone: {fileID: 153452230} + m_openMotion: {fileID: 168425996} + m_pastePose: {fileID: 1307084564} + ToggleMotionTPose: {fileID: 1791103380} + ToggleMotionBVH: {fileID: 1311520910} + ToggleMotion: {fileID: 224350194} m_enableLipSync: {fileID: 935566650} m_enableAutoBlink: {fileID: 634488422} m_enableAutoExpression: {fileID: 1767738855} - m_useUrpMaterial: {fileID: 1438613465} - m_useAsync: {fileID: 602093299} m_target: {fileID: 802105000} m_motion: {fileID: 4900000, guid: 487929d3039a63544a0825523ac6a8ab, type: 3} m_texts: @@ -7133,10 +7252,6 @@ MonoBehaviour: m_textPermissionOther: {fileID: 1289294209} m_textDistributionLicense: {fileID: 1476033062} m_textDistributionOther: {fileID: 1104290798} - m_ui: - ToggleMotionTPose: {fileID: 1791103380} - ToggleMotionBVH: {fileID: 1311520910} - ToggleMotion: {fileID: 224350194} Iteration: 32 --- !u!1 &1791103378 GameObject: @@ -7170,7 +7285,6 @@ RectTransform: - {fileID: 1166391799} - {fileID: 1140410864} m_Father: {fileID: 339774397} - m_RootOrder: 9 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -7257,7 +7371,6 @@ RectTransform: m_Children: - {fileID: 1307737655} m_Father: {fileID: 1311520909} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} @@ -7333,7 +7446,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 935566651} - m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -7414,7 +7526,6 @@ RectTransform: m_Children: - {fileID: 587234269} m_Father: {fileID: 644517400} - m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -7494,7 +7605,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 168425995} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -7576,7 +7686,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 602093298} - m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -7656,7 +7765,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 2009818432} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -7738,7 +7846,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 826167456} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} @@ -7816,7 +7923,6 @@ RectTransform: m_Children: - {fileID: 1963417399} m_Father: {fileID: 339774397} - m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -7937,7 +8043,6 @@ RectTransform: m_Children: - {fileID: 188310739} m_Father: {fileID: 634488421} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} @@ -8013,7 +8118,6 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1438613464} - m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -8094,7 +8198,6 @@ RectTransform: m_Children: - {fileID: 1045380262} m_Father: {fileID: 644517400} - m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -8230,13 +8333,13 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2141451816} + serializedVersion: 2 m_LocalRotation: {x: -0.109381616, y: -0.8754262, z: 0.40821788, w: -0.23456965} m_LocalPosition: {x: 0, y: 3, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 50, y: -210, z: 0} --- !u!114 &2141451819 MonoBehaviour: @@ -8250,14 +8353,17 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 474bcb49853aa07438625e644c072ee6, type: 3} m_Name: m_EditorClassIdentifier: - m_Version: 1 + m_Version: 3 m_UsePipelineSettings: 1 m_AdditionalLightsShadowResolutionTier: 2 m_LightLayerMask: 1 + m_RenderingLayers: 1 m_CustomShadowLayers: 0 m_ShadowLayerMask: 1 + m_ShadowRenderingLayers: 1 m_LightCookieSize: {x: 1, y: 1} m_LightCookieOffset: {x: 0, y: 0} + m_SoftShadowQuality: 1 --- !u!1 &2144476966 GameObject: m_ObjectHideFlags: 0 @@ -8291,7 +8397,6 @@ RectTransform: m_Children: - {fileID: 1215781542} m_Father: {fileID: 339774397} - m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -8380,3 +8485,14 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2144476966} m_CullTransparentMesh: 0 +--- !u!1660057539 &9223372036854775807 +SceneRoots: + m_ObjectHideFlags: 0 + m_Roots: + - {fileID: 241398689} + - {fileID: 1787938566} + - {fileID: 2141451818} + - {fileID: 204388504} + - {fileID: 802105004} + - {fileID: 322182885} + - {fileID: 1407428958} diff --git a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewerUI.cs b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewerUI.cs index 26bfeda76..965c0a548 100644 --- a/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewerUI.cs +++ b/Assets/VRM10_Samples/ClothSample/ClothViewer/ClothViewerUI.cs @@ -13,48 +13,75 @@ namespace UniVRM10.Cloth.Viewer { public class ClothViewerUI : MonoBehaviour { - [SerializeField] - Text m_version = default; + [SerializeField] Text m_version = default; - [Header("UI")] - [SerializeField] - Button m_openModel = default; + [Header("Model")] + [SerializeField] Toggle m_useAsync = default; + [SerializeField] Button m_openModel = default; + [SerializeField] Toggle m_showBoxMan = default; - [SerializeField] - Button m_openMotion = default; + [Header("Cloth")] + [SerializeField] Toggle m_useJob = default; + [SerializeField] Button m_reconstructSprngBone = default; + [SerializeField] Button m_resetSpringBone = default; + [SerializeField] Toggle m_pauseSpringBone = default; - [SerializeField] - Button m_pastePose = default; + [Header("Motion")] + [SerializeField] Button m_openMotion = default; + [SerializeField] Button m_pastePose = default; + [SerializeField] Toggle ToggleMotionTPose = default; + [SerializeField] Toggle ToggleMotionBVH = default; + [SerializeField] ToggleGroup ToggleMotion = default; + public bool IsTPose + { + get => ToggleMotion.ActiveToggles().FirstOrDefault() == ToggleMotionTPose; + set + { + ToggleMotionTPose.isOn = value; + ToggleMotionBVH.isOn = !value; + } + } - [SerializeField] - Button m_reconstructSprngBone = default; + [Header("Expression")] + [SerializeField] Toggle m_enableLipSync = default; + [SerializeField] Toggle m_enableAutoBlink = default; + [SerializeField] Toggle m_enableAutoExpression = default; - [SerializeField] - Button m_resetSpringBone = default; + [SerializeField] GameObject m_target = default; + [SerializeField] TextAsset m_motion; + [SerializeField] TextFields m_texts = default; - [SerializeField] - Toggle m_showBoxMan = default; + private void Reset() + { + var map = new ObjectMap(gameObject); - [SerializeField] - Toggle m_enableLipSync = default; + m_version = map.Get("VrmVersion"); - [SerializeField] - Toggle m_enableAutoBlink = default; + m_useAsync = map.Get("UseAsync"); + m_openModel = map.Get