EasyOpenVR
This is a git submodule to make it easier to talk to the OpenVR API using the C# headers.
Disclaimer
This is a project where I have collected things I've figured out while trying to interface OpenVR through C#. I'm not a C# programmer by trade so this is closer to a "get something done at all"-project than something hyper optimized.
As this is a work-in-progress things might get renamed along the way, hopefully I can keep that to a minimum as I do use this myself, in multiple projects. If nothing else this can act as a place to reference how to call certain OpenVR API functions from C#, some of them took me some time to figure out.
Installation
- To use this either download the repo/file directly or add it as a git submodule by running the following command in the root of your project, replace
TargetFolderwith your own value:git submodule add https://github.com/BOLL7708/EasyOpenVR.git TargetFolder/EasyOpenVR - Download these dependencies from OpenVR, the files are openvr_api.cs and openvr_api.dll, put them in the root of your project.
- Include the files in your project and set the
.dlltoCopy alwaysand build your project for 64bit.
Usage
- To use the singleton class, which is my current approach, simply include the namespace by adding
using BOLL7708;and then grab an instance fromEasyOpenVRSingleton.Instance - If you want your application to be something else than
VRApplication_Backgroundyou can set that withinstance.SetApplicationType() - With the instance run
instance.Init()to connect to a running OpenVR session. It will return true if initialization was successful, otherwise run a timer and try to init as often as you see fit. - At this point, if you have a connected session, you can explore the various calls you can do.
- If your project is missing for example
System.Drawing, check References in your project, choose "Add reference..." and checkSystem.Drawingfor inclusion.