예제 #1
0
        private void CheckIsValid()
        {
            bool isAvailable = false;

            if (m_Status != null)
            {
                isAvailable = m_Status.IsGloveAvailable(HandType);
            }
            bool isBinded      = HI5_BindInfoManager.IsGloveBinded(HandType);
            bool isBposSuccess = HI5_Manager.GetGloveStatus().isGloveBPosSuccess();

            if (isAvailable && isBinded && isBposSuccess)
            {
                if (HI5_Calibration.IsCalibratingBPose)
                {
                    isValid = false;
                }
                else
                {
                    isValid = true;
                }
            }
            else
            {
                isValid = false;
            }

            //if (HI5_Calibration.IsCalibratingBPose)
            //    isValid = false;
        }
        private void CheckIsValid()
        {
            bool isAvailable = m_Status.IsGloveAvailable(HandType);
            bool isBinded    = HI5_BindInfoManager.IsGloveBinded(HandType);

            if (isAvailable && isBinded)
            {
                isValid = true;
            }
            else
            {
                isValid = false;
            }

            if (HI5_Calibration.IsCalibratingBPose)
            {
                isValid = false;
            }
        }
    private void CheckDeviceBinded(int index)
    {
        if (!m_SteamVR_TrackedObject.isValid)
        {
            return;
        }

        HI5_BindInfoManager.LoadItems();

        if (HI5_BindInfoManager.CheckDeviceBinded(Hand.LEFT, m_DeviceSerialNumber))
        {
            HI5_BindInfoManager.LeftID = index;
            return;
        }
        if (HI5_BindInfoManager.CheckDeviceBinded(Hand.RIGHT, m_DeviceSerialNumber))
        {
            HI5_BindInfoManager.RightID = index;
            return;
        }

        EnableRenderer(true);
    }
    private void OnNewPoses(TrackedDevicePose_t[] poses)
    {
        if (!m_SteamVR_TrackedObject.isValid)
        {
            return;
        }

        int index = (int)m_SteamVR_TrackedObject.index;

        if (index == -1)
        {
            return;
        }

        if (poses.Length <= index)
        {
            return;
        }

        if (!poses[index].bDeviceIsConnected)
        {
            return;
        }

        if (!poses[index].bPoseIsValid)
        {
            return;
        }

        if (poses[index].eTrackingResult != ETrackingResult.Running_OK)
        {
            return;
        }

        // set index on this device
        m_Index = index;

        // get and check device type
        OPTDeviceType type = GetDeviceClass(index);

        if (type == OPTDeviceType.Unknown)
        {
            return;
        }

        // get and check device serial number
        string deviceSN = GetStringProperty((uint)index, ETrackedDeviceProperty.Prop_SerialNumber_String);

        if (deviceSN == null)
        {
            return;
        }

        m_DeviceSerialNumber = deviceSN;

        // get device position and rotation
        var        pose = new SteamVR_Utils.RigidTransform(poses[index].mDeviceToAbsoluteTracking);
        Vector3    pos  = pose.pos;
        Quaternion rot  = pose.rot;

        HI5_DataTransform.PushOpticalData(deviceSN, type, pos, rot);

        if (HI5_BindInfoManager.IsGloveBinded(Hand.LEFT) && HI5_BindInfoManager.IsGloveBinded(Hand.RIGHT))
        {
            return;
        }

        CheckDeviceBinded(index);
    }