public override void StartController(InstantVR ivr) { extension = ivr.GetComponent <IVR_Traditional>(); base.StartController(ivr); controller = Controllers.GetController(0); }
public override void StartExtension(InstantVR ivr) { base.StartExtension(ivr); CheckAxis(); controller = Controllers.GetController(0); }
public void EnableFingerInputModule(IVR_HandMovements handMovements, bool isLeft, bool touch, float autoActivation) { if (pointers == null) { pointers = new InteractionPointer[3]; // 0 = left index, 1 = right index, 2 = head } ControllerInput controllerInput = Controllers.GetController(0); Transform indexFingerDistal = null; InteractionPointer pointer = null; if (isLeft) { indexFingerDistal = handMovements.animator.GetBoneTransform(HumanBodyBones.LeftIndexDistal); if (indexFingerDistal != null) { pointer = new InteractionPointer(touch ? PointerType.Touch : PointerType.Gaze, indexFingerDistal.GetChild(0), eventSystem); pointers[(int)InputDeviceIDs.LeftHand] = pointer; } if (controllerInput != null) { pointer.controllerInputSide = controllerInput.left; } } else { indexFingerDistal = handMovements.animator.GetBoneTransform(HumanBodyBones.RightIndexDistal); if (indexFingerDistal != null) { pointer = new InteractionPointer(touch ? PointerType.Touch : PointerType.Gaze, indexFingerDistal.GetChild(0), eventSystem); pointers[(int)InputDeviceIDs.RightHand] = pointer; } if (controllerInput != null) { pointer.controllerInputSide = controllerInput.right; } } if (indexFingerDistal != null) { Transform indexFingerTip = indexFingerDistal.GetChild(0); pointer.localPointingDirection = indexFingerTip.InverseTransformDirection(indexFingerTip.position - indexFingerDistal.position).normalized; } pointer.focusTimeToTouch = autoActivation; }
public override void StartController(InstantVR ivr) { base.StartController(ivr); #if UNITY_ANDROID if (extension == null) { extension = ivr.GetComponent <IVR_Cardboard>(); } Camera camera = CheckCamera(); if (camera != null) { cameraTransform = camera.transform; neck2eyes = HeadUtils.GetNeckEyeDelta(ivr); cameraTransform.gameObject.SetActive(false); GvrViewer cardboardPrefab = Resources.Load <GvrViewer>("CardboardPrefab"); cardboard = Instantiate(cardboardPrefab); if (cardboard == null) { Debug.LogError("Could not instantiate Cardboard. CardboardCameraRig is missing?"); } else { cameraRoot = cardboard.gameObject; cameraRoot.transform.parent = ivr.transform; cameraRoot.transform.position = transform.position; cameraRoot.transform.rotation = ivr.transform.rotation; GvrHead gvrHead = cardboard.GetComponentInChildren <GvrHead>(); if (gvrHead != null) { camera = Camera.main; cameraTransform = Camera.main.transform; } } } controller = Controllers.GetController(0); #if INSTANTVR_ADVANCED vicoVRHead = GetComponent <IVR_VicoVRHead>(); #endif #endif }
public void EnableGazeInputModule(Transform cameraTransform, ControllerInput.Side inputSide, ControllerInput.Button activationButton, float autoActivation) { if (pointers == null) { pointers = new InteractionPointer[3]; // 0 = left index, 1 = right index, 2 = head } InteractionPointer pointer = new InteractionPointer(PointerType.Gaze, cameraTransform, eventSystem); pointer.focusingEnabled = true; // gaze is always focusing pointer.localPointingDirection = Vector3.forward; pointer.focusTimeToTouch = autoActivation; ControllerInput controllerInput = Controllers.GetController(0); if (controllerInput != null) { pointer.controllerInputSide = (inputSide == ControllerInput.Side.Left) ? controllerInput.left : controllerInput.right; } pointer.controllerButton = activationButton; pointers[(int)InputDeviceIDs.Head] = pointer; }
public override void StartController(InstantVR ivr) { base.StartController(ivr); #if UNITY_ANDROID Transform headcam = this.transform.FindChild("Headcam"); //localNeckOffset = headcam.localPosition; if (headcam != null) { headcam.gameObject.SetActive(false); Cardboard cardboardPrefab = Resources.Load <Cardboard>("CardboardPrefab"); cardboard = (Cardboard)Instantiate(cardboardPrefab, headcam.position, headcam.rotation); if (cardboard == null) { Debug.LogError("Could not instantiate Cardboard. CardboardCameraRig is missing?"); } else { cardboard.transform.parent = ivr.transform; cardboardStartPoint = cardboard.transform.position; baseStartPoint = ivr.transform.position; cardboardStartRotation = cardboard.transform.rotation; baseStartAngle = ivr.transform.eulerAngles.y; headcam.gameObject.SetActive(false); } startRotation = Quaternion.Inverse(ivr.transform.rotation); } //ivrInput = ivr.rightHandTarget.GetComponent<IVR_Input>(); controller = Controllers.GetController(0); #if INSTANTVR_ADVANCED vicoVRHead = GetComponent <IVR_VicoVRHead>(); #endif #endif }
public override void StartController(InstantVR ivr) { base.StartController(ivr); controller = Controllers.GetController(0); }