Exemple #1
0
 private void OnDisable()
 {
     // TXRInput.RemoveClickListener(ControllerHandEnum.Right, ControllerButton.HOME, OnHomeButtonClick);
     // TXRInput.RemoveClickListener(ControllerHandEnum.Left, ControllerButton.HOME, OnHomeButtonClick);
     TXRInput.RemoveClickListener(ControllerHandEnum.Right, ControllerButton.APP, OnAppButtonClick);
     TXRInput.RemoveClickListener(ControllerHandEnum.Left, ControllerButton.APP, OnAppButtonClick);
 }
Exemple #2
0
        public override void Update()
        {
            if (m_ProcessedFrame == Time.frameCount)
            {
                return;
            }
            m_ProcessedFrame = Time.frameCount;
            if (m_NeedInit)
            {
                InitNativeController();
                return;
            }
            if (!Inited)
            {
                return;
            }
            int availableCount = ControllerCount;

            if (availableCount > 0 && TXRInput.GetControllerAvailableFeature(ControllerAvailableFeature.CONTROLLER_AVAILABLE_FEATURE_POSITION))
            {
                UpdateHeadPoseToController();
            }
            for (int i = 0; i < availableCount; i++)
            {
                UpdateControllerState(i);
            }
        }
 public virtual bool GetPressUp()
 {
     if (raycaster is TXRMultScrPointerRaycaster)
     {
         return(MultiScreenController.SystemButtonState.pressUp);
     }
     else
     {
         return(TXRInput.GetButtonUp(raycaster.RelatedHand, ControllerButton.TRIGGER));
     }
 }
Exemple #4
0
 private void UpdateTracker()
 {
     if (CameraCenter == null)
     {
         return;
     }
     m_IsEnabled = TXRInput.CheckControllerAvailable(defaultHandEnum);
     raycaster.gameObject.SetActive(m_IsEnabled && TXRInput.RaycastMode == RaycastModeEnum.Laser);
     modelAnchor.gameObject.SetActive(m_IsEnabled);
     if (m_IsEnabled)
     {
         TrackPose();
     }
 }
Exemple #5
0
 private void TrackPose()
 {
     m_Is6dof = TXRInput.GetControllerAvailableFeature(ControllerAvailableFeature.CONTROLLER_AVAILABLE_FEATURE_POSITION) &&
                TXRInput.GetControllerAvailableFeature(ControllerAvailableFeature.CONTROLLER_AVAILABLE_FEATURE_ROTATION);
     if (m_Is6dof)
     {
         raycaster.transform.localPosition = Vector3.zero;
         modelAnchor.localPosition         = Vector3.zero;
         UpdatePosition();
     }
     else
     {
         raycaster.transform.localPosition = m_LaserDefaultLocalOffset;
         modelAnchor.localPosition         = m_ModelDefaultLocalOffset;
         SmoothTrackTargetPosition();
     }
     UpdateRotation();
 }
Exemple #6
0
 public override void TriggerHapticVibration(int index, float durationSeconds = 0.1f, float frequency = 1000f, float amplitude = 0.5f)
 {
     if (!Inited)
     {
         return;
     }
     if (states[index].controllerType == ControllerType.CONTROLLER_TYPE_PHONE)
     {
         PhoneVibrateTool.TriggerVibrate(durationSeconds);
     }
     else
     {
         if (m_NativeController != null && TXRInput.GetControllerAvailableFeature(ControllerAvailableFeature.CONTROLLER_AVAILABLE_FEATURE_HAPTIC_VIBRATE))
         {
             Int64 durationNano = (Int64)(durationSeconds * 1000000000);
             m_NativeController.TriggerHapticVibrate(index, durationNano, frequency, amplitude);
         }
     }
 }
Exemple #7
0
 private void UpdatePosition()
 {
     transform.position = TXRInput.GetPosition(defaultHandEnum);
 }
Exemple #8
0
 private void UpdateRotation()
 {
     transform.localRotation = TXRInput.GetRotation(defaultHandEnum);
     transform.Rotate(Vector3.up * m_VerifyYAngle, Space.World);
 }