You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

OpenVR Actions未激活,SteamVR输入绑定配置无效问题求助

OpenVR动作绑定功能故障
  • SteamVR控制台无法识别“new input method”
  • 绑定文件已加载但未完成绑定,手动通过UI绑定也无输出
  • 无报错信息,Actions处于未激活状态,仅返回全0的空数据

相关配置文件与代码

动作清单JSON

{
  "default_bindings": [
    {
      "controller_type": "knuckles",
      "binding_url": "binding_knuckles.json"
    }
  ],
  "actions": [
    {
      "name": "/actions/Dragger/in/hand_pos",
      "requirement": "optional",
      "type": "pose"
    },
    {
      "name": "/actions/Dragger/in/a_butt",
      "requirement": "optional",
      "type": "boolean"
    }
  ],
  "localization": [
    {
      "language_tag": "en_us",
      "/actions/Dragger/in/hand_pos": "poseable",
      "/actions/Dragger/in/a_butt": "abutt"
    }
  ]
}

绑定JSON

{
 "bindings": {
  "/actions/Dragger": {
   "poses": [
    {
     "output": "/actions/Dragger/in/hand_pos",
     "path": "/user/hand/left/pose/raw"
    }
   ],
   "haptics": [],
   "sources": [
    {
     "inputs": {
      "click": {
       "output": "/actions/Dragger/in/a_butt"
      }
     },
     "mode": "button",
     "path": "/user/hand/left/input/b"
    }
   ]
  }
 },
 "cords": {},
 "controller_type": "knuckles"
}

Python代码

import os, time, openvr

openvr.init(openvr.VRApplication_Scene)
openvr.VRInput().setActionManifestPath(os.path.abspath("manifests/manifest.json"))
actionset = openvr.VRInput().getActionSetHandle("/actions/Dragger")
action_hide_cubes = openvr.VRInput().getActionHandle("/actions/Dragger/in/a_butt")
action_hand = openvr.VRInput().getActionHandle("/actions/Dragger/in/hand_pos")

print("running")
for i in range(100000):

    action_sets = (openvr.VRActiveActionSet_t * 1)()
    action_set = action_sets[0]
    action_set.ulActionSet = actionset
    openvr.VRInput().updateActionState(action_sets)

    action_data = openvr.VRInput().getDigitalActionData(action_hide_cubes, openvr.k_ulInvalidInputValueHandle)
    if action_data.bActive:
        print("can be clicked")
        if action_data.bState:
            print("has been click")

    action_data = openvr.VRInput().getPoseActionDataForNextFrame(action_hand, openvr.TrackingUniverseRawAndUncalibrated
                                                                 ,   openvr.k_ulInvalidInputValueHandle)
    if action_data.bActive:
        print("hand pos:", action_data.pose.mDeviceToAbsoluteTracking)
    time.sleep(0.1)
    print()
    print("-----------")
openvr.shutdown()
print("shutdown")

故障排查与修复方案

1. 修正控制器类型与路径匹配

  • 动作清单default_bindings中的controller_type应为标准标识valve_controller_knuckles,而非knuckles,否则SteamVR无法匹配默认绑定。
  • 确认binding_url是相对于动作清单文件的路径,若binding_knuckles.json和manifest.json不在同一目录,需补全相对路径。

2. 完善ActionSet激活逻辑

  • Python代码中需明确激活ActionSet,修改循环内的动作集初始化代码:
    # 替换原动作集初始化部分
    active_set = openvr.VRActiveActionSet_t()
    active_set.ulActionSet = actionset
    active_set.nPriority = 0  # 设置优先级,0为默认
    active_sets = (openvr.VRActiveActionSet_t * 1)(active_set)
    openvr.VRInput().updateActionState(active_sets)
    
  • 不要用openvr.k_ulInvalidInputValueHandle作为设备句柄,主动获取对应手柄的输入源句柄:
    # 在初始化阶段添加
    left_hand_source = openvr.VRInput().getInputSourceHandle("/user/hand/left")
    # 获取数据时使用该句柄
    action_data = openvr.VRInput().getDigitalActionData(action_hide_cubes, left_hand_source)
    

3. 清理绑定文件冗余配置

  • 删除绑定文件根节点的cords字段,该字段为冗余配置,可能干扰SteamVR解析。
  • 确认绑定文件中sources的path与控制器实际输入路径匹配,可通过SteamVR输入调试工具查看可用路径。

4. 客户端环境检查

  • 升级SteamVR到最新版本,旧版本对新输入系统支持存在缺陷。
  • 在SteamVR设置的「控制器-绑定」中,确认应用程序已被识别,绑定文件状态为已加载。

内容的提问来源于stack exchange,提问作者ellie ff1493

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.05 14:55:41