Browse Source

implement color feedback

Kenkart 2 years ago
parent
commit
35f4c82dca

+ 26 - 23
Assets/KinectView/Scripts/BodySourceView.cs

@@ -11,6 +11,9 @@ public class BodySourceView : MonoBehaviour
     public PlayerReplay playerReplay;
     public PlayerReplay playerReplay;
     public ModeController modeController;
     public ModeController modeController;
 
 
+    // TODO: Implementing color feedback
+    public GameObject body;
+
     public bool wristLeftLate;
     public bool wristLeftLate;
     public bool wristRightLate;
     public bool wristRightLate;
 
 
@@ -115,7 +118,7 @@ public class BodySourceView : MonoBehaviour
 
 
     private GameObject CreateBodyObject(ulong id)
     private GameObject CreateBodyObject(ulong id)
     {
     {
-        GameObject body = new GameObject("Body:" + id);
+        body = new GameObject("Body:" + id);
         body.transform.parent = gameObject.transform;
         body.transform.parent = gameObject.transform;
 
 
         for (Kinect.JointType jt = Kinect.JointType.SpineBase; jt <= Kinect.JointType.ThumbRight; jt++)
         for (Kinect.JointType jt = Kinect.JointType.SpineBase; jt <= Kinect.JointType.ThumbRight; jt++)
@@ -211,28 +214,28 @@ public class BodySourceView : MonoBehaviour
             }
             }
 
 
             // WristLeft and WristRight do something if not following the motions
             // 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);
-                    }
-                }
-            }
+            //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>();
             LineRenderer lr = jointObj.GetComponent<LineRenderer>();
             if (targetJoint.HasValue && jt != Kinect.JointType.Neck && jt != Kinect.JointType.ThumbLeft && jt != Kinect.JointType.ThumbRight
             if (targetJoint.HasValue && jt != Kinect.JointType.Neck && jt != Kinect.JointType.ThumbLeft && jt != Kinect.JointType.ThumbRight

+ 248 - 201
Assets/Scenes/Main.unity

@@ -749,6 +749,7 @@ MonoBehaviour:
   transparentMat: {fileID: 2100000, guid: 803645c956e5ae64a9b99ae13a11cd41, type: 2}
   transparentMat: {fileID: 2100000, guid: 803645c956e5ae64a9b99ae13a11cd41, type: 2}
   vfi: {fileID: 1896464126}
   vfi: {fileID: 1896464126}
   vfis: {fileID: 1143995017}
   vfis: {fileID: 1143995017}
+  bc: {fileID: 336955516}
   textFinish: {fileID: 752409666}
   textFinish: {fileID: 752409666}
 --- !u!4 &65057766
 --- !u!4 &65057766
 Transform:
 Transform:
@@ -904,11 +905,11 @@ PrefabInstance:
     - target: {fileID: 2348914, guid: 4d293c8e162f3874b982baadd71153d2, type: 3}
     - target: {fileID: 2348914, guid: 4d293c8e162f3874b982baadd71153d2, type: 3}
       propertyPath: m_Materials.Array.data[0]
       propertyPath: m_Materials.Array.data[0]
       value: 
       value: 
-      objectReference: {fileID: 1991663185}
+      objectReference: {fileID: 147027303}
     - target: {fileID: 3380982, guid: 4d293c8e162f3874b982baadd71153d2, type: 3}
     - target: {fileID: 3380982, guid: 4d293c8e162f3874b982baadd71153d2, type: 3}
       propertyPath: m_Mesh
       propertyPath: m_Mesh
       value: 
       value: 
-      objectReference: {fileID: 1219733404}
+      objectReference: {fileID: 1011376566}
     m_RemovedComponents: []
     m_RemovedComponents: []
   m_SourcePrefab: {fileID: 100100000, guid: 4d293c8e162f3874b982baadd71153d2, type: 3}
   m_SourcePrefab: {fileID: 100100000, guid: 4d293c8e162f3874b982baadd71153d2, type: 3}
 --- !u!4 &110216683 stripped
 --- !u!4 &110216683 stripped
@@ -1108,6 +1109,41 @@ PrefabInstance:
       objectReference: {fileID: 2100000, guid: 5786f1117a840014b8ab40c3c7a18c22, type: 2}
       objectReference: {fileID: 2100000, guid: 5786f1117a840014b8ab40c3c7a18c22, type: 2}
     m_RemovedComponents: []
     m_RemovedComponents: []
   m_SourcePrefab: {fileID: 100100000, guid: 2f3fe288da751a2428fc82d8e5ed9f7e, type: 3}
   m_SourcePrefab: {fileID: 100100000, guid: 2f3fe288da751a2428fc82d8e5ed9f7e, type: 3}
+--- !u!21 &147027303
+Material:
+  serializedVersion: 6
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_Name: Sprites/Default
+  m_Shader: {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0}
+  m_ShaderKeywords: 
+  m_LightmapFlags: 4
+  m_EnableInstancingVariants: 0
+  m_DoubleSidedGI: 0
+  m_CustomRenderQueue: -1
+  stringTagMap: {}
+  disabledShaderPasses: []
+  m_SavedProperties:
+    serializedVersion: 3
+    m_TexEnvs:
+    - _AlphaTex:
+        m_Texture: {fileID: 0}
+        m_Scale: {x: 1, y: 1}
+        m_Offset: {x: 0, y: 0}
+    - _MainTex:
+        m_Texture: {fileID: 0}
+        m_Scale: {x: 1, y: 1}
+        m_Offset: {x: 0, y: 0}
+    m_Floats:
+    - PixelSnap: 0
+    - _EnableExternalAlpha: 0
+    m_Colors:
+    - _Color: {r: 1, g: 1, b: 1, a: 1}
+    - _Flip: {r: 1, g: 1, b: 1, a: 1}
+    - _RendererColor: {r: 1, g: 1, b: 1, a: 1}
+  m_BuildTextureStacks: []
 --- !u!4 &160482116 stripped
 --- !u!4 &160482116 stripped
 Transform:
 Transform:
   m_CorrespondingSourceObject: {fileID: 2528327074000149298, guid: 3f4814451272e874f9d7dc1534b22b63, type: 3}
   m_CorrespondingSourceObject: {fileID: 2528327074000149298, guid: 3f4814451272e874f9d7dc1534b22b63, type: 3}
@@ -1147,6 +1183,7 @@ MonoBehaviour:
   cameraRig: {fileID: 110216683}
   cameraRig: {fileID: 110216683}
   playerReplay: {fileID: 65057765}
   playerReplay: {fileID: 65057765}
   modeController: {fileID: 815386528}
   modeController: {fileID: 815386528}
+  body: {fileID: 0}
   wristLeftLate: 0
   wristLeftLate: 0
   wristRightLate: 0
   wristRightLate: 0
 --- !u!4 &189736996
 --- !u!4 &189736996
@@ -1853,6 +1890,50 @@ Transform:
   m_CorrespondingSourceObject: {fileID: 5675013305860159573, guid: 2f3fe288da751a2428fc82d8e5ed9f7e, type: 3}
   m_CorrespondingSourceObject: {fileID: 5675013305860159573, guid: 2f3fe288da751a2428fc82d8e5ed9f7e, type: 3}
   m_PrefabInstance: {fileID: 1506989620}
   m_PrefabInstance: {fileID: 1506989620}
   m_PrefabAsset: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
+--- !u!1 &336955515
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 6
+  m_Component:
+  - component: {fileID: 336955517}
+  - component: {fileID: 336955516}
+  m_Layer: 0
+  m_Name: BodyComparer
+  m_TagString: Untagged
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 1
+--- !u!114 &336955516
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 336955515}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: a24061f970865df429d059d6e0d39ddd, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  bsv: {fileID: 189736995}
+--- !u!4 &336955517
+Transform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 336955515}
+  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+  m_LocalPosition: {x: -0.043732986, y: 0.27812943, z: -3.7922807}
+  m_LocalScale: {x: 1, y: 1, z: 1}
+  m_Children: []
+  m_Father: {fileID: 0}
+  m_RootOrder: 18
+  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
 --- !u!4 &337450662 stripped
 --- !u!4 &337450662 stripped
 Transform:
 Transform:
   m_CorrespondingSourceObject: {fileID: 5672364630614476697, guid: a8d819c88b06d5d479cad532c162c475, type: 3}
   m_CorrespondingSourceObject: {fileID: 5672364630614476697, guid: a8d819c88b06d5d479cad532c162c475, type: 3}
@@ -3832,6 +3913,7 @@ MonoBehaviour:
   cameraRig: {fileID: 110216683}
   cameraRig: {fileID: 110216683}
   playerReplay: {fileID: 0}
   playerReplay: {fileID: 0}
   modeController: {fileID: 0}
   modeController: {fileID: 0}
+  body: {fileID: 0}
   wristLeftLate: 0
   wristLeftLate: 0
   wristRightLate: 0
   wristRightLate: 0
 --- !u!1001 &841858134
 --- !u!1001 &841858134
@@ -4695,6 +4777,170 @@ PrefabInstance:
       objectReference: {fileID: 0}
       objectReference: {fileID: 0}
     m_RemovedComponents: []
     m_RemovedComponents: []
   m_SourcePrefab: {fileID: 100100000, guid: e1ff1d8d5ca1e744e9735e8cf3e51fb4, type: 3}
   m_SourcePrefab: {fileID: 100100000, guid: e1ff1d8d5ca1e744e9735e8cf3e51fb4, type: 3}
+--- !u!43 &1011376566
+Mesh:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_Name: 
+  serializedVersion: 10
+  m_SubMeshes:
+  - serializedVersion: 2
+    firstByte: 0
+    indexCount: 24
+    topology: 0
+    baseVertex: 0
+    firstVertex: 0
+    vertexCount: 8
+    localAABB:
+      m_Center: {x: 0, y: 0.01, z: 0}
+      m_Extent: {x: 1.65, y: 0, z: 1.275}
+  m_Shapes:
+    vertices: []
+    shapes: []
+    channels: []
+    fullWeights: []
+  m_BindPose: []
+  m_BoneNameHashes: 
+  m_RootBoneNameHash: 0
+  m_BonesAABB: []
+  m_VariableBoneCountWeights:
+    m_Data: 
+  m_MeshCompression: 0
+  m_IsReadable: 1
+  m_KeepVertices: 1
+  m_KeepIndices: 1
+  m_IndexFormat: 0
+  m_IndexBuffer: 000004000100010004000500010005000200020005000600020006000300030006000700030007000000000007000400
+  m_VertexData:
+    serializedVersion: 3
+    m_VertexCount: 8
+    m_Channels:
+    - stream: 0
+      offset: 0
+      format: 0
+      dimension: 3
+    - stream: 0
+      offset: 0
+      format: 0
+      dimension: 0
+    - stream: 0
+      offset: 0
+      format: 0
+      dimension: 0
+    - stream: 0
+      offset: 12
+      format: 0
+      dimension: 4
+    - stream: 0
+      offset: 28
+      format: 0
+      dimension: 2
+    - stream: 0
+      offset: 0
+      format: 0
+      dimension: 0
+    - stream: 0
+      offset: 0
+      format: 0
+      dimension: 0
+    - stream: 0
+      offset: 0
+      format: 0
+      dimension: 0
+    - stream: 0
+      offset: 0
+      format: 0
+      dimension: 0
+    - stream: 0
+      offset: 0
+      format: 0
+      dimension: 0
+    - stream: 0
+      offset: 0
+      format: 0
+      dimension: 0
+    - stream: 0
+      offset: 0
+      format: 0
+      dimension: 0
+    - stream: 0
+      offset: 0
+      format: 0
+      dimension: 0
+    - stream: 0
+      offset: 0
+      format: 0
+      dimension: 0
+    m_DataSize: 288
+    _typelessdata: 0000c03f0ad7233c000090bf000000000000803f0000803f0000803f00000000000000000000c0bf0ad7233c000090bf000000000000803f0000803f0000803f0000803f000000000000c0bf0ad7233c0000903f000000000000803f0000803f0000803f00000000000000000000c03f0ad7233c0000903f000000000000803f0000803f0000803f0000803f000000003333d33f0ad7233c3333a3bf000000000000803f0000803f00000000000000000000803f3333d3bf0ad7233c3333a3bf000000000000803f0000803f000000000000803f0000803f3333d3bf0ad7233c3333a33f000000000000803f0000803f00000000000000000000803f3333d33f0ad7233c3333a33f000000000000803f0000803f000000000000803f0000803f
+  m_CompressedMesh:
+    m_Vertices:
+      m_NumItems: 0
+      m_Range: 0
+      m_Start: 0
+      m_Data: 
+      m_BitSize: 0
+    m_UV:
+      m_NumItems: 0
+      m_Range: 0
+      m_Start: 0
+      m_Data: 
+      m_BitSize: 0
+    m_Normals:
+      m_NumItems: 0
+      m_Range: 0
+      m_Start: 0
+      m_Data: 
+      m_BitSize: 0
+    m_Tangents:
+      m_NumItems: 0
+      m_Range: 0
+      m_Start: 0
+      m_Data: 
+      m_BitSize: 0
+    m_Weights:
+      m_NumItems: 0
+      m_Data: 
+      m_BitSize: 0
+    m_NormalSigns:
+      m_NumItems: 0
+      m_Data: 
+      m_BitSize: 0
+    m_TangentSigns:
+      m_NumItems: 0
+      m_Data: 
+      m_BitSize: 0
+    m_FloatColors:
+      m_NumItems: 0
+      m_Range: 0
+      m_Start: 0
+      m_Data: 
+      m_BitSize: 0
+    m_BoneIndices:
+      m_NumItems: 0
+      m_Data: 
+      m_BitSize: 0
+    m_Triangles:
+      m_NumItems: 0
+      m_Data: 
+      m_BitSize: 0
+    m_UVInfo: 0
+  m_LocalAABB:
+    m_Center: {x: 0, y: 0.01, z: 0}
+    m_Extent: {x: 1.65, y: 0, z: 1.275}
+  m_MeshUsageFlags: 0
+  m_BakedConvexCollisionMesh: 
+  m_BakedTriangleCollisionMesh: 
+  m_MeshMetrics[0]: 1
+  m_MeshMetrics[1]: 1
+  m_MeshOptimizationFlags: 1
+  m_StreamData:
+    serializedVersion: 2
+    offset: 0
+    size: 0
+    path: 
 --- !u!1001 &1035789805
 --- !u!1001 &1035789805
 PrefabInstance:
 PrefabInstance:
   m_ObjectHideFlags: 0
   m_ObjectHideFlags: 0
@@ -5518,170 +5764,6 @@ Transform:
   m_CorrespondingSourceObject: {fileID: 2528327074000149298, guid: 3f4814451272e874f9d7dc1534b22b63, type: 3}
   m_CorrespondingSourceObject: {fileID: 2528327074000149298, guid: 3f4814451272e874f9d7dc1534b22b63, type: 3}
   m_PrefabInstance: {fileID: 113186067}
   m_PrefabInstance: {fileID: 113186067}
   m_PrefabAsset: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
---- !u!43 &1219733404
-Mesh:
-  m_ObjectHideFlags: 0
-  m_CorrespondingSourceObject: {fileID: 0}
-  m_PrefabInstance: {fileID: 0}
-  m_PrefabAsset: {fileID: 0}
-  m_Name: 
-  serializedVersion: 10
-  m_SubMeshes:
-  - serializedVersion: 2
-    firstByte: 0
-    indexCount: 24
-    topology: 0
-    baseVertex: 0
-    firstVertex: 0
-    vertexCount: 8
-    localAABB:
-      m_Center: {x: 0, y: 0.01, z: 0}
-      m_Extent: {x: 1.65, y: 0, z: 1.275}
-  m_Shapes:
-    vertices: []
-    shapes: []
-    channels: []
-    fullWeights: []
-  m_BindPose: []
-  m_BoneNameHashes: 
-  m_RootBoneNameHash: 0
-  m_BonesAABB: []
-  m_VariableBoneCountWeights:
-    m_Data: 
-  m_MeshCompression: 0
-  m_IsReadable: 1
-  m_KeepVertices: 1
-  m_KeepIndices: 1
-  m_IndexFormat: 0
-  m_IndexBuffer: 000004000100010004000500010005000200020005000600020006000300030006000700030007000000000007000400
-  m_VertexData:
-    serializedVersion: 3
-    m_VertexCount: 8
-    m_Channels:
-    - stream: 0
-      offset: 0
-      format: 0
-      dimension: 3
-    - stream: 0
-      offset: 0
-      format: 0
-      dimension: 0
-    - stream: 0
-      offset: 0
-      format: 0
-      dimension: 0
-    - stream: 0
-      offset: 12
-      format: 0
-      dimension: 4
-    - stream: 0
-      offset: 28
-      format: 0
-      dimension: 2
-    - stream: 0
-      offset: 0
-      format: 0
-      dimension: 0
-    - stream: 0
-      offset: 0
-      format: 0
-      dimension: 0
-    - stream: 0
-      offset: 0
-      format: 0
-      dimension: 0
-    - stream: 0
-      offset: 0
-      format: 0
-      dimension: 0
-    - stream: 0
-      offset: 0
-      format: 0
-      dimension: 0
-    - stream: 0
-      offset: 0
-      format: 0
-      dimension: 0
-    - stream: 0
-      offset: 0
-      format: 0
-      dimension: 0
-    - stream: 0
-      offset: 0
-      format: 0
-      dimension: 0
-    - stream: 0
-      offset: 0
-      format: 0
-      dimension: 0
-    m_DataSize: 288
-    _typelessdata: 0000c03f0ad7233c000090bf000000000000803f0000803f0000803f00000000000000000000c0bf0ad7233c000090bf000000000000803f0000803f0000803f0000803f000000000000c0bf0ad7233c0000903f000000000000803f0000803f0000803f00000000000000000000c03f0ad7233c0000903f000000000000803f0000803f0000803f0000803f000000003333d33f0ad7233c3333a3bf000000000000803f0000803f00000000000000000000803f3333d3bf0ad7233c3333a3bf000000000000803f0000803f000000000000803f0000803f3333d3bf0ad7233c3333a33f000000000000803f0000803f00000000000000000000803f3333d33f0ad7233c3333a33f000000000000803f0000803f000000000000803f0000803f
-  m_CompressedMesh:
-    m_Vertices:
-      m_NumItems: 0
-      m_Range: 0
-      m_Start: 0
-      m_Data: 
-      m_BitSize: 0
-    m_UV:
-      m_NumItems: 0
-      m_Range: 0
-      m_Start: 0
-      m_Data: 
-      m_BitSize: 0
-    m_Normals:
-      m_NumItems: 0
-      m_Range: 0
-      m_Start: 0
-      m_Data: 
-      m_BitSize: 0
-    m_Tangents:
-      m_NumItems: 0
-      m_Range: 0
-      m_Start: 0
-      m_Data: 
-      m_BitSize: 0
-    m_Weights:
-      m_NumItems: 0
-      m_Data: 
-      m_BitSize: 0
-    m_NormalSigns:
-      m_NumItems: 0
-      m_Data: 
-      m_BitSize: 0
-    m_TangentSigns:
-      m_NumItems: 0
-      m_Data: 
-      m_BitSize: 0
-    m_FloatColors:
-      m_NumItems: 0
-      m_Range: 0
-      m_Start: 0
-      m_Data: 
-      m_BitSize: 0
-    m_BoneIndices:
-      m_NumItems: 0
-      m_Data: 
-      m_BitSize: 0
-    m_Triangles:
-      m_NumItems: 0
-      m_Data: 
-      m_BitSize: 0
-    m_UVInfo: 0
-  m_LocalAABB:
-    m_Center: {x: 0, y: 0.01, z: 0}
-    m_Extent: {x: 1.65, y: 0, z: 1.275}
-  m_MeshUsageFlags: 0
-  m_BakedConvexCollisionMesh: 
-  m_BakedTriangleCollisionMesh: 
-  m_MeshMetrics[0]: 1
-  m_MeshMetrics[1]: 1
-  m_MeshOptimizationFlags: 1
-  m_StreamData:
-    serializedVersion: 2
-    offset: 0
-    size: 0
-    path: 
 --- !u!4 &1221788487 stripped
 --- !u!4 &1221788487 stripped
 Transform:
 Transform:
   m_CorrespondingSourceObject: {fileID: 5675013305860159573, guid: 2f3fe288da751a2428fc82d8e5ed9f7e, type: 3}
   m_CorrespondingSourceObject: {fileID: 5675013305860159573, guid: 2f3fe288da751a2428fc82d8e5ed9f7e, type: 3}
@@ -8940,41 +9022,6 @@ Transform:
   m_CorrespondingSourceObject: {fileID: 4315302312925223385, guid: a15c4b10370dd354a8d5d0fb6d99e482, type: 3}
   m_CorrespondingSourceObject: {fileID: 4315302312925223385, guid: a15c4b10370dd354a8d5d0fb6d99e482, type: 3}
   m_PrefabInstance: {fileID: 1423751364}
   m_PrefabInstance: {fileID: 1423751364}
   m_PrefabAsset: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
---- !u!21 &1991663185
-Material:
-  serializedVersion: 6
-  m_ObjectHideFlags: 0
-  m_CorrespondingSourceObject: {fileID: 0}
-  m_PrefabInstance: {fileID: 0}
-  m_PrefabAsset: {fileID: 0}
-  m_Name: Sprites/Default
-  m_Shader: {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0}
-  m_ShaderKeywords: 
-  m_LightmapFlags: 4
-  m_EnableInstancingVariants: 0
-  m_DoubleSidedGI: 0
-  m_CustomRenderQueue: -1
-  stringTagMap: {}
-  disabledShaderPasses: []
-  m_SavedProperties:
-    serializedVersion: 3
-    m_TexEnvs:
-    - _AlphaTex:
-        m_Texture: {fileID: 0}
-        m_Scale: {x: 1, y: 1}
-        m_Offset: {x: 0, y: 0}
-    - _MainTex:
-        m_Texture: {fileID: 0}
-        m_Scale: {x: 1, y: 1}
-        m_Offset: {x: 0, y: 0}
-    m_Floats:
-    - PixelSnap: 0
-    - _EnableExternalAlpha: 0
-    m_Colors:
-    - _Color: {r: 1, g: 1, b: 1, a: 1}
-    - _Flip: {r: 1, g: 1, b: 1, a: 1}
-    - _RendererColor: {r: 1, g: 1, b: 1, a: 1}
-  m_BuildTextureStacks: []
 --- !u!4 &1992593473 stripped
 --- !u!4 &1992593473 stripped
 Transform:
 Transform:
   m_CorrespondingSourceObject: {fileID: 5672364630614476697, guid: a8d819c88b06d5d479cad532c162c475, type: 3}
   m_CorrespondingSourceObject: {fileID: 5672364630614476697, guid: a8d819c88b06d5d479cad532c162c475, type: 3}

+ 61 - 0
Assets/Scripts/BodyComparer.cs

@@ -0,0 +1,61 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using Kinect = Windows.Kinect;
+
+// TODO: Implementing color feedback
+public class BodyComparer : MonoBehaviour
+{
+    public BodySourceView bsv;
+
+    private List<JointsData> jointsDataDemo = new List<JointsData>();
+    private List<float> recordingTimesDemo = new List<float>();
+
+    public void SetDataDemo(List<JointsData> jointsDataDemo, List<float> recordingTimesDemo)
+    {
+        this.jointsDataDemo = jointsDataDemo;
+        this.recordingTimesDemo = recordingTimesDemo;
+    }
+
+    public IEnumerator StartCompare()
+    {
+        for (int i = 0; i < jointsDataDemo.Count; i++)
+        {
+            Transform[] joints = bsv.body.GetComponentsInChildren<Transform>();
+            int index = 0;
+
+            for (Kinect.JointType jt = Kinect.JointType.SpineBase; jt <= Kinect.JointType.ThumbRight; jt++)
+            {
+                // Skip these joints
+                if (jt == Kinect.JointType.Head || jt == Kinect.JointType.ThumbLeft || jt == Kinect.JointType.ThumbRight
+                        || jt == Kinect.JointType.HandLeft || jt == Kinect.JointType.HandRight
+                        || jt == Kinect.JointType.HandTipLeft || jt == Kinect.JointType.HandTipRight)
+                    continue;
+
+
+                JointsData jd = jointsDataDemo[i];
+                Vector3 posJointDemo = new Vector3(jd.jointsPositionsX[(int)jt], jd.jointsPositionsY[(int)jt], jd.jointsPositionsZ[(int)jt]);
+
+                float distance = (joints[index].position - posJointDemo).magnitude;
+                if (distance > 0.2f)
+                {
+                    joints[index].GetComponent<Renderer>().material.color = Color.red;
+                }
+                else
+                {
+                    joints[index].GetComponent<Renderer>().material.color = Color.white;
+                }
+                index++;
+            }
+
+            float waitTime = 1;
+            if (i < recordingTimesDemo.Count - 1)
+            {
+                waitTime = recordingTimesDemo[i + 1] - recordingTimesDemo[i];
+            }
+
+            yield return new WaitForSeconds(waitTime);
+        }
+    }
+    // TODO: maybe at the end need to make all of them white?
+}

+ 11 - 0
Assets/Scripts/BodyComparer.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: a24061f970865df429d059d6e0d39ddd
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 11 - 2
Assets/Scripts/PlayerReplay.cs

@@ -15,6 +15,7 @@ public class PlayerReplay : MonoBehaviour
 
 
     public Visualizer_FadeIn vfi;
     public Visualizer_FadeIn vfi;
     public Visualizer_FadeInSeries vfis;
     public Visualizer_FadeInSeries vfis;
+    public BodyComparer bc;
 
 
     public GameObject textFinish;
     public GameObject textFinish;
 
 
@@ -252,6 +253,9 @@ public class PlayerReplay : MonoBehaviour
 
 
                     yield return Visualize(jointsDataDemo, recordingTimesDemo);
                     yield return Visualize(jointsDataDemo, recordingTimesDemo);
 
 
+                    // TODO: Implementing color feedback
+                    bc.SetDataDemo(jointsDataDemo, recordingTimesDemo);
+
                     jointsDataDemo.Clear();
                     jointsDataDemo.Clear();
                     recordingTimesDemo.Clear();
                     recordingTimesDemo.Clear();
 
 
@@ -283,7 +287,9 @@ public class PlayerReplay : MonoBehaviour
                     jointsDataSeries.Clear();
                     jointsDataSeries.Clear();
                     recordingTimesSeries.Clear();
                     recordingTimesSeries.Clear();
 
 
-                    yield return new WaitForSeconds(3);
+                    yield return bc.StartCompare();
+
+                    //yield return new WaitForSeconds(3);
                     yield return ViveInput.WaitForControllerPress();
                     yield return ViveInput.WaitForControllerPress();
                     break;
                     break;
                 }
                 }
@@ -296,6 +302,8 @@ public class PlayerReplay : MonoBehaviour
         // Last visualization
         // Last visualization
         yield return Visualize(jointsDataDemo, recordingTimesDemo);
         yield return Visualize(jointsDataDemo, recordingTimesDemo);
 
 
+        bc.SetDataDemo(jointsDataDemo, recordingTimesDemo);
+
         jointsDataDemo.Clear();
         jointsDataDemo.Clear();
         recordingTimesDemo.Clear();
         recordingTimesDemo.Clear();
 
 
@@ -309,7 +317,8 @@ public class PlayerReplay : MonoBehaviour
         jointsDataSeries.Clear();
         jointsDataSeries.Clear();
         recordingTimesSeries.Clear();
         recordingTimesSeries.Clear();
 
 
-        yield return new WaitForSeconds(3);
+        yield return bc.StartCompare();
+        //yield return new WaitForSeconds(3);
 
 
         textFinish.SetActive(true);
         textFinish.SetActive(true);
         yield return new WaitForSeconds(3);
         yield return new WaitForSeconds(3);

+ 0 - 1
Assets/Scripts/TriggerDetector.cs

@@ -17,7 +17,6 @@ public class TriggerDetector : MonoBehaviour
             Visualizer_FadeIn vfi = GetComponentInParent<Visualizer_FadeIn>();
             Visualizer_FadeIn vfi = GetComponentInParent<Visualizer_FadeIn>();
             vfi.wristLeftTriggered = true;
             vfi.wristLeftTriggered = true;
 
 
-            // TODO: Destroy visualization step if it is touched (need to test)
             Destroy(gameObject.transform.parent);
             Destroy(gameObject.transform.parent);
 
 
         } else if (other.CompareTag("WristRight"))
         } else if (other.CompareTag("WristRight"))

+ 17 - 12
Assets/Scripts/TriggerDetectorSeries.cs

@@ -8,21 +8,26 @@ public class TriggerDetectorSeries : MonoBehaviour
     {
     {
         if (other.CompareTag("WristLeft"))
         if (other.CompareTag("WristLeft"))
         {
         {
-            other.GetComponent<Renderer>().material.color = new Color(1, 1, 1);
-            other.GetComponent<LineRenderer>().startColor = new Color(1, 1, 1);
-            BodySourceView bsv = other.GetComponentInParent<BodySourceView>();
-            bsv.wristLeftLate = false;
-            Visualizer_FadeInSeries vfi = GetComponentInParent<Visualizer_FadeInSeries>();
-            vfi.wristLeftTriggered = true;
+            //other.GetComponent<Renderer>().material.color = new Color(1, 1, 1);
+            //other.GetComponent<LineRenderer>().startColor = new Color(1, 1, 1);
+            //BodySourceView bsv = other.GetComponentInParent<BodySourceView>();
+            //bsv.wristLeftLate = false;
+            //Visualizer_FadeInSeries vfi = GetComponentInParent<Visualizer_FadeInSeries>();
+            //vfi.wristLeftTriggered = true;
+
+            // TODO: Destroy visualization step if it is touched (need to test)
+            Destroy(gameObject.transform.parent);
         }
         }
         else if (other.CompareTag("WristRight"))
         else if (other.CompareTag("WristRight"))
         {
         {
-            other.GetComponent<Renderer>().material.color = new Color(1, 1, 1);
-            other.GetComponent<LineRenderer>().startColor = new Color(1, 1, 1);
-            BodySourceView bsv = other.GetComponentInParent<BodySourceView>();
-            bsv.wristRightLate = false;
-            Visualizer_FadeInSeries vfi = GetComponentInParent<Visualizer_FadeInSeries>();
-            vfi.wristRightTriggered = true;
+            //other.GetComponent<Renderer>().material.color = new Color(1, 1, 1);
+            //other.GetComponent<LineRenderer>().startColor = new Color(1, 1, 1);
+            //BodySourceView bsv = other.GetComponentInParent<BodySourceView>();
+            //bsv.wristRightLate = false;
+            //Visualizer_FadeInSeries vfi = GetComponentInParent<Visualizer_FadeInSeries>();
+            //vfi.wristRightTriggered = true;
+
+            Destroy(gameObject.transform.parent);
         }
         }
     }
     }
 }
 }

+ 11 - 11
Assets/Scripts/Visualizer_FadeInSeries.cs

@@ -70,17 +70,17 @@ public class Visualizer_FadeInSeries : MonoBehaviour
 
 
         // TODO: different way to do it
         // TODO: different way to do it
         // After half time, report if player WristLeft or WristRight late or not
         // 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;
-            }
-        }
+        //if (t > 0.5f)
+        //{
+        //    if (!wristLeftTriggered)
+        //    {
+        //        bsv.wristLeftLate = true;
+        //    }
+        //    if (!wristRightTriggered)
+        //    {
+        //        bsv.wristRightLate = true;
+        //    }
+        //}
     }
     }
 
 
     public void SetData(List<JointsData> jointsDataSeries, List<float> recordingTimesSeries)
     public void SetData(List<JointsData> jointsDataSeries, List<float> recordingTimesSeries)