/VRPNInput

A Unreal Engine 4 plugin to add VRPN input to blueprints.

Primary LanguageC++MIT LicenseMIT

VRPNInput

This is a Unreal Engine 4 plugin that adds VRPN input to blueprints. We use it internally at the University of Groningen Reality Theatre and Cave. As we only have VRPN Trackers and Buttons this plugin only supports those devices for now.

Installation

This plugin should be installed in the Plugins/HPCV/VRPNInput (so the VRPNInput.uplugin should be in that directory).

You will also need the VRPN library to compile this plugin. You can build it yourself or download it from the Github repository. These are the steps I used to build the VRPN library for Windows and Linux.

  1. Get the VRPN source at https://github.com/vrpn/vrpn
  2. For Windows:
  • Use CMake to make Visual Studio 2013 project files for Windows.
  • Unchecked everything except VRPN_BUILD_CLIENT_LIBRARY.
  • Build the library. In the installation dir you will have an include and a lib directory with the nessesary files.
  1. For Linux, this is the tricky part, I use the cross compile toolchain provided by Epic. But I have not managed to get CMake working with the toolchain so this is a bit hacky but it worked for me:
  • I have used the same vrpn_Configure.h file that was generated with CMake above to make sure that the library compiles with the same defines. So you need to replace that file with the one generated by CMake.
  • Copy Build/CrossCompile.bat to your VRPN library source directory and run it. You will have a linuxBuild directory with the files quat.a and vrpn.a.

After you build or downloaded the files you need to place the files in the right Unreal Engine directory:

  • The VRPN library goes into UnrealEngine/Engine/Source/ThirdParty/VRPN
  • You will need to place the VRPN.Build.cs in that directory too.
  • The you should also have a directory 'include' where the VRPN headers go.
  • The libraries go into lib/linux and lib/win64.
  • The plugin goes into Engine/Plugins

Using the plugin

The plugin takes a .ini file that describes what VRPN devices there are and how to map them to the input. The reason we use .ini files is that this way we can switch or remap VRPN devices without repackaging the project. Both the game and editor have default places to look for the .ini files. But you can also overwrite them with the -VRPNConfigFile="absolute_path_to_.ini" command line. The default places where the editor will look for the configuration file are:

  • First in the project directory: Config/VRPNConfig.ini
  • If not found, then in the editor directory: Engine/Plugins/HPCV/VRPNInput/Config/VRPNConfig.ini (this file is also in the github repo so if you install the plugin in Plugins/HPCV/VRPNInput the file should be there).

When packging the game it seems that the packaging system will package the .ini files from the project's Config directory in the .pak file. This is where the game will first look. If nothing is found it will look in the Engine/Plugins/HPCV/VRPNInput/Config/VRPNConfig.ini directory. If you forget to start the packaged game and it can't find the .ini file you will get lots of warnings in your log file but the game will run. If you open a project and forget to specify the option you will get a lot of warnings when trying to compile blueprints that make use of events coming from VRPN devices. The plugin will say which file it will load and where it searches for the file, so check the log if something does not work. It will also list the trackers found in the .ini file.

The plugin also honors the World To Meter parameters in the WorldSettings window of UE4. The default value is 100, at that value nothing changes. Other values will multiply the output coordinates by (WorldToMeters*0.01). A example here at the University of Groningen why we want such a thing: We use a z-space device and because it is just desktop sized we have two options. Make all the objects every small in the editor or change the WorldToMeters parameter. The first option does not work very good because it brings lots of limititations with lightmap generation and such. So we went for the second option.

Todo:

  • Add more VRPN devices
  • Add a way to bind custom c++ functions. (first check if UE4 doesn't have that option already for the event system)
  • The plugin needs to be pointed to a .ini file right now (both in editor and in packaged game). This happends with a command line option and is not ideal.
  • During packaging some scripts don't load the .ini (or the plugin?) and produce warnings about blueprint events not found.
  • Have a tool in the editor to edit the VRPN devices.
  • VRPN error messages are now written to the command line, intercept them and write them to the UE4 log.