고다경

트레이너 속도 조절

...@@ -2141,7 +2141,7 @@ MonoBehaviour: ...@@ -2141,7 +2141,7 @@ MonoBehaviour:
2141 SideHighKick_Instruction: {fileID: 1616699126} 2141 SideHighKick_Instruction: {fileID: 1616699126}
2142 Lunge_Left_Instruction: {fileID: 1914474766} 2142 Lunge_Left_Instruction: {fileID: 1914474766}
2143 Lunge_Right_Instruction: {fileID: 1540314533} 2143 Lunge_Right_Instruction: {fileID: 1540314533}
2144 - Right_Start: {fileID: 0} 2144 + Right_Start: {fileID: 779933557}
2145 --- !u!4 &1461362268 2145 --- !u!4 &1461362268
2146 Transform: 2146 Transform:
2147 m_ObjectHideFlags: 0 2147 m_ObjectHideFlags: 0
......
...@@ -44,7 +44,7 @@ public class Move : MonoBehaviour ...@@ -44,7 +44,7 @@ public class Move : MonoBehaviour
44 public bool trainer_check_outside = true; 44 public bool trainer_check_outside = true;
45 public float trainer_timer = 0; 45 public float trainer_timer = 0;
46 public bool trainer_other_side = false; 46 public bool trainer_other_side = false;
47 - public int trainer_speed = 5; 47 + public int trainer_speed = 0;
48 //lsy end 48 //lsy end
49 49
50 public Text AngleLeftKnee; 50 public Text AngleLeftKnee;
...@@ -149,7 +149,7 @@ public class Move : MonoBehaviour ...@@ -149,7 +149,7 @@ public class Move : MonoBehaviour
149 { 149 {
150 Lunge_Right_Instruction.SetActive(false); 150 Lunge_Right_Instruction.SetActive(false);
151 151
152 - trainer_speed = 8; 152 + trainer_speed = 7;
153 trainer_count = 0; 153 trainer_count = 0;
154 lines = lines_right; 154 lines = lines_right;
155 trainer_other_side = true; 155 trainer_other_side = true;
...@@ -242,7 +242,7 @@ public class Move : MonoBehaviour ...@@ -242,7 +242,7 @@ public class Move : MonoBehaviour
242 //lsy end 242 //lsy end
243 243
244 exercise = ClickExercise.selected_exercise; //ClickExercise에서 선택한 운동이 무엇인지 String으로 넘어옴. 244 exercise = ClickExercise.selected_exercise; //ClickExercise에서 선택한 운동이 무엇인지 String으로 넘어옴.
245 - exercise = "Squat"; 245 + exercise = "Lunge";
246 Debug.Log(exercise); //Squat, SideHiKick, Lunge 에 따라서 Trainer움직이고, 사용자에게 instruction주기 246 Debug.Log(exercise); //Squat, SideHiKick, Lunge 에 따라서 Trainer움직이고, 사용자에게 instruction주기
247 247
248 if (exercise == "Squat") 248 if (exercise == "Squat")
...@@ -258,7 +258,6 @@ public class Move : MonoBehaviour ...@@ -258,7 +258,6 @@ public class Move : MonoBehaviour
258 } 258 }
259 else if (exercise == "Lunge") 259 else if (exercise == "Lunge")
260 { 260 {
261 - trainer_speed = 5;
262 lines = File.ReadAllLines(@"Trainer_txt/runzi_right.txt"); 261 lines = File.ReadAllLines(@"Trainer_txt/runzi_right.txt");
263 lines_right = File.ReadAllLines(@"Trainer_txt/runzi_left.txt"); 262 lines_right = File.ReadAllLines(@"Trainer_txt/runzi_left.txt");
264 Debug.Log("읽음"); 263 Debug.Log("읽음");
...@@ -364,47 +363,21 @@ public class Move : MonoBehaviour ...@@ -364,47 +363,21 @@ public class Move : MonoBehaviour
364 count1.SetActive(false); 363 count1.SetActive(false);
365 ex_start.SetActive(true); 364 ex_start.SetActive(true);
366 365
367 - HipBalance1.SetActive(false);
368 - PullHipBack2.SetActive(false);
369 - LegUp3.SetActive(false);
370 - SpineStraight4.SetActive(false);
371 - Great5.SetActive(false);
372 - KneeDown6.SetActive(false);
373 -
374 } 366 }
375 else if (timer < 5) { 367 else if (timer < 5) {
376 count3.SetActive(false); 368 count3.SetActive(false);
377 count2.SetActive(true); 369 count2.SetActive(true);
378 - count1.SetActive(false);
379 - ex_start.SetActive(true);
380 -
381 - HipBalance1.SetActive(false);
382 - PullHipBack2.SetActive(false);
383 - LegUp3.SetActive(false);
384 - SpineStraight4.SetActive(false);
385 - Great5.SetActive(false);
386 - KneeDown6.SetActive(false);
387 370
388 } 371 }
389 else if (timer < 6) 372 else if (timer < 6)
390 { 373 {
391 - count3.SetActive(false);
392 count2.SetActive(false); 374 count2.SetActive(false);
393 count1.SetActive(true); 375 count1.SetActive(true);
394 ex_start.SetActive(true); 376 ex_start.SetActive(true);
395 377
396 - HipBalance1.SetActive(false);
397 - PullHipBack2.SetActive(false);
398 - LegUp3.SetActive(false);
399 - SpineStraight4.SetActive(false);
400 - Great5.SetActive(false);
401 - KneeDown6.SetActive(false);
402 -
403 } 378 }
404 else 379 else
405 { 380 {
406 - count3.SetActive(false);
407 - count2.SetActive(false);
408 count1.SetActive(false); 381 count1.SetActive(false);
409 ex_start.SetActive(false); 382 ex_start.SetActive(false);
410 383
...@@ -417,19 +390,6 @@ public class Move : MonoBehaviour ...@@ -417,19 +390,6 @@ public class Move : MonoBehaviour
417 } 390 }
418 //lsy end 391 //lsy end
419 392
420 -
421 - IfSpineIsStraight.text = "허리를 곧게: Tracking";
422 - HipBalance.text = "양쪽 힙 균형: Calculating";
423 - AngleLeftKnee.text = "";
424 - AngleRightKnee.text = "";
425 - KneeToeLeft.text = "";
426 - KneeToeRight.text = "";
427 - LeftLegUp.text = "왼쪽 다리 들어올린 각도: Tracking";
428 - RightLegUp.text = "오른쪽 다리 들어올린 각도: Tracking";
429 -
430 - PullHipBack.text = "";
431 - Great.text = "";
432 -
433 float[] data1 = new float[bodyCount * jointCount * 3]; 393 float[] data1 = new float[bodyCount * jointCount * 3];
434 int[] state = new int[bodyCount * jointCount]; 394 int[] state = new int[bodyCount * jointCount];
435 int[] id = new int[bodyCount]; 395 int[] id = new int[bodyCount];
...@@ -539,6 +499,46 @@ public class Move : MonoBehaviour ...@@ -539,6 +499,46 @@ public class Move : MonoBehaviour
539 Kinect.Joint sourceJoint = body.Joints[jt]; 499 Kinect.Joint sourceJoint = body.Joints[jt];
540 Kinect.Joint? targetJoint = null; 500 Kinect.Joint? targetJoint = null;
541 501
502 +
503 +
504 + if (_BoneMap.ContainsKey(jt))
505 + {
506 + targetJoint = body.Joints[_BoneMap[jt]];
507 + }
508 + Transform jointObj = bodyObject.transform.Find(jt.ToString());
509 + jointObj.localPosition = GetVector3FromJoint(sourceJoint);
510 +
511 + //Debug.Log(i);
512 +
513 + i++;
514 + data1[i] = sourceJoint.Position.X;
515 + i++;
516 + data1[i] = sourceJoint.Position.Y;
517 + i++;
518 + data1[i] = sourceJoint.Position.Z;
519 + if ((sourceJoint.Position.X + sourceJoint.Position.Y + sourceJoint.Position.Z) != 0)
520 + {
521 + state[i - 2] = 1;
522 + }
523 + skeleton_Trainnne.dasomset(data1, state, 0, true, true, body.Joints[jt], jointObj);
524 +
525 + /*
526 + LineRenderer lr = jointObj.GetComponent<LineRenderer>();
527 + if (targetJoint.HasValue)
528 + {
529 + //Debug.Log(jointObj.localPosition);
530 + //Debug.Log(GetVector3FromJoint(targetJoint.Value));
531 + lr.SetPosition(0, jointObj.localPosition);
532 + lr.SetPosition(1, GetVector3FromJoint(targetJoint.Value));
533 + lr.SetColors(GetColorForState(sourceJoint.TrackingState), GetColorForState(targetJoint.Value.TrackingState));
534 + }
535 + else
536 + {
537 + lr.enabled = false;
538 + }
539 + */
540 + }
541 +
542 /////////////////////////// 542 ///////////////////////////
543 Angles MyAngles = new Angles(); 543 Angles MyAngles = new Angles();
544 byte[] ReadAngles = MyAngles.GetVector(body); 544 byte[] ReadAngles = MyAngles.GetVector(body);
...@@ -547,19 +547,17 @@ public class Move : MonoBehaviour ...@@ -547,19 +547,17 @@ public class Move : MonoBehaviour
547 { 547 {
548 if (ReadAngles[1] - ReadAngles[2] <= 5) 548 if (ReadAngles[1] - ReadAngles[2] <= 5)
549 { 549 {
550 - hipbal = "";
551 - //hipbal = "양쪽 균형이 잡혀있습니다.";
552 HipBalance1.SetActive(false); 550 HipBalance1.SetActive(false);
553 } 551 }
554 else 552 else
555 { 553 {
556 - hipbal = "양쪽 힘이 동일하지 않습니다. \n균형을 잡으세요!"; 554 + //"양쪽 힘이 동일하지 않습니다. \n균형을 잡으세요!";
557 HipBalance1.SetActive(true); 555 HipBalance1.SetActive(true);
558 } 556 }
559 557
560 if (ReadAngles[5] > 95 || ReadAngles[6] > 95) 558 if (ReadAngles[5] > 95 || ReadAngles[6] > 95)
561 { 559 {
562 - pullhipback = "엉덩이를 뒤로 더 빼세요!"; 560 + //"엉덩이를 뒤로 더 빼세요!";
563 PullHipBack2.SetActive(true); 561 PullHipBack2.SetActive(true);
564 } 562 }
565 else 563 else
...@@ -569,8 +567,6 @@ public class Move : MonoBehaviour ...@@ -569,8 +567,6 @@ public class Move : MonoBehaviour
569 567
570 if (ReadAngles[3] < 95 && ReadAngles[4] < 95) 568 if (ReadAngles[3] < 95 && ReadAngles[4] < 95)
571 { 569 {
572 - great = "GREAT!";
573 - //Debug.Log(ReadAngles[3]);
574 Great5.SetActive(true); 570 Great5.SetActive(true);
575 } 571 }
576 else 572 else
...@@ -657,11 +653,13 @@ public class Move : MonoBehaviour ...@@ -657,11 +653,13 @@ public class Move : MonoBehaviour
657 flag = 1; 653 flag = 1;
658 } 654 }
659 } 655 }
660 - else { 656 + else
657 + {
661 658
662 flag_timer += Time.deltaTime; 659 flag_timer += Time.deltaTime;
663 //Debug.Log(flag_timer); 660 //Debug.Log(flag_timer);
664 - if (flag_timer > 50) { 661 + if (flag_timer > 5)
662 + {
665 flag = 0; 663 flag = 0;
666 flag_timer = 0; 664 flag_timer = 0;
667 Debug.Log("5초넘음"); 665 Debug.Log("5초넘음");
...@@ -684,7 +682,8 @@ public class Move : MonoBehaviour ...@@ -684,7 +682,8 @@ public class Move : MonoBehaviour
684 workout = true; 682 workout = true;
685 } 683 }
686 } 684 }
687 - else { 685 + else
686 + {
688 if (flag == 0) 687 if (flag == 0)
689 { 688 {
690 if (lunge_flag_r < 120 && ReadAngles[4] >= 91 && lunge_flag_r > ReadAngles[4]) 689 if (lunge_flag_r < 120 && ReadAngles[4] >= 91 && lunge_flag_r > ReadAngles[4])
...@@ -709,7 +708,7 @@ public class Move : MonoBehaviour ...@@ -709,7 +708,7 @@ public class Move : MonoBehaviour
709 708
710 flag_timer += Time.deltaTime; 709 flag_timer += Time.deltaTime;
711 //Debug.Log(flag_timer); 710 //Debug.Log(flag_timer);
712 - if (flag_timer > 50) 711 + if (flag_timer > 5)
713 { 712 {
714 flag = 0; 713 flag = 0;
715 flag_timer = 0; 714 flag_timer = 0;
...@@ -750,46 +749,7 @@ public class Move : MonoBehaviour ...@@ -750,46 +749,7 @@ public class Move : MonoBehaviour
750 SpineStraight4.SetActive(false); 749 SpineStraight4.SetActive(false);
751 } 750 }
752 751
753 -
754 /////////////////////////// 752 ///////////////////////////
755 -
756 - if (_BoneMap.ContainsKey(jt))
757 - {
758 - targetJoint = body.Joints[_BoneMap[jt]];
759 - }
760 - Transform jointObj = bodyObject.transform.Find(jt.ToString());
761 - jointObj.localPosition = GetVector3FromJoint(sourceJoint);
762 -
763 - //Debug.Log(i);
764 -
765 - i++;
766 - data1[i] = sourceJoint.Position.X;
767 - i++;
768 - data1[i] = sourceJoint.Position.Y;
769 - i++;
770 - data1[i] = sourceJoint.Position.Z;
771 - if ((sourceJoint.Position.X + sourceJoint.Position.Y + sourceJoint.Position.Z) != 0)
772 - {
773 - state[i - 2] = 1;
774 - }
775 - skeleton_Trainnne.dasomset(data1, state, 0, true, true, body.Joints[jt], jointObj);
776 -
777 - /*
778 - LineRenderer lr = jointObj.GetComponent<LineRenderer>();
779 - if (targetJoint.HasValue)
780 - {
781 - //Debug.Log(jointObj.localPosition);
782 - //Debug.Log(GetVector3FromJoint(targetJoint.Value));
783 - lr.SetPosition(0, jointObj.localPosition);
784 - lr.SetPosition(1, GetVector3FromJoint(targetJoint.Value));
785 - lr.SetColors(GetColorForState(sourceJoint.TrackingState), GetColorForState(targetJoint.Value.TrackingState));
786 - }
787 - else
788 - {
789 - lr.enabled = false;
790 - }
791 - */
792 - }
793 } 753 }
794 754
795 private static Color GetColorForState(Kinect.TrackingState state) 755 private static Color GetColorForState(Kinect.TrackingState state)
......