Jump to content

Vive Cosmos Controller OpenXR Feature for Unity


dario

Recommended Posts

Vive Cosmos OpenXR Feature package for Unity

After installing the Unity OpenXR plugin you can add the HTC Vive Cosmos Controller Support Feature to OpenXR Features as shown:

Features.thumb.PNG.cfd89bdebe6e26a454de683beef5dbdf.PNG
 

You can download the HTC Vive Cosmos Controller package preview as a tarball file here:

 

UPDATE:  v1.0.0

Unity issues from latest plugin resolved. Download:

com.htc.upm.vive.openxr.controllers-1.0.0.tgz

previous update:

  • Add common usage “gripButton” for grip-pressed input.
  • Add common usage “triggerButton” for trigger-pressed input

Use the package manager to install as either a tarball or if you run into any issue you can unzip it and use the from disk option and point to the json file.

openxrpacakge.thumb.png.00e679a5621c0843248742477375b9ec.png

Unity includes several samples with their OpenXR package so be sure to install the Controller Sample. 

This sample will display all the controller's inputs visually for almost all the input because the Cosmos controller has an additional "bumper" button next to the trigger button.  

cosmos-unity-bumper2.thumb.PNG.e346c2b86d82234ca107c67a77cfa9f9.PNG

As shown you can run in editor connecting to the OpenXR PC runtime. In this case it's the "Default" Vive Cosmos OpenXR runtime.  To set it as the default you should select it as the default when you first run the runtime from the Vive Console. This will set the default Windows registry values.

To install the Vive Cosmos OpenXR runtime please see: https//forum.vive.com/forum/92-vive-openxr/

Now as you may have noticed above I've added an indicator for the Bumper button status (green when pressed) for both left and right hand controllers for this sample. You can add them with the following steps.

1) Once you've enabled the feature (first screen shot above) we can edit the Controller sample to include the additional indicator by duplicating the Trigger Press visual element, renaming it as "Bumper Press" and moving it slightly to the right of Trigger Press (remember to do likewise for RightHand).

cosmos-unity-bumper.thumb.PNG.88099232169b7ccccebb820685b26776.PNG

2) To edit the Action binding for this new indicator first double click on the Action Reference field of the Action to Button ISX script component in the inspector as shown above.

Once you get the following Input Actions window, you can add the new actions and bind them to the appropriate binding path that the Vive Cosmos Controllers feature provided as shown below and while this window is open also add one for the right hand controller.

UnityInputActions.thumb.png.2256456c3043a8bcfc7753b53c28d873.png

 

And with that you can start using all the Vive Cosmos controllers inputs for your OpenXR applications!

Note: screen shots don't reflect the latest Unity OpenXR plugin version and will be updated

  • Like 2
Link to comment
Share on other sites

  • 1 month later...
  • 3 months later...

image.png.7383099aaf827c76a967d3597318d273.png

image.thumb.png.2200e5ac205a8c6b8674b22ad833deec.png image.thumb.png.5e173c02a569131db934636a49caf22c.png
I am currently using 2020.3.5 version of Unity. I connected my Cosmos and adjusted my settings accordingly. But when I hit Play, the error appear as shown in the screenshot and I don't know what went wrong.
(The error:

Failed to load openxr runtime loader.
UnityEngine.XR.Management.XRGeneralSettings:AttemptInitializeXRSDKOnLoad () (at Library/PackageCache/com.unity.xr.management@4.0.5/Runtime/XRGeneralSettings.cs:148))

)

 

Please feel free to ask for more information because I'm kinda new to this, and I'm not sure if I miss anything.

Thank you so much for replying!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...