public void UpdateHandler()
    {
        if (!SteamVRStartup())
        {
            return;
        }
        if (notCreated)
        {
            foreach (var index in ovrHandler.GetTrackers().Keys)
            {
                var newTracker = Instantiate(tracker);
                newTracker.steamVRHandlerPrefab = gameObject;
                newTracker.overlayKey           = $"tracker_obj_{index}";
                newTracker.customDeviceIndex    = (uint)index;
                newTracker.overlayTexture       = overlayTexture;
                newTracker.cameraForTexture     = TrackerCamera;
            }
            notCreated = false;
        }
        ovrHandler.UpdateAll();

        if (hmdObject)
        {
            poseHandler.SetTransformToTrackedDevice(hmdObject.transform, poseHandler.hmdIndex);
        }
        // Debug.Log(ovrHandler.VRSystem.GetControllerRoleForTrackedDeviceIndex(0));
        if (poseHandler.rightActive && rightTrackerObj)
        {
            rightTrackerObj.SetActive(true);
            poseHandler.SetTransformToTrackedDevice(rightTrackerObj.transform, poseHandler.rightIndex);
        }
        else if (rightTrackerObj)
        {
            rightTrackerObj.SetActive(false);
        }

        if (poseHandler.leftActive && leftTrackerObj)
        {
            leftTrackerObj.SetActive(true);
            poseHandler.SetTransformToTrackedDevice(leftTrackerObj.transform, poseHandler.leftIndex);
        }
        else if (leftTrackerObj)
        {
            leftTrackerObj.SetActive(false);
        }
    }
Exemplo n.º 2
0
    public void SetActive()
    {
        int counter = 0;

        foreach (var tracker in ovrHandler.GetTrackers())
        {
            var selection = Instantiate(TrackerSelection, Vector3.zero, Quaternion.identity);
            //inputOutputMenu.SetTracker(tracker.Key);
            selection.SubMenu   = SubMenu;
            selection.TrackerId = tracker.Key;
            selection.Text.text = tracker.Value;
            selection.gameObject.GetComponent <Transform>().SetParent(Content);
            selection.gameObject.GetComponent <Transform>().localScale    = new Vector3(.5f, .5f, .5f);
            selection.gameObject.GetComponent <Transform>().localRotation = Quaternion.identity;
            selection.gameObject.GetComponent <Transform>().localPosition = new Vector3(0, (float)-11.5 * counter, 0);
            counter++;
        }
    }