ValveSoftware / steamvr_unity_plugin

SteamVR Unity Plugin - Documentation at: https://valvesoftware.github.io/steamvr_unity_plugin/
BSD 3-Clause "New" or "Revised" License
1.03k stars 256 forks source link

How to know if you already have the headset on as soon the application starts? #608

Open dpggit opened 4 years ago

dpggit commented 4 years ago

I can check if you put the headset while the app is running using the proximity sensor, but if you already had the headset on it doesnt work. Using GetState gives always true, so its useless for this

zite commented 4 years ago

GetState for a binding to the proximity sensor should return false if it's not on your head. Maybe double check your binding is correct in the Input Debugger screen in the Binding UI?

dpggit commented 4 years ago

I use public SteamVR_Action_Boolean headsetOnHead = SteamVR_Input.GetBooleanAction("HeadsetOnHead"); if (headsetOnHead.GetState(SteamVR_Input_Sources.Head)) and always enter. There is no way to set the binding for headset just for hand controllers and i dont know what input debugger screen you mean, i dont find any

dpggit commented 4 years ago

My binding_vive.json is

{
  "controller_type": "vive",
  "description": "",
  "name": "vive defaults",
  "bindings": {
    "/actions/default": {
      "chords": [],
      "sources": [
        {
          "path": "/user/head/proximity",
          "mode": "button",
          "parameters": {},
          "inputs": {
            "click": {
              "output": "/actions/default/in/headsetonhead"
            }
          }
        }
      ],
      "poses": [],
      "haptics": [],
      "skeleton": []
    },
    "/actions/htc_viu": {
      "chords": [],
      "sources": [
        {
          "path": "/user/head/proximity",
          "mode": "button",
          "parameters": {},
          "inputs": {
            "click": {
              "output": "/actions/htc_viu/in/viu_press_31"
            }
          }
        }
      ],
      "poses": [],
      "haptics": [],
      "skeleton": []
    }
  }
}

And i point the headsetOnHead variable to /actions/htc_viu/in/viu_press_31