private GameObject CreateBodyObject(ulong id) { GameObject body = new GameObject("Body:" + id); if (firstBody == null) { firstBody = body; } //bodyList[bodyCount] = body; for (Kinect.JointType jt = Kinect.JointType.SpineBase; jt <= Kinect.JointType.ThumbRight; jt++) { GameObject jointObj = GameObject.CreatePrimitive(PrimitiveType.Cube); jointObj.GetComponent <BoxCollider>().enabled = false; //jointObj.GetComponent<MeshRenderer>().enabled = false; LineRenderer lr = jointObj.AddComponent <LineRenderer>(); lr.SetVertexCount(2); lr.material = BoneMaterial; lr.SetWidth(0.05f, 0.05f); jointObj.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f); jointObj.name = jt.ToString(); jointObj.transform.parent = body.transform; if (jt == Kinect.JointType.Head && first_id == id) { _HeadCtrl.CreateHead(jointObj.transform); } if (GameController.Instance.gameStates != GameController.GameStates.Title) { jointObj.SetActive(false); } else if (Kinect.JointType.HipLeft <= jt && Kinect.JointType.FootRight >= jt) { jointObj.SetActive(false); } if (Kinect.JointType.Head == jt) { jointObj.SetActive(true); } if (isCreate == true && first_id != id) { body.SetActive(false); } else// isCreate == false 一回目通る { first_id = id; isCreate = true; } } return(body); }