SteamVR_Controller.Update C# (CSharp) 메소드

Update() 공개 정적인 메소드

public static Update ( ) : void
리턴 void
    public static void Update()
    {
        for (int i = 0; i < OpenVR.k_unMaxTrackedDeviceCount; i++)
            Input(i).Update();
    }

Usage Example

예제 #1
0
    void Update()
    {
        if (cameras.Length == 0)
        {
            enabled = false;
            return;
        }

        // If our FixedUpdate rate doesn't match our render framerate, then catch the handoff here.
        SteamVR_Utils.QueueEventOnRenderThread(Unity.k_nRenderEventID_PostPresentHandoff);

        // Force controller update in case no one else called this frame to ensure prevState gets updated.
        SteamVR_Controller.Update();

        // Dispatch any OpenVR events.
        var vr      = SteamVR.instance;
        var vrEvent = new VREvent_t();

        for (int i = 0; i < 64; i++)
        {
            if (!vr.hmd.PollNextEvent(ref vrEvent))
            {
                break;
            }

            switch ((EVREventType)vrEvent.eventType)
            {
            case EVREventType.VREvent_InputFocusCaptured:                     // another app has taken focus (likely dashboard)
                SteamVR_Utils.Event.Send("input_focus", false);
                break;

            case EVREventType.VREvent_InputFocusReleased:                     // that app has released input focus
                SteamVR_Utils.Event.Send("input_focus", true);
                break;

            default:
                var name = System.Enum.GetName(typeof(EVREventType), vrEvent.eventType);
                if (name != null)
                {
                    SteamVR_Utils.Event.Send(name.Substring(8) /*strip VREvent_*/, vrEvent);
                }
                break;
            }
        }

        // Ensure various settings to minimize latency.
        Application.targetFrameRate     = -1;
        Application.runInBackground     = true; // don't require companion window focus
        QualitySettings.maxQueuedFrames = -1;
        QualitySettings.vSyncCount      = 0;    // this applies to the companion window

        if (lockPhysicsUpdateRateToRenderFrequency)
        {
            Time.fixedDeltaTime = 1.0f / vr.hmd_DisplayFrequency;
        }
    }
All Usage Examples Of SteamVR_Controller::Update