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 && NRInput.GetControllerAvailableFeature(ControllerAvailableFeature.CONTROLLER_AVAILABLE_FEATURE_POSITION))
            {
                UpdateHeadPoseToController();
            }
            for (int i = 0; i < availableCount; i++)
            {
                UpdateControllerState(i);
            }
        }
 public override void TriggerHapticVibration(int index, float durationSeconds = 0.1f, float frequency = 1000f, float amplitude = 0.5f)
 {
     if (m_NativeController != null && NRInput.GetControllerAvailableFeature(ControllerAvailableFeature.CONTROLLER_AVAILABLE_FEATURE_HAPTIC_VIBRATE))
     {
         Int64 durationNano = (Int64)(durationSeconds * 1000000000);
         m_NativeController.TriggerHapticVibrate(index, durationNano, frequency, amplitude);
     }
 }
示例#3
0
 private void TrackPose()
 {
     m_Is6dof = NRInput.GetControllerAvailableFeature(ControllerAvailableFeature.CONTROLLER_AVAILABLE_FEATURE_POSITION) &&
                NRInput.GetControllerAvailableFeature(ControllerAvailableFeature.CONTROLLER_AVAILABLE_FEATURE_ROTATION);
     if (m_Is6dof)
     {
         UpdatePosition();
     }
     else
     {
         SmoothTrackTargetPosition();
     }
     UpdateRotation();
 }
示例#4
0
 private void TrackPose()
 {
     m_Is6dof = NRInput.GetControllerAvailableFeature(ControllerAvailableFeature.CONTROLLER_AVAILABLE_FEATURE_POSITION) &&
                NRInput.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();
 }
 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 && NRInput.GetControllerAvailableFeature(ControllerAvailableFeature.CONTROLLER_AVAILABLE_FEATURE_HAPTIC_VIBRATE))
         {
             Int64 durationNano = (Int64)(durationSeconds * 1000000000);
             m_NativeController.TriggerHapticVibrate(index, durationNano, frequency, amplitude);
         }
     }
 }