Browse Source

delete unused code

Kenkart 2 years ago
parent
commit
0eb187d688

+ 0 - 57
Assets/KinectView/Scripts/BodySourceView.cs

@@ -1,7 +1,6 @@
 using System.Collections.Generic;
 using UnityEngine;
 using Kinect = Windows.Kinect;
-using Valve.VR;
 
 public class BodySourceView : MonoBehaviour
 {
@@ -11,7 +10,6 @@ public class BodySourceView : MonoBehaviour
     public PlayerReplay playerReplay;
     public ModeController modeController;
 
-    // TODO: Implementing color feedback
     public GameObject body;
 
     public bool wristLeftLate;
@@ -213,30 +211,6 @@ public class BodySourceView : MonoBehaviour
                 jointObj.GetComponent<Renderer>().enabled = false;
             }
 
-            // WristLeft and WristRight do something if not following the motions
-            //if ((jt == Kinect.JointType.WristLeft && wristLeftLate) || (jt == Kinect.JointType.WristRight && wristRightLate))
-            //{
-            //    if (modeController.feedback == ModeController.Feedback.ColorFeedback)
-            //    {
-            //        jointObj.GetComponent<Renderer>().material.color = new Color(1, 0, 0);
-            //        jointObj.GetComponent<LineRenderer>().startColor = new Color(1, 0, 0);
-            //    }
-            //    else if (modeController.feedback == ModeController.Feedback.HapticFeedback)
-            //    {
-            //        // TODO: Add haptic feedback need to test
-            //        if (jt == Kinect.JointType.WristLeft)
-            //        {
-            //            Debug.Log("WristLeft vibrate");
-            //            SteamVR_Actions.default_Haptic[SteamVR_Input_Sources.LeftHand].Execute(0, 0.01f, 10, 1);
-            //        }
-            //        else if (jt == Kinect.JointType.WristRight)
-            //        {
-            //            Debug.Log("WristRight vibrate");
-            //            SteamVR_Actions.default_Haptic[SteamVR_Input_Sources.RightHand].Execute(0, 0.01f, 10, 1);
-            //        }
-            //    }
-            //}
-
             LineRenderer lr = jointObj.GetComponent<LineRenderer>();
             if (targetJoint.HasValue && jt != Kinect.JointType.Neck && jt != Kinect.JointType.ThumbLeft && jt != Kinect.JointType.ThumbRight
                     && jt != Kinect.JointType.HandLeft && jt != Kinect.JointType.HandRight
@@ -259,36 +233,6 @@ public class BodySourceView : MonoBehaviour
             // Record joints to PlayerReplay.cs
             playerReplay.joints[(int)jt] = jointObj;
         }
-
-        // Joint orientations
-        //Kinect.Vector4[] orientation = new Kinect.Vector4[22];
-        //orientation[0] = body.JointOrientations[Kinect.JointType.Head].Orientation;
-        //orientation[1] = body.JointOrientations[Kinect.JointType.Neck].Orientation;
-        //orientation[2] = body.JointOrientations[Kinect.JointType.SpineMid].Orientation;
-        //orientation[3] = body.JointOrientations[Kinect.JointType.ShoulderLeft].Orientation;
-        //orientation[4] = body.JointOrientations[Kinect.JointType.ShoulderRight].Orientation;
-        //orientation[5] = body.JointOrientations[Kinect.JointType.ElbowLeft].Orientation;
-        //orientation[6] = body.JointOrientations[Kinect.JointType.ElbowRight].Orientation;
-        //orientation[7] = body.JointOrientations[Kinect.JointType.WristLeft].Orientation;
-        //orientation[8] = body.JointOrientations[Kinect.JointType.WristRight].Orientation;
-        //orientation[9] = body.JointOrientations[Kinect.JointType.HipLeft].Orientation;
-        //orientation[10] = body.JointOrientations[Kinect.JointType.HipRight].Orientation;
-        //orientation[11] = body.JointOrientations[Kinect.JointType.KneeLeft].Orientation;
-        //orientation[12] = body.JointOrientations[Kinect.JointType.KneeRight].Orientation;
-        //orientation[13] = body.JointOrientations[Kinect.JointType.SpineBase].Orientation;
-        //orientation[14] = body.JointOrientations[Kinect.JointType.AnkleLeft].Orientation;
-        //orientation[15] = body.JointOrientations[Kinect.JointType.AnkleRight].Orientation;
-        //orientation[16] = body.JointOrientations[Kinect.JointType.FootLeft].Orientation;
-        //orientation[17] = body.JointOrientations[Kinect.JointType.FootRight].Orientation;
-        //orientation[18] = body.JointOrientations[Kinect.JointType.HandLeft].Orientation;
-        //orientation[19] = body.JointOrientations[Kinect.JointType.HandRight].Orientation;
-        //orientation[20] = body.JointOrientations[Kinect.JointType.ThumbLeft].Orientation;
-        //orientation[21] = body.JointOrientations[Kinect.JointType.ThumbRight].Orientation;
-
-        //for (int j = 0; j < 22; j++)
-        //{
-        //    //joints[j].rotation = ConvertKinectOrientationToUnity(orientation[j]);
-        //}
     }
 
     private static Color GetColorForState(Kinect.TrackingState state)
@@ -309,7 +253,6 @@ public class BodySourceView : MonoBehaviour
     private Vector3 GetVector3FromJoint(Kinect.Joint joint)
     {
         //return new Vector3(joint.Position.X * -10, joint.Position.Y * 10, joint.Position.Z * 10);
-
         return new Vector3(joint.Position.X * -1, joint.Position.Y, joint.Position.Z);
     }
 

+ 7 - 3
Assets/Scripts/BodyComparer.cs

@@ -2,8 +2,8 @@ using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using Kinect = Windows.Kinect;
+using Valve.VR;
 
-// TODO: Implementing color feedback
 public class BodyComparer : MonoBehaviour
 {
     public BodySourceView bsv;
@@ -42,6 +42,10 @@ public class BodyComparer : MonoBehaviour
                 {
                     //joints[index].GetComponent<Renderer>().material.color = Color.red;
                     body.GetChild((int)jt).GetComponent<Renderer>().material.color = Color.red;
+
+                    // TODO: Haptic feedback
+                    //SteamVR_Actions.default_Haptic[SteamVR_Input_Sources.LeftHand].Execute(0, 0.01f, 10, 1);
+                    //SteamVR_Actions.default_Haptic[SteamVR_Input_Sources.RightHand].Execute(0, 0.01f, 10, 1);
                 }
                 else
                 {
@@ -60,7 +64,7 @@ public class BodyComparer : MonoBehaviour
         }
 
         // Make all joints white
-        Transform body = bsv.body.transform;
+        Transform bodyEnd = bsv.body.transform;
         for (Kinect.JointType jt = Kinect.JointType.SpineBase; jt <= Kinect.JointType.ThumbRight; jt++)
         {
             // Skip these joints
@@ -69,7 +73,7 @@ public class BodyComparer : MonoBehaviour
                     || jt == Kinect.JointType.HandTipLeft || jt == Kinect.JointType.HandTipRight)
                 continue;
 
-            body.GetChild((int)jt).GetComponent<Renderer>().material.color = Color.white;
+            bodyEnd.GetChild((int)jt).GetComponent<Renderer>().material.color = Color.white;
         }
      }
 }

+ 0 - 1
Assets/Scripts/PlayerReplay.cs

@@ -128,7 +128,6 @@ public class PlayerReplay : MonoBehaviour
                 float distance = Vector3.Distance(prevJointPosition, jointPosition);
 
                 // If a joint is bigger than a certain distance, add it to the replay, else ignore it
-                // TODO: maybe distance need to be adjusted
                 if (distance >= 0.15f)
                 {
                     newJointsData.Add(jd);

+ 0 - 18
Assets/Scripts/Visualizer_FadeInSeries.cs

@@ -9,9 +9,6 @@ public class Visualizer_FadeInSeries : MonoBehaviour
     public Material transparentMat;
     public BodySourceView bsv;
 
-    public bool wristLeftTriggered;
-    public bool wristRightTriggered;
-
     private List<JointsData> jointsDataSeries = new List<JointsData>();
     private List<float> recordingTimesSeries = new List<float>();
     private Dictionary<Kinect.JointType, Kinect.JointType> _BoneMap = new Dictionary<Kinect.JointType, Kinect.JointType>()
@@ -47,7 +44,6 @@ public class Visualizer_FadeInSeries : MonoBehaviour
     };
 
     private float t;
-    private List<GameObject> jointObjs = new List<GameObject>();
     private bool beginUpdate;
     private List<GameObject> bodies = new List<GameObject>();
 
@@ -67,20 +63,6 @@ public class Visualizer_FadeInSeries : MonoBehaviour
         }
 
         t += Time.deltaTime / 3;
-
-        // TODO: different way to do it
-        // After half time, report if player WristLeft or WristRight late or not
-        //if (t > 0.5f)
-        //{
-        //    if (!wristLeftTriggered)
-        //    {
-        //        bsv.wristLeftLate = true;
-        //    }
-        //    if (!wristRightTriggered)
-        //    {
-        //        bsv.wristRightLate = true;
-        //    }
-        //}
     }
 
     public void SetData(List<JointsData> jointsDataSeries, List<float> recordingTimesSeries)