Jump to content

[SOLVED] calling engine.vive functions from c#


photo

Recommended Posts

Hi - is it possible to access the vive class/interface through C# (or even C++)?  

 

Or do I need to write my stuff all in UnigineScript?  - the documentation/samples seem to suggest this is currently the only way.

 

Thanks,

Simon

Link to comment

Hello,

 

Yes, it's possible. You need to using Interpreter and Reflection classes. Look at our last demo - "Oil Refinery". It's written in C++. Just copy and paste ViveAPI.h and ViveAPI.cpp files from it to your project.

At first, call init() method (to find all UnigineScript's function id), then you can call all other functions: getDevicePose, getControllerButtonPressed etc.

ViveAPI.h

ViveAPI.cpp

Link to comment

Hello again,

 

I wrote C# version of it.

 

Pros:

- You don't need to call the init() method in Vive class

- This class is completely static

 

Cons:

- Slower than C++ version (because Vive methods called via string name instead of int function_id)

ViveAPI.zip

Link to comment
×
×
  • Create New...