private void StartTracking() { SwitchModelRender(hmd); SwitchModelRender(rightController); SwitchModelRender(leftController); if (!tracking) { tracking = true; //iksolver headIK = gameObject.AddComponent<iksolver>(); //headIK.joints = new GameObject[2]; //headIK.joints[0] = head.parent.gameObject; //headIK.joints[1] = head.gameObject; //headIK.target = hmd.gameObject; //headIK.Solve(); IK_CCD2 rightIK = rightHand.gameObject.AddComponent <IK_CCD2>(); rightIK.joints = new GameObject[3]; rightIK.joints[0] = rightHand.parent.parent.gameObject; rightIK.joints[1] = rightHand.parent.gameObject; rightIK.joints[2] = rightHand.gameObject; rightIK.target = rightController.gameObject; IK_CCD2 leftIK = leftHand.gameObject.AddComponent <IK_CCD2>(); leftIK.joints = new GameObject[3]; leftIK.joints[0] = leftHand.parent.parent.gameObject; leftIK.joints[1] = leftHand.parent.gameObject; leftIK.joints[2] = leftHand.gameObject; leftIK.target = leftController.gameObject; rightIK.Solve(); leftIK.Solve(); } }
void Start() { headIK = headTarget.GetComponent <IK_CCD2>(); //lhIK = lhTarget.GetComponent<IK_CCD2>(); //rhIK = rhTarget.GetComponent<IK_CCD2>(); }