ValveSoftware / steamvr_unity_plugin

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

Inputs don't work #853

Closed nukadelic closed 4 years ago

nukadelic commented 4 years ago

I can't read any controller inputs at all but Simple Sample scene still updates the controller visuals ... did a little digging and seems like the actual transforms data is hidden somewhere in the OpenVR.dll ... wasn't the idea of openVR to make it open source ? can the buttons and axis data controller be exposed somehow ? So this is where i got stuck :

CVRRenderModels.GetComponentStateForDevicePath( ... )

which populates the following data

#region Assembly Unity.XR.OpenVR, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// ...\Library\ScriptAssemblies\Unity.XR.OpenVR.dll
#endregion

namespace Valve.VR
{
    public struct RenderModel_ComponentState_t
    {
        public HmdMatrix34_t mTrackingToComponentRenderModel;
        public HmdMatrix34_t mTrackingToComponentLocal;
        public uint uProperties;
    }
}

So do i inverse transform the matrices in order to guess if the button / trigger got pressed / approximate the axis ? I don't really need those complex layers of abstractions and the inputs API, is there anything like direct data read/write for each XR device using openVR ?

nukadelic commented 4 years ago

Tried initializing steamVR , activating steamVR ActionSets , Starting XR Subsystems manually , reading OpenVR.System directly , getting xr common usages from xr inputDevices but nothing seemed to work ( in editor input live view window didn't change as well )

But when i dropped the steamVR prefab with the player script into the scene with most of its components disabled (image below) then the SteamVR_Inputs started magically working as usual ... I did try writing manually what seemed to be a core system initialization functionality and attaching those separately later on but it didn't work except when i used the actual player prefab like so

zite commented 4 years ago

Raw controller data is not available via modern SteamVR. The industry is moving towards abstracting inputs to actions (see OpenXR).

Unity XR Input APIs will not function with this plugin as they rely on raw controller data.

The simple sample should allow SteamVR Actions to work. Were you getting any errors in the sample scene?

nukadelic commented 4 years ago

that 2nd command is my solution

morganavr commented 4 years ago

that 2nd command is my solution

What command? How did you fix it? I experience the same problem.

nukadelic commented 3 years ago

that 2nd command is my solution

What command? How did you fix it? I experience the same problem.

sorry typo , comment * - open-xr is out as a preview package now , might worth taking a look

Aceeri commented 3 years ago

Just chiming in, not much to say, but the new open-xr package definitely seems useful. Been using it across my Index and Oculus Rift CV1 and seems to work great so far.