Browse Source

add feedback case

Kenkart 2 years ago
parent
commit
d72ad18d5d
1 changed files with 20 additions and 16 deletions
  1. 20 16
      Assets/Scripts/BodyComparer.cs

+ 20 - 16
Assets/Scripts/BodyComparer.cs

@@ -75,24 +75,28 @@ public class BodyComparer : MonoBehaviour
 
                 if (distance > 0.15f)
                 {
-                    body.GetChild((int)jt).GetComponent<Renderer>().material.color = Color.red;
-
-                    // TODO: Haptic feedback
-                    if (jt == Kinect.JointType.WristLeft)
-                    {
-                        SteamVR_Actions.default_Haptic[SteamVR_Input_Sources.LeftHand].Execute(0, 0.01f, 10, 1);
-                    }
-                    else if (jt == Kinect.JointType.WristRight)
+                    if (mc.feedback == ModeController.Feedback.ColorFeedback)
                     {
-                        SteamVR_Actions.default_Haptic[SteamVR_Input_Sources.RightHand].Execute(0, 0.01f, 10, 1);
-                    }
-                    else if (jt == Kinect.JointType.AnkleLeft)
-                    {
-                        SteamVR_Actions.default_Haptic[SteamVR_Input_Sources.LeftFoot].Execute(0, 0.01f, 10, 1);
-                    }
-                    else if (jt == Kinect.JointType.AnkleRight)
+                        body.GetChild((int)jt).GetComponent<Renderer>().material.color = Color.red;
+                    } else if (mc.feedback == ModeController.Feedback.HapticFeedback)
                     {
-                        SteamVR_Actions.default_Haptic[SteamVR_Input_Sources.RightFoot].Execute(0, 0.01f, 10, 1);
+                        // TODO: Haptic feedback
+                        if (jt == Kinect.JointType.WristLeft)
+                        {
+                            SteamVR_Actions.default_Haptic[SteamVR_Input_Sources.LeftHand].Execute(0, 0.01f, 10, 1);
+                        }
+                        else if (jt == Kinect.JointType.WristRight)
+                        {
+                            SteamVR_Actions.default_Haptic[SteamVR_Input_Sources.RightHand].Execute(0, 0.01f, 10, 1);
+                        }
+                        else if (jt == Kinect.JointType.AnkleLeft)
+                        {
+                            SteamVR_Actions.default_Haptic[SteamVR_Input_Sources.LeftFoot].Execute(0, 0.01f, 10, 1);
+                        }
+                        else if (jt == Kinect.JointType.AnkleRight)
+                        {
+                            SteamVR_Actions.default_Haptic[SteamVR_Input_Sources.RightFoot].Execute(0, 0.01f, 10, 1);
+                        }
                     }
                 }
                 else