1

系统按钮不可重新映射,但是否可以通过 Steam SDK 或 VRTK 控制器操作识别用户何时按下它?我看 VRTK 至少知道了吧?

        public virtual void InitaliseHighlighters()
    {
        highlighterOptions = new Dictionary<string, object>();
        highlighterOptions.Add("resetMainTexture", true);
        VRTK_BaseHighlighter objectHighlighter = VRTK_BaseHighlighter.GetActiveHighlighter(gameObject);

        if (objectHighlighter == null)
        {
            objectHighlighter = gameObject.AddComponent<VRTK_MaterialColorSwapHighlighter>();
        }

        var controllerHand = VRTK_DeviceFinder.GetControllerHand(gameObject);

        objectHighlighter.Initialise(null, highlighterOptions);
        AddHighlighterToElement(GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_BaseController.ControllerElements.ButtonOne, controllerHand)), objectHighlighter, elementHighlighterOverrides.buttonOne);
        AddHighlighterToElement(GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_BaseController.ControllerElements.ButtonTwo, controllerHand)), objectHighlighter, elementHighlighterOverrides.buttonTwo);
        AddHighlighterToElement(GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_BaseController.ControllerElements.Body, controllerHand)), objectHighlighter, elementHighlighterOverrides.body);
        AddHighlighterToElement(GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_BaseController.ControllerElements.GripLeft, controllerHand)), objectHighlighter, elementHighlighterOverrides.gripLeft);
        AddHighlighterToElement(GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_BaseController.ControllerElements.GripRight, controllerHand)), objectHighlighter, elementHighlighterOverrides.gripRight);
        AddHighlighterToElement(GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_BaseController.ControllerElements.StartMenu, controllerHand)), objectHighlighter, elementHighlighterOverrides.startMenu);
        AddHighlighterToElement(GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_BaseController.ControllerElements.SystemMenu, controllerHand)), objectHighlighter, elementHighlighterOverrides.systemMenu);
        AddHighlighterToElement(GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_BaseController.ControllerElements.Touchpad, controllerHand)), objectHighlighter, elementHighlighterOverrides.touchpad);
        AddHighlighterToElement(GetElementTransform(VRTK_SDK_Bridge.GetControllerElementPath(SDK_BaseController.ControllerElements.Trigger, controllerHand)), objectHighlighter, elementHighlighterOverrides.trigger);
    }
4

2 回答 2

0

您可以捕获它,但您需要在 SteamVR 设置中设置发送系统按钮到所有应用程序的勾选。

于 2017-02-14T01:07:50.560 回答
0

使用 SteamVR 插件,您可以这样做。

[SerializeField] SteamVR_TrackedObject Controller;
SteamVR_Controller.Device device;
void Update(){
    device = SteamVR_Controller.Input ((int)Controller.index);
    if(device.GetPress (SteamVR_Controller.ButtonMask.System))
    {
        //your code
    }

}
于 2017-02-22T16:43:27.933 回答