private void FinishControllerSetup(GameObject controllerModelGameObject, InteractionSourceHandedness handedness, string dictionaryKey) { var parentGameObject = new GameObject { name = handedness + "Controller" }; parentGameObject.transform.parent = transform; controllerModelGameObject.transform.parent = parentGameObject.transform; var newControllerInfo = new MotionControllerInfo(parentGameObject, handedness); newControllerInfo.LoadInfo(controllerModelGameObject.GetComponentsInChildren <Transform>()); if (handedness == InteractionSourceHandedness.Left) { leftControllerModel = newControllerInfo; } else if (handedness == InteractionSourceHandedness.Right) { rightControllerModel = newControllerInfo; } if (OnControllerModelLoaded != null) { OnControllerModelLoaded(newControllerInfo); } loadingControllers.Remove(dictionaryKey); controllerDictionary.Add(dictionaryKey, newControllerInfo); }
private IEnumerator Attach(GameObject target, Transform parent, InteractionSource source) { yield return(ControllerHelpers.AttachModel(target, parent, source, GLTFMaterial, GLTFMaterial)); if (AnimateControllerModel) { var newControllerInfo = new MotionControllerInfo() { }; newControllerInfo.LoadInfo(target.GetComponentsInChildren <Transform>(), this); controllerInfoForAnimation.Add(source.id, newControllerInfo); TraceHelper.Log("Controller added for animation"); } if (ShowDebugAxis) { if (source.handedness == InteractionSourceHandedness.Left) { axisRendererLeft = target.AddComponent <AxisRenderer>(); } else { axisRendererRight = target.AddComponent <AxisRenderer>(); } } }