Browse Source

make head joint invisible

Kenkart 2 năm trước cách đây
mục cha
commit
290b985b5f
1 tập tin đã thay đổi với 5 bổ sung1 xóa
  1. 5 1
      Assets/KinectView/Scripts/BodySourceView.cs

+ 5 - 1
Assets/KinectView/Scripts/BodySourceView.cs

@@ -147,13 +147,17 @@ public class BodySourceView : MonoBehaviour
             Transform jointObj = bodyObject.transform.Find(jt.ToString());
             jointObj.localPosition = GetVector3FromJoint(sourceJoint);
 
+            // Make head joint invisible (need to test)
+            jointObj.GetComponent<Renderer>().enabled = false;
+
+            // Make camera follow the head
             if (jt == Kinect.JointType.Head)
             {
                 cameraRig.localPosition = new Vector3(jointObj.localPosition.x, jointObj.localPosition.y - 1, jointObj.localPosition.z);
             }
 
             LineRenderer lr = jointObj.GetComponent<LineRenderer>();
-            if (targetJoint.HasValue)
+            if (targetJoint.HasValue && targetJoint != body.Joints[_BoneMap[Kinect.JointType.Head]]) // (need to test)
             {
                 lr.SetPosition(0, jointObj.localPosition);
                 lr.SetPosition(1, GetVector3FromJoint(targetJoint.Value));