ellie ff1493
ellie ff1493

Reputation: 125

openvr actions are not active

im trying to get the action binding working.

steamvr doesn't seam to recognise the "new input method" in the steamvr console, but all the bindings get loaded correctly but dont get bound, and binding the with the ui still doesn't produce outputs no errors are thrown, and the actions aren't active and just return empty data (all 0)

{
  "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"
    }
  ]
}
{
 "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"
}

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")

Upvotes: 1

Views: 111

Answers (0)

Related Questions