0
\$\begingroup\$

I'm new to virtual environments, having worked mostly with Arduino and other physical applications. I'm trying to set up VRPN server on one of the computers in my lab to pass some triggers from a Unity game to a VR environment and there is little to no documentation that a novice can at least hack through to explain how VRPN even works.

Can anyone shed a little light on it and explain how to set up a VRPN server using c#?

\$\endgroup\$
1
  • \$\begingroup\$ Yes, VRPN is terribly documented for new developers.... \$\endgroup\$ – sdfgeoff Jun 7 '16 at 11:34
1
\$\begingroup\$

Welcome to the wonderful/horrible world of VRPN. While I have not integrated it with unity, I have integrated it with another game engine. VRPN is a network transparent protocol for transferring data from one device to another. The devices can be local, remote, etc.

VRPN treats every input device as a server, and the VR environment (Eg unity) needs to connect to each of these. First you need the devices addres

W5D_INPUT_ADDRESS = "W5DTracker@192.168.1.4:3889"

And then you need to connect to it. In the VRPN python bindings this looks like:

w5d_device = vrpn.receiver.Tracker(W5D_INPUT_ADDRESS)

Note that a tracker is a generic device, capable of inputting rotations and positions and velocities and accelerations and button presses and.....

Then we need to poll the device and extract data from it. In the python bindings this is done by creating two callback functions and setting up change handlers:

w5d_device.register_change_handler(0, onPositionData, 'position')
w5d_device.register_change_handler(0, onVelocityData, 'velocity')

Where those functions (again in python) simply store the data they are passed which is a dict of {'position':[x,y,z], 'quaternion': [x,y,z,w]}


Now, how to do it from unity in C#? I'm not quite sure, not being a unity user. But there are some examples of using VRPN from C in the client_src directory. Just remember that your game is a client, connecting to the input device (unless you're doing force feedback, in which case you are a server as well, so the force feedback device can fetch data from you).

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.