/// <summary> /// Initialize hand controller pairs corresponding to each of the hand model pairs /// configured in _handPool.HandPairs list. If any of the hand model in /// _handPool.HandPairs is not configured properly, its corresponding hand controller /// will be null and will not be updated afterwards. /// </summary> private void InitHandControllers() { _handModelCalibProfileManager = CalibrationProfileManager.Instance; _handControllerPairs = new List <LeftRightPair <UnityHandController> >(); _handControllers = new List <UnityHandController>(); int n = _handPool.HandPairs.Count; int vrControllerPairNum = _vrControllerObjReferencePairs.Count; for (int i = 0; i < n; i++) { UnityHandRepresentation leftRep = _handPool.HandPairs[i].Left; UnityHandController left = null; if (leftRep.Initialized) { HandModelCalibrationProfile profile = _handModelCalibProfileManager.FindProfile( leftRep.GraphicsHandModel.Hand); left = new UnityHandController(false, leftRep, this); GameObject vrControllerObj = i < vrControllerPairNum ? _vrControllerObjReferencePairs[i].Left : null; Debug.Log(leftRep.GraphicsHandModel.Hand + "+++++++++++++++"); Debug.Log(profile); Debug.Log("_handModelCalibProfileManager" + _handModelCalibProfileManager); //Debug.Log(vrControllerObj); //Debug.Log(rightRep.BendInwardLocalDirection); left.StartInit(profile, vrControllerObj, leftRep.BendInwardLocalDirection); _handControllers.Add(left); } UnityHandRepresentation rightRep = _handPool.HandPairs[i].Right; UnityHandController right = null; if (rightRep.Initialized) { HandModelCalibrationProfile profile = _handModelCalibProfileManager.FindProfile( rightRep.GraphicsHandModel.Hand); right = new UnityHandController(true, rightRep, this); GameObject vrControllerObj = i < vrControllerPairNum ? _vrControllerObjReferencePairs[i].Right : null; right.StartInit(profile, vrControllerObj, rightRep.BendInwardLocalDirection); _handControllers.Add(right); } LeftRightPair <UnityHandController> pair = new LeftRightPair <UnityHandController>(left, right); _handControllerPairs.Add(pair); } }
private void FindController() { if (isReady) { return; } controller = DexmoController.Instance; profileMgr = CalibrationProfileManager.Instance; if (controller != null && profileMgr != null) { isReady = true; leftHand = controller.HandControllerPairs[0].Left; rightHand = controller.HandControllerPairs[0].Right; leftRep = controller.HandPool.HandPairs[0].Left; rightRep = controller.HandPool.HandPairs[0].Right; } }
public override void OnInspectorGUI() { serializedObject.Update(); DrawDefaultInspector(); CalibrationProfileManager profileManager = (CalibrationProfileManager)serializedObject.targetObject; if (GUILayout.Button("Add Hand profile slot")) { Undo.RecordObject(profileManager, "Add slot"); profileManager.AddHandProfileSlot(); } if (GUILayout.Button("Remove slot")) { Undo.RecordObject(profileManager, "Remove slot"); profileManager.RemoveLastHandProfile(); } //CountProp.intValue = EditorGUILayout.IntField("Count: ", CountProp.intValue); serializedObject.ApplyModifiedProperties(); }