Showing
2 changed files
with
249 additions
and
138 deletions
| ... | @@ -209,7 +209,7 @@ GameObject: | ... | @@ -209,7 +209,7 @@ GameObject: |
| 209 | m_Icon: {fileID: 0} | 209 | m_Icon: {fileID: 0} |
| 210 | m_NavMeshLayer: 0 | 210 | m_NavMeshLayer: 0 |
| 211 | m_StaticEditorFlags: 0 | 211 | m_StaticEditorFlags: 0 |
| 212 | - m_IsActive: 1 | 212 | + m_IsActive: 0 |
| 213 | --- !u!224 &64300835 | 213 | --- !u!224 &64300835 |
| 214 | RectTransform: | 214 | RectTransform: |
| 215 | m_ObjectHideFlags: 0 | 215 | m_ObjectHideFlags: 0 |
| ... | @@ -379,7 +379,7 @@ GameObject: | ... | @@ -379,7 +379,7 @@ GameObject: |
| 379 | m_Icon: {fileID: 0} | 379 | m_Icon: {fileID: 0} |
| 380 | m_NavMeshLayer: 0 | 380 | m_NavMeshLayer: 0 |
| 381 | m_StaticEditorFlags: 0 | 381 | m_StaticEditorFlags: 0 |
| 382 | - m_IsActive: 0 | 382 | + m_IsActive: 1 |
| 383 | --- !u!224 &109009051 | 383 | --- !u!224 &109009051 |
| 384 | RectTransform: | 384 | RectTransform: |
| 385 | m_ObjectHideFlags: 0 | 385 | m_ObjectHideFlags: 0 |
| ... | @@ -450,7 +450,7 @@ GameObject: | ... | @@ -450,7 +450,7 @@ GameObject: |
| 450 | m_Icon: {fileID: 0} | 450 | m_Icon: {fileID: 0} |
| 451 | m_NavMeshLayer: 0 | 451 | m_NavMeshLayer: 0 |
| 452 | m_StaticEditorFlags: 0 | 452 | m_StaticEditorFlags: 0 |
| 453 | - m_IsActive: 0 | 453 | + m_IsActive: 1 |
| 454 | --- !u!224 &132265373 | 454 | --- !u!224 &132265373 |
| 455 | RectTransform: | 455 | RectTransform: |
| 456 | m_ObjectHideFlags: 0 | 456 | m_ObjectHideFlags: 0 |
| ... | @@ -701,7 +701,7 @@ GameObject: | ... | @@ -701,7 +701,7 @@ GameObject: |
| 701 | m_Icon: {fileID: 0} | 701 | m_Icon: {fileID: 0} |
| 702 | m_NavMeshLayer: 0 | 702 | m_NavMeshLayer: 0 |
| 703 | m_StaticEditorFlags: 0 | 703 | m_StaticEditorFlags: 0 |
| 704 | - m_IsActive: 0 | 704 | + m_IsActive: 1 |
| 705 | --- !u!224 &310358199 | 705 | --- !u!224 &310358199 |
| 706 | RectTransform: | 706 | RectTransform: |
| 707 | m_ObjectHideFlags: 0 | 707 | m_ObjectHideFlags: 0 |
| ... | @@ -709,16 +709,16 @@ RectTransform: | ... | @@ -709,16 +709,16 @@ RectTransform: |
| 709 | m_PrefabInstance: {fileID: 0} | 709 | m_PrefabInstance: {fileID: 0} |
| 710 | m_PrefabAsset: {fileID: 0} | 710 | m_PrefabAsset: {fileID: 0} |
| 711 | m_GameObject: {fileID: 310358198} | 711 | m_GameObject: {fileID: 310358198} |
| 712 | - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} | 712 | + m_LocalRotation: {x: 0, y: 0, z: 0.3420201, w: 0.9396927} |
| 713 | m_LocalPosition: {x: 0, y: 0, z: 0} | 713 | m_LocalPosition: {x: 0, y: 0, z: 0} |
| 714 | m_LocalScale: {x: 1, y: 1, z: 1} | 714 | m_LocalScale: {x: 1, y: 1, z: 1} |
| 715 | m_Children: [] | 715 | m_Children: [] |
| 716 | m_Father: {fileID: 1679758666} | 716 | m_Father: {fileID: 1679758666} |
| 717 | m_RootOrder: 18 | 717 | m_RootOrder: 18 |
| 718 | - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} | 718 | + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 40} |
| 719 | m_AnchorMin: {x: 0.5, y: 0.5} | 719 | m_AnchorMin: {x: 0.5, y: 0.5} |
| 720 | m_AnchorMax: {x: 0.5, y: 0.5} | 720 | m_AnchorMax: {x: 0.5, y: 0.5} |
| 721 | - m_AnchoredPosition: {x: 330, y: 150} | 721 | + m_AnchoredPosition: {x: 290, y: 100} |
| 722 | m_SizeDelta: {x: 250, y: 30} | 722 | m_SizeDelta: {x: 250, y: 30} |
| 723 | m_Pivot: {x: 0.5, y: 0.5} | 723 | m_Pivot: {x: 0.5, y: 0.5} |
| 724 | --- !u!114 &310358200 | 724 | --- !u!114 &310358200 |
| ... | @@ -772,7 +772,7 @@ GameObject: | ... | @@ -772,7 +772,7 @@ GameObject: |
| 772 | m_Icon: {fileID: 0} | 772 | m_Icon: {fileID: 0} |
| 773 | m_NavMeshLayer: 0 | 773 | m_NavMeshLayer: 0 |
| 774 | m_StaticEditorFlags: 0 | 774 | m_StaticEditorFlags: 0 |
| 775 | - m_IsActive: 0 | 775 | + m_IsActive: 1 |
| 776 | --- !u!224 &395084096 | 776 | --- !u!224 &395084096 |
| 777 | RectTransform: | 777 | RectTransform: |
| 778 | m_ObjectHideFlags: 0 | 778 | m_ObjectHideFlags: 0 |
| ... | @@ -843,7 +843,7 @@ GameObject: | ... | @@ -843,7 +843,7 @@ GameObject: |
| 843 | m_Icon: {fileID: 0} | 843 | m_Icon: {fileID: 0} |
| 844 | m_NavMeshLayer: 0 | 844 | m_NavMeshLayer: 0 |
| 845 | m_StaticEditorFlags: 0 | 845 | m_StaticEditorFlags: 0 |
| 846 | - m_IsActive: 1 | 846 | + m_IsActive: 0 |
| 847 | --- !u!224 &469119555 | 847 | --- !u!224 &469119555 |
| 848 | RectTransform: | 848 | RectTransform: |
| 849 | m_ObjectHideFlags: 0 | 849 | m_ObjectHideFlags: 0 |
| ... | @@ -988,7 +988,7 @@ GameObject: | ... | @@ -988,7 +988,7 @@ GameObject: |
| 988 | m_Icon: {fileID: 0} | 988 | m_Icon: {fileID: 0} |
| 989 | m_NavMeshLayer: 0 | 989 | m_NavMeshLayer: 0 |
| 990 | m_StaticEditorFlags: 0 | 990 | m_StaticEditorFlags: 0 |
| 991 | - m_IsActive: 1 | 991 | + m_IsActive: 0 |
| 992 | --- !u!224 &618891444 | 992 | --- !u!224 &618891444 |
| 993 | RectTransform: | 993 | RectTransform: |
| 994 | m_ObjectHideFlags: 0 | 994 | m_ObjectHideFlags: 0 |
| ... | @@ -1066,7 +1066,7 @@ GameObject: | ... | @@ -1066,7 +1066,7 @@ GameObject: |
| 1066 | m_Icon: {fileID: 0} | 1066 | m_Icon: {fileID: 0} |
| 1067 | m_NavMeshLayer: 0 | 1067 | m_NavMeshLayer: 0 |
| 1068 | m_StaticEditorFlags: 0 | 1068 | m_StaticEditorFlags: 0 |
| 1069 | - m_IsActive: 1 | 1069 | + m_IsActive: 0 |
| 1070 | --- !u!114 &687225090 | 1070 | --- !u!114 &687225090 |
| 1071 | MonoBehaviour: | 1071 | MonoBehaviour: |
| 1072 | m_ObjectHideFlags: 0 | 1072 | m_ObjectHideFlags: 0 |
| ... | @@ -1144,7 +1144,7 @@ GameObject: | ... | @@ -1144,7 +1144,7 @@ GameObject: |
| 1144 | m_Icon: {fileID: 0} | 1144 | m_Icon: {fileID: 0} |
| 1145 | m_NavMeshLayer: 0 | 1145 | m_NavMeshLayer: 0 |
| 1146 | m_StaticEditorFlags: 0 | 1146 | m_StaticEditorFlags: 0 |
| 1147 | - m_IsActive: 1 | 1147 | + m_IsActive: 0 |
| 1148 | --- !u!224 &883974734 | 1148 | --- !u!224 &883974734 |
| 1149 | RectTransform: | 1149 | RectTransform: |
| 1150 | m_ObjectHideFlags: 0 | 1150 | m_ObjectHideFlags: 0 |
| ... | @@ -1293,7 +1293,7 @@ GameObject: | ... | @@ -1293,7 +1293,7 @@ GameObject: |
| 1293 | m_Icon: {fileID: 0} | 1293 | m_Icon: {fileID: 0} |
| 1294 | m_NavMeshLayer: 0 | 1294 | m_NavMeshLayer: 0 |
| 1295 | m_StaticEditorFlags: 0 | 1295 | m_StaticEditorFlags: 0 |
| 1296 | - m_IsActive: 0 | 1296 | + m_IsActive: 1 |
| 1297 | --- !u!224 &1089006721 | 1297 | --- !u!224 &1089006721 |
| 1298 | RectTransform: | 1298 | RectTransform: |
| 1299 | m_ObjectHideFlags: 0 | 1299 | m_ObjectHideFlags: 0 |
| ... | @@ -1310,7 +1310,7 @@ RectTransform: | ... | @@ -1310,7 +1310,7 @@ RectTransform: |
| 1310 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} | 1310 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
| 1311 | m_AnchorMin: {x: 0.5, y: 0.5} | 1311 | m_AnchorMin: {x: 0.5, y: 0.5} |
| 1312 | m_AnchorMax: {x: 0.5, y: 0.5} | 1312 | m_AnchorMax: {x: 0.5, y: 0.5} |
| 1313 | - m_AnchoredPosition: {x: 330, y: 150} | 1313 | + m_AnchoredPosition: {x: 330, y: 200} |
| 1314 | m_SizeDelta: {x: 250, y: 30} | 1314 | m_SizeDelta: {x: 250, y: 30} |
| 1315 | m_Pivot: {x: 0.5, y: 0.5} | 1315 | m_Pivot: {x: 0.5, y: 0.5} |
| 1316 | --- !u!114 &1089006722 | 1316 | --- !u!114 &1089006722 |
| ... | @@ -1526,7 +1526,7 @@ GameObject: | ... | @@ -1526,7 +1526,7 @@ GameObject: |
| 1526 | m_Icon: {fileID: 0} | 1526 | m_Icon: {fileID: 0} |
| 1527 | m_NavMeshLayer: 0 | 1527 | m_NavMeshLayer: 0 |
| 1528 | m_StaticEditorFlags: 0 | 1528 | m_StaticEditorFlags: 0 |
| 1529 | - m_IsActive: 1 | 1529 | + m_IsActive: 0 |
| 1530 | --- !u!224 &1313906996 | 1530 | --- !u!224 &1313906996 |
| 1531 | RectTransform: | 1531 | RectTransform: |
| 1532 | m_ObjectHideFlags: 0 | 1532 | m_ObjectHideFlags: 0 |
| ... | @@ -1750,6 +1750,15 @@ MonoBehaviour: | ... | @@ -1750,6 +1750,15 @@ MonoBehaviour: |
| 1750 | HipBalance: {fileID: 64300837} | 1750 | HipBalance: {fileID: 64300837} |
| 1751 | PullHipBack: {fileID: 469119556} | 1751 | PullHipBack: {fileID: 469119556} |
| 1752 | Great: {fileID: 1784424919} | 1752 | Great: {fileID: 1784424919} |
| 1753 | + count3: {fileID: 1983785836} | ||
| 1754 | + count2: {fileID: 132265372} | ||
| 1755 | + count1: {fileID: 1606945878} | ||
| 1756 | + HipBalance1: {fileID: 395084095} | ||
| 1757 | + PullHipBack2: {fileID: 109009050} | ||
| 1758 | + LegUp3: {fileID: 1484596775} | ||
| 1759 | + SpineStraight4: {fileID: 1089006720} | ||
| 1760 | + Great5: {fileID: 310358198} | ||
| 1761 | + ex_start: {fileID: 0} | ||
| 1753 | --- !u!4 &1461362268 | 1762 | --- !u!4 &1461362268 |
| 1754 | Transform: | 1763 | Transform: |
| 1755 | m_ObjectHideFlags: 0 | 1764 | m_ObjectHideFlags: 0 |
| ... | @@ -1781,7 +1790,7 @@ GameObject: | ... | @@ -1781,7 +1790,7 @@ GameObject: |
| 1781 | m_Icon: {fileID: 0} | 1790 | m_Icon: {fileID: 0} |
| 1782 | m_NavMeshLayer: 0 | 1791 | m_NavMeshLayer: 0 |
| 1783 | m_StaticEditorFlags: 0 | 1792 | m_StaticEditorFlags: 0 |
| 1784 | - m_IsActive: 0 | 1793 | + m_IsActive: 1 |
| 1785 | --- !u!224 &1484596776 | 1794 | --- !u!224 &1484596776 |
| 1786 | RectTransform: | 1795 | RectTransform: |
| 1787 | m_ObjectHideFlags: 0 | 1796 | m_ObjectHideFlags: 0 |
| ... | @@ -1852,7 +1861,7 @@ GameObject: | ... | @@ -1852,7 +1861,7 @@ GameObject: |
| 1852 | m_Icon: {fileID: 0} | 1861 | m_Icon: {fileID: 0} |
| 1853 | m_NavMeshLayer: 0 | 1862 | m_NavMeshLayer: 0 |
| 1854 | m_StaticEditorFlags: 0 | 1863 | m_StaticEditorFlags: 0 |
| 1855 | - m_IsActive: 1 | 1864 | + m_IsActive: 0 |
| 1856 | --- !u!224 &1493856867 | 1865 | --- !u!224 &1493856867 |
| 1857 | RectTransform: | 1866 | RectTransform: |
| 1858 | m_ObjectHideFlags: 0 | 1867 | m_ObjectHideFlags: 0 |
| ... | @@ -1930,7 +1939,7 @@ GameObject: | ... | @@ -1930,7 +1939,7 @@ GameObject: |
| 1930 | m_Icon: {fileID: 0} | 1939 | m_Icon: {fileID: 0} |
| 1931 | m_NavMeshLayer: 0 | 1940 | m_NavMeshLayer: 0 |
| 1932 | m_StaticEditorFlags: 0 | 1941 | m_StaticEditorFlags: 0 |
| 1933 | - m_IsActive: 1 | 1942 | + m_IsActive: 0 |
| 1934 | --- !u!224 &1543390837 | 1943 | --- !u!224 &1543390837 |
| 1935 | RectTransform: | 1944 | RectTransform: |
| 1936 | m_ObjectHideFlags: 0 | 1945 | m_ObjectHideFlags: 0 |
| ... | @@ -2008,7 +2017,7 @@ GameObject: | ... | @@ -2008,7 +2017,7 @@ GameObject: |
| 2008 | m_Icon: {fileID: 0} | 2017 | m_Icon: {fileID: 0} |
| 2009 | m_NavMeshLayer: 0 | 2018 | m_NavMeshLayer: 0 |
| 2010 | m_StaticEditorFlags: 0 | 2019 | m_StaticEditorFlags: 0 |
| 2011 | - m_IsActive: 0 | 2020 | + m_IsActive: 1 |
| 2012 | --- !u!224 &1606945879 | 2021 | --- !u!224 &1606945879 |
| 2013 | RectTransform: | 2022 | RectTransform: |
| 2014 | m_ObjectHideFlags: 0 | 2023 | m_ObjectHideFlags: 0 |
| ... | @@ -2353,7 +2362,7 @@ GameObject: | ... | @@ -2353,7 +2362,7 @@ GameObject: |
| 2353 | m_Icon: {fileID: 0} | 2362 | m_Icon: {fileID: 0} |
| 2354 | m_NavMeshLayer: 0 | 2363 | m_NavMeshLayer: 0 |
| 2355 | m_StaticEditorFlags: 0 | 2364 | m_StaticEditorFlags: 0 |
| 2356 | - m_IsActive: 0 | 2365 | + m_IsActive: 1 |
| 2357 | --- !u!224 &1723072948 | 2366 | --- !u!224 &1723072948 |
| 2358 | RectTransform: | 2367 | RectTransform: |
| 2359 | m_ObjectHideFlags: 0 | 2368 | m_ObjectHideFlags: 0 |
| ... | @@ -2608,7 +2617,7 @@ GameObject: | ... | @@ -2608,7 +2617,7 @@ GameObject: |
| 2608 | m_Icon: {fileID: 0} | 2617 | m_Icon: {fileID: 0} |
| 2609 | m_NavMeshLayer: 0 | 2618 | m_NavMeshLayer: 0 |
| 2610 | m_StaticEditorFlags: 0 | 2619 | m_StaticEditorFlags: 0 |
| 2611 | - m_IsActive: 0 | 2620 | + m_IsActive: 1 |
| 2612 | --- !u!224 &1983785837 | 2621 | --- !u!224 &1983785837 |
| 2613 | RectTransform: | 2622 | RectTransform: |
| 2614 | m_ObjectHideFlags: 0 | 2623 | m_ObjectHideFlags: 0 |
| ... | @@ -2679,7 +2688,7 @@ GameObject: | ... | @@ -2679,7 +2688,7 @@ GameObject: |
| 2679 | m_Icon: {fileID: 0} | 2688 | m_Icon: {fileID: 0} |
| 2680 | m_NavMeshLayer: 0 | 2689 | m_NavMeshLayer: 0 |
| 2681 | m_StaticEditorFlags: 0 | 2690 | m_StaticEditorFlags: 0 |
| 2682 | - m_IsActive: 1 | 2691 | + m_IsActive: 0 |
| 2683 | --- !u!224 &2059169296 | 2692 | --- !u!224 &2059169296 |
| 2684 | RectTransform: | 2693 | RectTransform: |
| 2685 | m_ObjectHideFlags: 0 | 2694 | m_ObjectHideFlags: 0 | ... | ... |
| ... | @@ -55,6 +55,14 @@ public class Move : MonoBehaviour | ... | @@ -55,6 +55,14 @@ public class Move : MonoBehaviour |
| 55 | string spinestraight, pullhipback, great; | 55 | string spinestraight, pullhipback, great; |
| 56 | 56 | ||
| 57 | string exercise; | 57 | string exercise; |
| 58 | + int squat_flag, squat_count; | ||
| 59 | + private float timer; | ||
| 60 | + | ||
| 61 | + public GameObject count3; | ||
| 62 | + public GameObject count2; | ||
| 63 | + public GameObject count1; | ||
| 64 | + public GameObject HipBalance1, PullHipBack2, LegUp3, SpineStraight4, Great5; | ||
| 65 | + public GameObject ex_start; | ||
| 58 | 66 | ||
| 59 | //lsy | 67 | //lsy |
| 60 | void Trainer_Run() | 68 | void Trainer_Run() |
| ... | @@ -101,6 +109,8 @@ public class Move : MonoBehaviour | ... | @@ -101,6 +109,8 @@ public class Move : MonoBehaviour |
| 101 | 109 | ||
| 102 | void Start() | 110 | void Start() |
| 103 | { | 111 | { |
| 112 | + timer = 0; | ||
| 113 | + | ||
| 104 | skeleton_Trainnner = new CharacterSkeleton(Trainnner); | 114 | skeleton_Trainnner = new CharacterSkeleton(Trainnner); |
| 105 | skeleton_Trainnne = new CharacterSkeleton(Trainnne); | 115 | skeleton_Trainnne = new CharacterSkeleton(Trainnne); |
| 106 | 116 | ||
| ... | @@ -113,6 +123,15 @@ public class Move : MonoBehaviour | ... | @@ -113,6 +123,15 @@ public class Move : MonoBehaviour |
| 113 | 123 | ||
| 114 | exercise = ClickExercise.selected_exercise; //ClickExercise에서 선택한 운동이 무엇인지 String으로 넘어옴. | 124 | exercise = ClickExercise.selected_exercise; //ClickExercise에서 선택한 운동이 무엇인지 String으로 넘어옴. |
| 115 | Debug.Log(exercise); //Squat, SideHiKick, Lunge 에 따라서 Trainer움직이고, 사용자에게 instruction주기 | 125 | Debug.Log(exercise); //Squat, SideHiKick, Lunge 에 따라서 Trainer움직이고, 사용자에게 instruction주기 |
| 126 | + | ||
| 127 | + squat_count = 0; | ||
| 128 | + squat_flag = 0; | ||
| 129 | + | ||
| 130 | + HipBalance1.SetActive(false); | ||
| 131 | + PullHipBack2.SetActive(false); | ||
| 132 | + LegUp3.SetActive(false); | ||
| 133 | + SpineStraight4.SetActive(false); | ||
| 134 | + Great5.SetActive(false); | ||
| 116 | } | 135 | } |
| 117 | 136 | ||
| 118 | private Dictionary<Kinect.JointType, Kinect.JointType> _BoneMap = new Dictionary<Kinect.JointType, Kinect.JointType>() | 137 | private Dictionary<Kinect.JointType, Kinect.JointType> _BoneMap = new Dictionary<Kinect.JointType, Kinect.JointType>() |
| ... | @@ -149,92 +168,142 @@ public class Move : MonoBehaviour | ... | @@ -149,92 +168,142 @@ public class Move : MonoBehaviour |
| 149 | 168 | ||
| 150 | void Update() | 169 | void Update() |
| 151 | { | 170 | { |
| 152 | - //lsy | ||
| 153 | - Trainer_Run(); | ||
| 154 | - //lsy end | ||
| 155 | - | ||
| 156 | - | ||
| 157 | - IfSpineIsStraight.text = "허리를 곧게: Tracking"; | ||
| 158 | - HipBalance.text = "양쪽 힙 균형: Calculating"; | ||
| 159 | - AngleLeftKnee.text = ""; | ||
| 160 | - AngleRightKnee.text = ""; | ||
| 161 | - KneeToeLeft.text = ""; | ||
| 162 | - KneeToeRight.text = ""; | ||
| 163 | - LeftLegUp.text = "왼쪽 다리 들어올린 각도: Tracking"; | ||
| 164 | - RightLegUp.text = "오른쪽 다리 들어올린 각도: Tracking"; | ||
| 165 | - | ||
| 166 | - PullHipBack.text = ""; | ||
| 167 | - Great.text = ""; | ||
| 168 | - | ||
| 169 | - float[] data1 = new float[bodyCount * jointCount * 3]; | ||
| 170 | - int[] state = new int[bodyCount * jointCount]; | ||
| 171 | - int[] id = new int[bodyCount]; | ||
| 172 | - GCHandle gch = GCHandle.Alloc(data1, GCHandleType.Pinned); | ||
| 173 | - GCHandle gch2 = GCHandle.Alloc(state, GCHandleType.Pinned); | ||
| 174 | - GCHandle gch3 = GCHandle.Alloc(id, GCHandleType.Pinned); | ||
| 175 | 171 | ||
| 176 | - if (BodySourceManager == null) | 172 | + timer += Time.deltaTime; |
| 173 | + Debug.Log("Timer: " + timer); | ||
| 174 | + if (timer < 1) | ||
| 177 | { | 175 | { |
| 178 | - return; | 176 | + count3.SetActive(true); |
| 177 | + count2.SetActive(false); | ||
| 178 | + count1.SetActive(false); | ||
| 179 | + ex_start.SetActive(true); | ||
| 180 | + | ||
| 181 | + HipBalance1.SetActive(false); | ||
| 182 | + PullHipBack2.SetActive(false); | ||
| 183 | + LegUp3.SetActive(false); | ||
| 184 | + SpineStraight4.SetActive(false); | ||
| 185 | + Great5.SetActive(false); | ||
| 179 | } | 186 | } |
| 180 | - | 187 | + else if (timer >= 1 && timer < 2) { |
| 181 | - _BodyManager = BodySourceManager.GetComponent<BodySourceManager>(); | 188 | + count3.SetActive(false); |
| 182 | - if (_BodyManager == null) | 189 | + count2.SetActive(true); |
| 183 | - { | 190 | + count1.SetActive(false); |
| 184 | - return; | 191 | + ex_start.SetActive(true); |
| 192 | + | ||
| 193 | + HipBalance1.SetActive(false); | ||
| 194 | + PullHipBack2.SetActive(false); | ||
| 195 | + LegUp3.SetActive(false); | ||
| 196 | + SpineStraight4.SetActive(false); | ||
| 197 | + Great5.SetActive(false); | ||
| 185 | } | 198 | } |
| 186 | - | 199 | + else if (timer >= 2 && timer < 3) |
| 187 | - Kinect.Body[] data = _BodyManager.GetData(); | ||
| 188 | - if (data == null) | ||
| 189 | { | 200 | { |
| 190 | - return; | 201 | + count3.SetActive(false); |
| 202 | + count2.SetActive(false); | ||
| 203 | + count1.SetActive(true); | ||
| 204 | + ex_start.SetActive(true); | ||
| 205 | + | ||
| 206 | + HipBalance1.SetActive(false); | ||
| 207 | + PullHipBack2.SetActive(false); | ||
| 208 | + LegUp3.SetActive(false); | ||
| 209 | + SpineStraight4.SetActive(false); | ||
| 210 | + Great5.SetActive(false); | ||
| 191 | } | 211 | } |
| 192 | - | 212 | + else |
| 193 | - List<ulong> trackedIds = new List<ulong>(); | ||
| 194 | - foreach (var body in data) | ||
| 195 | { | 213 | { |
| 196 | - if (body == null) | 214 | + count3.SetActive(false); |
| 215 | + count2.SetActive(false); | ||
| 216 | + count1.SetActive(false); | ||
| 217 | + ex_start.SetActive(false); | ||
| 218 | + | ||
| 219 | + //lsy | ||
| 220 | + Trainer_Run(); | ||
| 221 | + //lsy end | ||
| 222 | + | ||
| 223 | + | ||
| 224 | + IfSpineIsStraight.text = "허리를 곧게: Tracking"; | ||
| 225 | + HipBalance.text = "양쪽 힙 균형: Calculating"; | ||
| 226 | + AngleLeftKnee.text = ""; | ||
| 227 | + AngleRightKnee.text = ""; | ||
| 228 | + KneeToeLeft.text = ""; | ||
| 229 | + KneeToeRight.text = ""; | ||
| 230 | + LeftLegUp.text = "왼쪽 다리 들어올린 각도: Tracking"; | ||
| 231 | + RightLegUp.text = "오른쪽 다리 들어올린 각도: Tracking"; | ||
| 232 | + | ||
| 233 | + PullHipBack.text = ""; | ||
| 234 | + Great.text = ""; | ||
| 235 | + | ||
| 236 | + float[] data1 = new float[bodyCount * jointCount * 3]; | ||
| 237 | + int[] state = new int[bodyCount * jointCount]; | ||
| 238 | + int[] id = new int[bodyCount]; | ||
| 239 | + GCHandle gch = GCHandle.Alloc(data1, GCHandleType.Pinned); | ||
| 240 | + GCHandle gch2 = GCHandle.Alloc(state, GCHandleType.Pinned); | ||
| 241 | + GCHandle gch3 = GCHandle.Alloc(id, GCHandleType.Pinned); | ||
| 242 | + | ||
| 243 | + if (BodySourceManager == null) | ||
| 197 | { | 244 | { |
| 198 | - continue; | 245 | + return; |
| 199 | } | 246 | } |
| 200 | 247 | ||
| 201 | - if (body.IsTracked) | 248 | + _BodyManager = BodySourceManager.GetComponent<BodySourceManager>(); |
| 249 | + if (_BodyManager == null) | ||
| 202 | { | 250 | { |
| 203 | - | 251 | + return; |
| 204 | - trackedIds.Add(body.TrackingId); | ||
| 205 | } | 252 | } |
| 206 | - } | ||
| 207 | 253 | ||
| 208 | - List<ulong> knownIds = new List<ulong>(_Bodies.Keys); | 254 | + Kinect.Body[] data = _BodyManager.GetData(); |
| 255 | + if (data == null) | ||
| 256 | + { | ||
| 257 | + return; | ||
| 258 | + } | ||
| 209 | 259 | ||
| 210 | - // First delete untracked bodies | 260 | + List<ulong> trackedIds = new List<ulong>(); |
| 211 | - foreach (ulong trackingId in knownIds) | 261 | + foreach (var body in data) |
| 212 | - { | ||
| 213 | - if (!trackedIds.Contains(trackingId)) | ||
| 214 | { | 262 | { |
| 215 | - Destroy(_Bodies[trackingId]); | 263 | + if (body == null) |
| 216 | - _Bodies.Remove(trackingId); | 264 | + { |
| 265 | + continue; | ||
| 266 | + } | ||
| 267 | + | ||
| 268 | + if (body.IsTracked) | ||
| 269 | + { | ||
| 270 | + | ||
| 271 | + trackedIds.Add(body.TrackingId); | ||
| 272 | + } | ||
| 217 | } | 273 | } |
| 218 | - } | ||
| 219 | 274 | ||
| 220 | - foreach (var body in data) | 275 | + List<ulong> knownIds = new List<ulong>(_Bodies.Keys); |
| 221 | - { | 276 | + |
| 222 | - if (body == null) | 277 | + // First delete untracked bodies |
| 278 | + foreach (ulong trackingId in knownIds) | ||
| 223 | { | 279 | { |
| 224 | - continue; | 280 | + if (!trackedIds.Contains(trackingId)) |
| 281 | + { | ||
| 282 | + Destroy(_Bodies[trackingId]); | ||
| 283 | + _Bodies.Remove(trackingId); | ||
| 284 | + } | ||
| 225 | } | 285 | } |
| 226 | 286 | ||
| 227 | - if (body.IsTracked) | 287 | + foreach (var body in data) |
| 228 | { | 288 | { |
| 229 | - if (!_Bodies.ContainsKey(body.TrackingId)) | 289 | + if (body == null) |
| 230 | { | 290 | { |
| 291 | + continue; | ||
| 292 | + } | ||
| 231 | 293 | ||
| 232 | - _Bodies[body.TrackingId] = CreateBodyObject(body.TrackingId); | 294 | + if (body.IsTracked) |
| 295 | + { | ||
| 296 | + if (!_Bodies.ContainsKey(body.TrackingId)) | ||
| 297 | + { | ||
| 233 | 298 | ||
| 299 | + _Bodies[body.TrackingId] = CreateBodyObject(body.TrackingId); | ||
| 300 | + | ||
| 301 | + } | ||
| 302 | + RefreshBodyObject(body, _Bodies[body.TrackingId]); | ||
| 234 | } | 303 | } |
| 235 | - RefreshBodyObject(body, _Bodies[body.TrackingId]); | ||
| 236 | } | 304 | } |
| 237 | } | 305 | } |
| 306 | + | ||
| 238 | } | 307 | } |
| 239 | 308 | ||
| 240 | private GameObject CreateBodyObject(ulong id) | 309 | private GameObject CreateBodyObject(ulong id) |
| ... | @@ -277,74 +346,102 @@ public class Move : MonoBehaviour | ... | @@ -277,74 +346,102 @@ public class Move : MonoBehaviour |
| 277 | /////////////////////////// | 346 | /////////////////////////// |
| 278 | Angles MyAngles = new Angles(); | 347 | Angles MyAngles = new Angles(); |
| 279 | byte[] ReadAngles = MyAngles.GetVector(body); | 348 | byte[] ReadAngles = MyAngles.GetVector(body); |
| 280 | - // ReadAngles[0].ToString(); | ||
| 281 | - //Debug.Log("HipLeft " + ReadAngles[1].ToString()); | ||
| 282 | - //Debug.Log("HipRight " + ReadAngles[2].ToString()); | ||
| 283 | - //Debug.Log("KneeLeft " + ReadAngles[3].ToString()); | ||
| 284 | - //Debug.Log("KneeRight " + ReadAngles[4].ToString()); | ||
| 285 | - | ||
| 286 | 349 | ||
| 287 | - if (ReadAngles[1] - ReadAngles[2] <= 5) | 350 | + if (exercise == "Squat") |
| 288 | - { | ||
| 289 | - hipbal = ""; | ||
| 290 | - //hipbal = "양쪽 균형이 잡혀있습니다."; | ||
| 291 | - } | ||
| 292 | - else | ||
| 293 | { | 351 | { |
| 294 | - hipbal = "양쪽 힘이 동일하지 않습니다. \n균형을 잡으세요!"; | 352 | + if (ReadAngles[1] - ReadAngles[2] <= 5) |
| 295 | - } | 353 | + { |
| 354 | + hipbal = ""; | ||
| 355 | + //hipbal = "양쪽 균형이 잡혀있습니다."; | ||
| 356 | + HipBalance1.SetActive(false); | ||
| 357 | + } | ||
| 358 | + else | ||
| 359 | + { | ||
| 360 | + hipbal = "양쪽 힘이 동일하지 않습니다. \n균형을 잡으세요!"; | ||
| 361 | + HipBalance1.SetActive(true); | ||
| 362 | + } | ||
| 363 | + | ||
| 364 | + if (ReadAngles[5] > 95 || ReadAngles[6] > 95) | ||
| 365 | + { | ||
| 366 | + pullhipback = "엉덩이를 뒤로 더 빼세요!"; | ||
| 367 | + PullHipBack2.SetActive(true); | ||
| 368 | + } | ||
| 369 | + else | ||
| 370 | + { | ||
| 371 | + PullHipBack2.SetActive(false); | ||
| 372 | + } | ||
| 373 | + | ||
| 374 | + if (ReadAngles[3] < 95 && ReadAngles[4] < 95) | ||
| 375 | + { | ||
| 376 | + great = "GREAT!"; | ||
| 377 | + Debug.Log(ReadAngles[3]); | ||
| 378 | + Great5.SetActive(true); | ||
| 379 | + } | ||
| 380 | + else | ||
| 381 | + { | ||
| 382 | + great = ""; | ||
| 383 | + Great5.SetActive(false); | ||
| 384 | + } | ||
| 296 | 385 | ||
| 297 | - if (ReadAngles[5] > 90) | ||
| 298 | - { | ||
| 299 | - //leftkneewarning = "왼쪽 무릎이 발끝을 넘어갔습니다."; | ||
| 300 | - pullhipback = "엉덩이를 뒤로 더 빼세요!"; | ||
| 301 | - } | ||
| 302 | - else | ||
| 303 | - { | ||
| 304 | - leftkneewarning = ""; | ||
| 305 | - } | ||
| 306 | - if (ReadAngles[6] > 90) | ||
| 307 | - { | ||
| 308 | - //rightkneewarning = "오른쪽 무릎이 발끝을 넘어갔습니다."; | ||
| 309 | - pullhipback = "엉덩이를 뒤로 더 빼세요!"; | ||
| 310 | - } | ||
| 311 | - else | ||
| 312 | - { | ||
| 313 | - rightkneewarning = ""; | ||
| 314 | - } | ||
| 315 | 386 | ||
| 316 | - if (ReadAngles[7] < 45) | ||
| 317 | - { | ||
| 318 | - leftsidehighkick = "왼쪽 다리를 좀 더 높이 들어올리세요"; | ||
| 319 | } | 387 | } |
| 320 | - else | 388 | + else if (exercise == "SideHiKick") |
| 321 | { | 389 | { |
| 322 | - leftsidehighkick = ""; | ||
| 323 | - } | ||
| 324 | 390 | ||
| 325 | - if (ReadAngles[8] < 45) | 391 | + if (ReadAngles[7] < 40 || ReadAngles[8] < 40) |
| 326 | - { | 392 | + { |
| 327 | - rightsidehighkick = "오른쪽 다리를 좀 더 높이 들어올리세요"; | 393 | + Debug.Log(ReadAngles[7] + " , " + ReadAngles[8]); //7,8 동일함 |
| 394 | + LegUp3.SetActive(true); //다리를 더 높이 들어올리세요 | ||
| 395 | + Great5.SetActive(false); | ||
| 396 | + } | ||
| 397 | + else if (ReadAngles[7] <= 5) | ||
| 398 | + { | ||
| 399 | + LegUp3.SetActive(false); | ||
| 400 | + } | ||
| 401 | + else | ||
| 402 | + { | ||
| 403 | + LegUp3.SetActive(false); | ||
| 404 | + } | ||
| 405 | + | ||
| 406 | + if (ReadAngles[7] >= 40) | ||
| 407 | + { | ||
| 408 | + Great5.SetActive(true); //Great | ||
| 409 | + } | ||
| 410 | + else if (ReadAngles[8] >= 40) | ||
| 411 | + { | ||
| 412 | + Great5.SetActive(true); //Great | ||
| 413 | + | ||
| 414 | + } | ||
| 415 | + else | ||
| 416 | + { | ||
| 417 | + Great5.SetActive(false); | ||
| 418 | + } | ||
| 328 | } | 419 | } |
| 329 | - else | 420 | + else if (exercise == "Lunge") |
| 330 | { | 421 | { |
| 331 | - rightsidehighkick = ""; | 422 | + |
| 423 | + if (ReadAngles[3] < 95 || ReadAngles[4] < 95) | ||
| 424 | + { | ||
| 425 | + great = "GREAT!"; | ||
| 426 | + Great5.SetActive(true); | ||
| 427 | + } | ||
| 428 | + else | ||
| 429 | + { | ||
| 430 | + great = ""; | ||
| 431 | + Great5.SetActive(false); | ||
| 432 | + } | ||
| 332 | } | 433 | } |
| 333 | 434 | ||
| 435 | + //공통된 사항 | ||
| 334 | if (ReadAngles[0] < 170 || ReadAngles[0] > 190) | 436 | if (ReadAngles[0] < 170 || ReadAngles[0] > 190) |
| 335 | { | 437 | { |
| 336 | spinestraight = "허리를 곧게 펴세요!"; | 438 | spinestraight = "허리를 곧게 펴세요!"; |
| 439 | + SpineStraight4.SetActive(true); | ||
| 337 | } | 440 | } |
| 338 | - else { | 441 | + else |
| 339 | - spinestraight = ""; | ||
| 340 | - } | ||
| 341 | - | ||
| 342 | - if (ReadAngles[3] < 100 || ReadAngles[4] < 100) | ||
| 343 | { | 442 | { |
| 344 | - great = "GREAT!"; | 443 | + spinestraight = ""; |
| 345 | - } | 444 | + SpineStraight4.SetActive(false); |
| 346 | - else { | ||
| 347 | - great = ""; | ||
| 348 | } | 445 | } |
| 349 | 446 | ||
| 350 | IfSpineIsStraight.text =spinestraight; | 447 | IfSpineIsStraight.text =spinestraight; |
| ... | @@ -466,13 +563,18 @@ public class Move : MonoBehaviour | ... | @@ -466,13 +563,18 @@ public class Move : MonoBehaviour |
| 466 | 563 | ||
| 467 | double AngleLeftHip = AngleBetweenTwoVectors(SpineBase - SpineShoulder, HipLeft - KneeLeft); //스쿼트, 런지 | 564 | double AngleLeftHip = AngleBetweenTwoVectors(SpineBase - SpineShoulder, HipLeft - KneeLeft); //스쿼트, 런지 |
| 468 | double AngleRightHip = AngleBetweenTwoVectors(SpineBase - SpineShoulder, HipRight - KneeRight); //스쿼트, 런지 | 565 | double AngleRightHip = AngleBetweenTwoVectors(SpineBase - SpineShoulder, HipRight - KneeRight); //스쿼트, 런지 |
| 469 | - double AngleLeftKnee = AngleBetweenTwoVectors(KneeLeft - HipLeft, KneeLeft - AnkleLeft); //스쿼트, 런지, 사이드하이킥 - Joint 3개로도 가능 | 566 | + //double AngleLeftKnee = AngleBetweenTwoVectors(KneeLeft - HipLeft, KneeLeft - AnkleLeft); //스쿼트, 런지, 사이드하이킥 - Joint 3개로도 가능 |
| 470 | - double AngleRightKnee = AngleBetweenTwoVectors(KneeRight - HipRight, KneeRight - AnkleRight); //스쿼트, 런지, 사이드하이킥 - Joint 3개로도 가능 | 567 | + double AngleLeftKnee = AngleBetweenTwoVectors(HipLeft - KneeLeft, AnkleLeft - KneeLeft); //스쿼트, 런지, 사이드하이킥 - Joint 3개로도 가능 |
| 471 | - | 568 | + //double AngleRightKnee = AngleBetweenTwoVectors(KneeRight - HipRight, KneeRight - AnkleRight); //스쿼트, 런지, 사이드하이킥 - Joint 3개로도 가능 |
| 569 | + double AngleRightKnee = AngleBetweenTwoVectors(HipRight - KneeRight, AnkleRight - KneeRight); //스쿼트, 런지, 사이드하이킥 - Joint 3개로도 가능 | ||
| 570 | + | ||
| 472 | double KneeToeLeft = AngleBetweenTwoVectors(AnkleLeft - FootLeft, KneeLeft - FootLeft); //스쿼트 - Joint 3개로도 가능 | 571 | double KneeToeLeft = AngleBetweenTwoVectors(AnkleLeft - FootLeft, KneeLeft - FootLeft); //스쿼트 - Joint 3개로도 가능 |
| 473 | double KneeToeRight = AngleBetweenTwoVectors(AnkleRight - FootRight, KneeRight - FootRight); //스쿼트 - Joint 3개로도 가능 | 572 | double KneeToeRight = AngleBetweenTwoVectors(AnkleRight - FootRight, KneeRight - FootRight); //스쿼트 - Joint 3개로도 가능 |
| 474 | - double LeftLegUp = AngleBetweenTwoVectors(SpineMid - SpineShoulder, KneeLeft - HipLeft); //사이드 하이킥 | 573 | + //double LeftLegUp = AngleBetweenTwoVectors(SpineMid - SpineShoulder, KneeLeft - HipLeft); //사이드 하이킥 |
| 475 | - double RightLegUp = AngleBetweenTwoVectors(SpineMid - SpineShoulder, KneeRight - HipRight); //사이드 하이킥 | 574 | + //double RightLegUp = AngleBetweenTwoVectors(SpineMid - SpineShoulder, KneeRight - HipRight); //사이드 하이킥 |
| 575 | + double LeftLegUp = AngleBetweenTwoVectors(KneeRight - HipRight, KneeLeft - HipLeft); //사이드 하이킥 | ||
| 576 | + double RightLegUp = AngleBetweenTwoVectors(KneeLeft - HipLeft, KneeRight - HipRight); //사이드 하이킥 | ||
| 577 | + //LeftLegUp이랑 RightLegUp이랑 각도 동일 | ||
| 476 | 578 | ||
| 477 | 579 | ||
| 478 | byte[] Angles = { Convert.ToByte(StraightSpine), | 580 | byte[] Angles = { Convert.ToByte(StraightSpine), | ... | ... |
-
Please register or login to post a comment