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 255 forks source link

Teleportation stops working when a Valve Index is connected. #880

Open Giantbean opened 3 years ago

Giantbean commented 3 years ago

I have a scene that can use Vive controllers or HMDs and I can connect the Index controllers which a Vive headset and everything works fine. As soon as I hook up a Valve Index HMD the teleport floor fails to work. When I press the teleport button I get the teleport arch and ring but the floor grid never shows up. It shows as active in the Unity inspector but is not visible in game and no teleportation is possible. No errors are given and other functions work fine just teleportation is gone.

This is a build in Unity 2018.3.9 with Steam VR 2.2 Updating to 2.6.1 breaks the Unity.XR.OpenVR references, updating Unity to 2019.4.3 got rid of the three XR.OpenVR errors however the app no longer launches in VR and will only open as a keyboard and mouse application. Further updating to later 2019 or 2020 versions is likely to break more dependencies on tools in use making it a poor solution. So is there a way to add Index support to older projects/builds? Something in the new teleport script that I can add to an old script and make it recognize the index headset?

zite commented 3 years ago

Do any errors show up? 2.2 is getting pretty old at this point, not sure what the issue would be.

Giantbean commented 3 years ago

Just the old "KeyNotFoundException: The given key was not present in the dictionary". from issue #596

Giantbean commented 3 years ago

Are there any updates made after 2.2 specific to Index support that might affect this? I can't update as it breaks to many other dependencies and would require me to completely rebuild a project years in the making.

zite commented 3 years ago

You shouldn't need to update your unity version to update the steamvr unity plugin. The plugin should be compatible down to 5.4. I'm not sure what references you're referring to that are broken.

Giantbean commented 3 years ago

Ah I see what your asking. It does however break if I update SteamVR without updating Unity as it throws errors about bad references to Unity.XR.OpenVR

I will run a test and post the error codes.

Update: Assembly has reference to non-existent assembly 'Unity.XR.OpenVR' (Assets/SteamVR/Input/Editor/SteamVR_Input_Editor.asmdef)

Assembly has reference to non-existent assembly 'Unity.XR.OpenVR' (Assets/SteamVR/Editor/SteamVR_Editor.asmdef)

and

Assembly has reference to non-existent assembly 'Unity.XR.OpenVR' (Assets/SteamVR/SteamVR.asmdef)

If I remove those references from the inspector I can only launch the game in WASD mode.

zite commented 3 years ago

You may need to update or reimport the OpenVR Desktop package from the unity package manager in that scenario

Giantbean commented 3 years ago

Its V1.0.5 and says it is up to date. I have removed it and reinstalled with no effect.

zite commented 3 years ago

That's very strange. Can you post your Packages/manifest.json file?

Giantbean commented 3 years ago

{ "dependencies": { "com.unity.ads": "2.0.8", "com.unity.analytics": "3.2.2", "com.unity.collab-proxy": "1.2.15", "com.unity.package-manager-ui": "2.0.7", "com.unity.postprocessing": "2.3.0", "com.unity.probuilder": "4.2.3", "com.unity.purchasing": "2.0.3", "com.unity.textmeshpro": "1.3.0", "com.unity.xr.openvr.standalone": "1.0.5", "com.unity.modules.ai": "1.0.0", "com.unity.modules.animation": "1.0.0", "com.unity.modules.assetbundle": "1.0.0", "com.unity.modules.audio": "1.0.0", "com.unity.modules.cloth": "1.0.0", "com.unity.modules.director": "1.0.0", "com.unity.modules.imageconversion": "1.0.0", "com.unity.modules.imgui": "1.0.0", "com.unity.modules.jsonserialize": "1.0.0", "com.unity.modules.particlesystem": "1.0.0", "com.unity.modules.physics": "1.0.0", "com.unity.modules.physics2d": "1.0.0", "com.unity.modules.screencapture": "1.0.0", "com.unity.modules.terrain": "1.0.0", "com.unity.modules.terrainphysics": "1.0.0", "com.unity.modules.tilemap": "1.0.0", "com.unity.modules.ui": "1.0.0", "com.unity.modules.uielements": "1.0.0", "com.unity.modules.umbra": "1.0.0", "com.unity.modules.unityanalytics": "1.0.0", "com.unity.modules.unitywebrequest": "1.0.0", "com.unity.modules.unitywebrequestassetbundle": "1.0.0", "com.unity.modules.unitywebrequestaudio": "1.0.0", "com.unity.modules.unitywebrequesttexture": "1.0.0", "com.unity.modules.unitywebrequestwww": "1.0.0", "com.unity.modules.vehicles": "1.0.0", "com.unity.modules.video": "1.0.0", "com.unity.modules.vr": "1.0.0", "com.unity.modules.wind": "1.0.0", "com.unity.modules.xr": "1.0.0" } }

zite commented 3 years ago

Just loaded up a 2018.4 project and am not getting any errors. It doesn't look like it's using the Unity.xr.openvr assembly though, you could try removing just that one again. Possibly upgrading to 2018.4? Maybe try deleting the library folder and reimporting the project?

Giantbean commented 3 years ago

Thanks I will try that and get back to you in about a week. At the moment I don't have access to the Index Headset.

Giantbean commented 3 years ago

Strangely teleportation is working in one of 9 scenes now. Is there an issue where teleportation stops working when new scene is loaded? Note, do not destroy on load is NOT checked on the player prefab.

Giantbean commented 3 years ago

OK It now works in two scenes (If they are set as the starting scene) and not in the rest however if I go back to the working scene it fails to work again? Is there a setting somewhere that I am missing?

Also this only happens with the Valve Index headset and I have no issues with any Vive headset? (Tested with multiple Vive/Pro/Pro Eye/Cosmos and Index users.)

Update: I also just noticed I have a timer that sets a count down when the Vive headset is put on but the Valve headset never starts this timer?

In the bindings and settings Dashboard (Open Binding UI) the Index doesn't show up however when a Vive is connected I have options.

Giantbean commented 3 years ago

I found the issue!

Using public SteamVR_Action_Boolean headsetOnHead = SteamVR_Input.GetBooleanAction("HeadsetOnHead"); and SteamVR.initializedState != SteamVR.InitializedStates.InitializeSuccess doesn't work with the index (Or I am implementing it wrong)

When I remove this script I can teleport again.

Any idea if this can still be used with the Index or do I need to scrap this code? ` public bool hmdOn; private float time;

    [Tooltip("This action lets you know when the player has placed the headset on their head")]
    public SteamVR_Action_Boolean headsetOnHead = SteamVR_Input.GetBooleanAction("HeadsetOnHead");

    private void Start()
    {
        //Pause the game until the headset is on
        if (SteamVR.initializedState != SteamVR.InitializedStates.InitializeSuccess)
        {
            Time.timeScale = 1;
        }
        else
        {
            Time.timeScale = 0;
        }  
    }

    void Update()
    {
        if (SteamVR.initializedState != SteamVR.InitializedStates.InitializeSuccess)
            return;

        if (headsetOnHead != null)
        {
            if (headsetOnHead.GetState(SteamVR_Input_Sources.Head))
            {
                //Debug.Log("<b>SteamVR Interaction System</b> HMD on Detected");
                //Pass a messege to the Step Manager telling it to proceed
                hmdOn = true;
                CheckRequirementsMet();
                //Unpause
                if (Time.timeScale == 0)
                    Time.timeScale = 1;

            }

            else if (headsetOnHead.GetStateUp(SteamVR_Input_Sources.Head))
            {
                //Debug.Log("<b>SteamVR Interaction System</b> HMD off head");
                hmdOn = false;
                //Pause when the headset is removed.
                if (Time.timeScale == 1)
                    Time.timeScale = 0;
            }
        }
    }

    public override bool CheckRequirementsMet()
    {
        return true;
    }
}`

PS. This script works with a Vive and Vive Pro headset but no the Index.