Browse Source

WIP record joints

Kenkart 2 years ago
parent
commit
c6c3bcf8f9

+ 37 - 34
Assets/KinectView/Scripts/BodySourceView.cs

@@ -8,6 +8,7 @@ public class BodySourceView : MonoBehaviour
     public Material BoneMaterial;
     public GameObject BodySourceManager;
     public Transform cameraRig;
+    public PlayerReplay playerReplay;
 
     private Dictionary<ulong, GameObject> _Bodies = new Dictionary<ulong, GameObject>();
     private BodySourceManager _BodyManager;
@@ -146,18 +147,17 @@ public class BodySourceView : MonoBehaviour
 
             Transform jointObj = bodyObject.transform.Find(jt.ToString());
             jointObj.localPosition = GetVector3FromJoint(sourceJoint);
-
-            // Make head joint invisible
-            jointObj.GetComponent<Renderer>().enabled = false;
-
-            // Make camera follow the head
+            
             if (jt == Kinect.JointType.Head)
             {
+                // Make head joint invisible ? (need to test)
+                jointObj.GetComponent<Renderer>().enabled = false;
+                // Make camera follow the head
                 cameraRig.localPosition = new Vector3(jointObj.localPosition.x, jointObj.localPosition.y - 3, jointObj.localPosition.z + 2);
             }
 
             LineRenderer lr = jointObj.GetComponent<LineRenderer>();
-            if (targetJoint.HasValue && jt != Kinect.JointType.Neck)
+            if (targetJoint.HasValue && jt != Kinect.JointType.Neck) // Do not make LineRenderer from neck to head
             {
                 lr.SetPosition(0, jointObj.localPosition);
                 lr.SetPosition(1, GetVector3FromJoint(targetJoint.Value));
@@ -169,37 +169,40 @@ public class BodySourceView : MonoBehaviour
             {
                 lr.enabled = false;
             }
+
+            // Record joints to PlayerReplay.cs (need to test)
+            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]);
-        }
+        //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)

+ 214 - 168
Assets/Scenes/Main.unity

@@ -38,7 +38,7 @@ RenderSettings:
   m_ReflectionIntensity: 1
   m_CustomReflection: {fileID: 0}
   m_Sun: {fileID: 0}
-  m_IndirectSpecularColor: {r: 0.18264514, g: 0.22835582, b: 0.307145, a: 1}
+  m_IndirectSpecularColor: {r: 0.1826408, g: 0.2283514, b: 0.3071478, a: 1}
   m_UseRadianceAmbientProbe: 0
 --- !u!157 &3
 LightmapSettings:
@@ -123,6 +123,50 @@ NavMeshSettings:
     debug:
       m_Flags: 0
   m_NavMeshData: {fileID: 0}
+--- !u!1 &65057764
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 6
+  m_Component:
+  - component: {fileID: 65057766}
+  - component: {fileID: 65057765}
+  m_Layer: 0
+  m_Name: PlayerReplay
+  m_TagString: Untagged
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 1
+--- !u!114 &65057765
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 65057764}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: bbc9941754e784247bca72d32bdcf987, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  joints: []
+--- !u!4 &65057766
+Transform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 65057764}
+  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+  m_LocalPosition: {x: 0, y: 0, z: 0}
+  m_LocalScale: {x: 1, y: 1, z: 1}
+  m_Children: []
+  m_Father: {fileID: 0}
+  m_RootOrder: 7
+  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
 --- !u!1001 &110216682
 PrefabInstance:
   m_ObjectHideFlags: 0
@@ -181,11 +225,11 @@ PrefabInstance:
     - target: {fileID: 2348914, guid: 4d293c8e162f3874b982baadd71153d2, type: 3}
       propertyPath: m_Materials.Array.data[0]
       value: 
-      objectReference: {fileID: 267184549}
+      objectReference: {fileID: 719272142}
     - target: {fileID: 3380982, guid: 4d293c8e162f3874b982baadd71153d2, type: 3}
       propertyPath: m_Mesh
       value: 
-      objectReference: {fileID: 564796636}
+      objectReference: {fileID: 1428167165}
     m_RemovedComponents: []
   m_SourcePrefab: {fileID: 100100000, guid: 4d293c8e162f3874b982baadd71153d2, type: 3}
 --- !u!4 &110216683 stripped
@@ -226,6 +270,7 @@ MonoBehaviour:
   BoneMaterial: {fileID: 2100000, guid: f2ea145c63353784985576f08398a815, type: 2}
   BodySourceManager: {fileID: 2078274386}
   cameraRig: {fileID: 110216683}
+  playerReplay: {fileID: 65057765}
 --- !u!4 &189736996
 Transform:
   m_ObjectHideFlags: 0
@@ -240,7 +285,7 @@ Transform:
   m_Father: {fileID: 0}
   m_RootOrder: 5
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
---- !u!21 &267184549
+--- !u!21 &719272142
 Material:
   serializedVersion: 6
   m_ObjectHideFlags: 0
@@ -275,170 +320,6 @@ Material:
     - _Flip: {r: 1, g: 1, b: 1, a: 1}
     - _RendererColor: {r: 1, g: 1, b: 1, a: 1}
   m_BuildTextureStacks: []
---- !u!43 &564796636
-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 &833043381
 PrefabInstance:
   m_ObjectHideFlags: 0
@@ -653,6 +534,7 @@ MonoBehaviour:
   BoneMaterial: {fileID: 2100000, guid: 7637b464f0a83d44ebfd8b655be7fe79, type: 2}
   BodySourceManager: {fileID: 2078274386}
   cameraRig: {fileID: 110216683}
+  playerReplay: {fileID: 0}
 --- !u!1001 &841858134
 PrefabInstance:
   m_ObjectHideFlags: 0
@@ -710,6 +592,170 @@ PrefabInstance:
       objectReference: {fileID: 0}
     m_RemovedComponents: []
   m_SourcePrefab: {fileID: 100100000, guid: 4f35fa249b5008c44ac2998be6f82d4d, type: 3}
+--- !u!43 &1428167165
+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!1 &1715140921
 GameObject:
   m_ObjectHideFlags: 0

+ 8 - 0
Assets/Scripts.meta

@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: c8040ade33f8e6c439fb2d46eadf8d4d
+folderAsset: yes
+DefaultImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 23 - 0
Assets/Scripts/JointsData.cs

@@ -0,0 +1,23 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+[System.Serializable]
+public class JointsData
+{
+    public List<float> jointsPositionsX = new List<float>();
+    public List<float> jointsPositionsY = new List<float>();
+    public List<float> jointsPositionsZ = new List<float>();
+
+    public JointsData(PlayerReplay playerReplay)
+    {
+        Transform[] joints = playerReplay.joints;
+
+        foreach(Transform t in joints)
+        {
+            jointsPositionsX.Add(t.position.x);
+            jointsPositionsY.Add(t.position.y);
+            jointsPositionsZ.Add(t.position.z);
+        }
+    }
+}

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

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

+ 47 - 0
Assets/Scripts/PlayerReplay.cs

@@ -0,0 +1,47 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class PlayerReplay : MonoBehaviour
+{
+    public Transform[] joints = new Transform[25];
+    public Material boneMaterial;
+
+    // (need to implement controller click to trigger save)
+    public void Save()
+    {
+        SaveSystem.Save(this);
+    }
+
+    public void Load()
+    {
+        JointsData data = SaveSystem.Load();
+
+        if(data == null)
+        {
+            Debug.Log("Load failed");
+            return;
+        }
+
+        for(int i = 0; i < joints.Length; i++)
+        {
+            // Create GameObject cubes for joints
+            GameObject jointObj = GameObject.CreatePrimitive(PrimitiveType.Cube);
+
+            LineRenderer lr = jointObj.AddComponent<LineRenderer>();
+            lr.positionCount = 2;
+            lr.material = boneMaterial;
+            lr.startWidth = 0.3f;
+            lr.endWidth = 0.3f;
+
+            jointObj.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f);
+
+            // (need to test)
+            jointObj.transform.position = new Vector3(data.jointsPositionsX[i], data.jointsPositionsY[i], data.jointsPositionsZ[i]);
+
+
+            // Connect the joints with LineRenderer
+        }
+
+    }
+}

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

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

+ 37 - 0
Assets/Scripts/SaveSystem.cs

@@ -0,0 +1,37 @@
+using System.Collections;
+using System.Collections.Generic;
+using System.IO;
+using System.Runtime.Serialization.Formatters.Binary;
+using UnityEngine;
+
+public static class SaveSystem
+{
+    private static string path = Application.persistentDataPath + "/joints.sav";
+
+    public static void Save(PlayerReplay playerReplay)
+    {
+        BinaryFormatter formatter = new BinaryFormatter();
+        FileStream stream = new FileStream(path, FileMode.Create);
+
+        JointsData data = new JointsData(playerReplay);
+        formatter.Serialize(stream, data);
+        stream.Close();
+    }
+
+    public static JointsData Load()
+    {
+        if (File.Exists(path))
+        {
+            BinaryFormatter formatter = new BinaryFormatter();
+            FileStream stream = new FileStream(path, FileMode.Open);
+
+            JointsData data = formatter.Deserialize(stream) as JointsData;
+            stream.Close();
+            return data;
+        } else
+        {
+            Debug.LogError("Save file not found in " + path);
+            return null;
+        }
+    }
+}

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

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

+ 21 - 0
Assets/Scripts/ViveInput.cs

@@ -0,0 +1,21 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using Valve.VR;
+
+public class ViveInput : MonoBehaviour
+{
+    public SteamVR_TrackedObject trackedObject;
+
+    // Start is called before the first frame update
+    void Start()
+    {
+        
+    }
+
+    // Update is called once per frame
+    void Update()
+    {
+        
+    }
+}

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

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