Browse Source

fix line renderer material and scaling

Kenkart 2 years ago
parent
commit
defdb4f87e
3 changed files with 50 additions and 46 deletions
  1. 11 7
      Assets/KinectView/Scripts/BodySourceView.cs
  2. 39 39
      Assets/Scenes/Main.unity
  3. BIN
      Assets/joints.sav

+ 11 - 7
Assets/KinectView/Scripts/BodySourceView.cs

@@ -141,13 +141,16 @@ public class BodySourceView : MonoBehaviour
             LineRenderer lr = jointObj.AddComponent<LineRenderer>();
             //lr.SetVertexCount(2);
             lr.positionCount = 2;
-            lr.material = BoneMaterial;
+            //lr.material = BoneMaterial;
+            // TODO: change size of line
             //lr.SetWidth(0.05f, 0.05f);
-            lr.startWidth = 0.3f;
-            lr.endWidth = 0.3f;
+            lr.startWidth = 0.05f;
+            lr.endWidth = 0.05f;
+            Material whiteDiffuseMat = new Material(Shader.Find("Unlit/Texture"));
+            lr.material = whiteDiffuseMat;
 
             // TODO: change size of cube
-            jointObj.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f);
+            jointObj.transform.localScale = new Vector3(0.05f, 0.05f, 0.05f);
             jointObj.name = jt.ToString();
             jointObj.transform.parent = body.transform;
         }
@@ -178,10 +181,10 @@ public class BodySourceView : MonoBehaviour
                 // Make camera follow the head
                 if (modeController.perspective == ModeController.Perspective.FirstPersonPerspective)
                 {
-                    cameraRig.localPosition = new Vector3(jointObj.localPosition.x, jointObj.localPosition.y - 3, jointObj.localPosition.z - 0.5f);
+                    cameraRig.localPosition = new Vector3(jointObj.localPosition.x, jointObj.localPosition.y - 1.4f, jointObj.localPosition.z - 0.3f);
                 } else
                 {
-                    cameraRig.localPosition = new Vector3(jointObj.localPosition.x, jointObj.localPosition.y - 3, jointObj.localPosition.z + 3);
+                    cameraRig.localPosition = new Vector3(jointObj.localPosition.x, jointObj.localPosition.y - 1.4f, jointObj.localPosition.z + 0.3f);
                 }
             }
 
@@ -286,7 +289,8 @@ public class BodySourceView : MonoBehaviour
     private static Vector3 GetVector3FromJoint(Kinect.Joint joint)
     {
         // TODO: modify to make joints more accurate
-        return new Vector3(joint.Position.X * -10, joint.Position.Y * 10, joint.Position.Z * 10);
+        //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 * 1, joint.Position.Z * 1);
     }
 
     private Quaternion ConvertKinectOrientationToUnity(Kinect.Vector4 orientation)

+ 39 - 39
Assets/Scenes/Main.unity

@@ -258,11 +258,11 @@ PrefabInstance:
     - target: {fileID: 2348914, guid: 4d293c8e162f3874b982baadd71153d2, type: 3}
       propertyPath: m_Materials.Array.data[0]
       value: 
-      objectReference: {fileID: 1889526134}
+      objectReference: {fileID: 1576511250}
     - target: {fileID: 3380982, guid: 4d293c8e162f3874b982baadd71153d2, type: 3}
       propertyPath: m_Mesh
       value: 
-      objectReference: {fileID: 1616843646}
+      objectReference: {fileID: 1041936322}
     m_RemovedComponents: []
   m_SourcePrefab: {fileID: 100100000, guid: 4d293c8e162f3874b982baadd71153d2, type: 3}
 --- !u!4 &110216683 stripped
@@ -394,7 +394,7 @@ MonoBehaviour:
   m_Script: {fileID: 11500000, guid: 1d71a394b8fb98e4fa49bede70070e0d, type: 3}
   m_Name: 
   m_EditorClassIdentifier: 
-  perspective: 1
+  perspective: 0
   feedback: 1
 --- !u!4 &815386529
 Transform:
@@ -689,7 +689,7 @@ PrefabInstance:
       objectReference: {fileID: 0}
     m_RemovedComponents: []
   m_SourcePrefab: {fileID: 100100000, guid: 4f35fa249b5008c44ac2998be6f82d4d, type: 3}
---- !u!43 &1616843646
+--- !u!43 &1041936322
 Mesh:
   m_ObjectHideFlags: 0
   m_CorrespondingSourceObject: {fileID: 0}
@@ -853,6 +853,41 @@ Mesh:
     offset: 0
     size: 0
     path: 
+--- !u!21 &1576511250
+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!1 &1715140921
 GameObject:
   m_ObjectHideFlags: 0
@@ -1087,41 +1122,6 @@ Transform:
   m_Father: {fileID: 0}
   m_RootOrder: 6
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
---- !u!21 &1889526134
-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!1 &1896464125
 GameObject:
   m_ObjectHideFlags: 0

BIN
Assets/joints.sav