Jump to content

[SOLVED] calling engine.vive functions from c#


photo

Recommended Posts

Posted

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

Posted

If so - this is pretty important for us - can we request C++/C# hooks in the next release? :)

Posted

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

Posted

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

Posted

Awesome.  Thanks for that!

×
×
  • Create New...