Download

Razer Hydra Plugin

An event driven plugin for the Razer Hydra. Check out the video for a quick tutorial.

Since version 0.8, the plugin works through both Unreal Engine Motion Controller and Input Mapping abstraction as well as through a convenience component for hydra specific events and functions.

Forward me your suggestions and let me know if this helped you!

Only supported in Windows 64 & 32 Platform.

Download Latest
https://img.shields.io/github/release/getnamo/hydra-ue4.svg

Read the Github readme for the latest documentation,

Older 4.11+
https://github.com/getnamo/hydra-ue4/releases

Older
v0.8.3 for UE 4.10
v0.8.2 for UE 4.9
v0.7.8 for UE 4.8
v0.7.7 for UE 4.7
v0.7.6 for UE 4.6
v0.7.4 for UE 4.5
v0.6.5 for UE 4.4
v0.6.3 for UE 4.3
v0.5.3 for UE 4.2
v0.5.2 for UE 4.1

Resources
Github - Main Plugin Source and Documentation
Sixense UE4 Plugin thread

Installation (0.8 or newer)

  1. Download plugin
  2. Create new or choose project.
  3. Browse to your project folder (typically found at Documents/Unreal Project/{Your Project Root})
  4. Copy Plugins folders into your Project root.
  5. Restart the Editor and open your project again.
  6. (Optional) Select Window->Plugins. Click on Installed and you should see a category called Input and a plugin called Hydra Plugin now available. It should be automatically enabled, if not, Select Enabled. The Editor will warn you to restart, click restart.

Use Cases
Input mapping is recommended for Joystick and Button mapping, use Motion Controller Componentsfor x,y,z

How to use it - Motion Controllers
Please refer to the Motion Controller Component Setup unreal documentation as this setup is hardware agnostic. Since 0.9 a basic motion controller setup should look like this:

http://i.imgur.com/vbrj4wY.png

Where visible static meshes are parented to the motion controllers which are in turn parented to a chosen offset, forward by 40cm from the camera in this particular example.

No hydra specific component is required, tracking is handled internally and passed to the agnostic motion controller components and the input mapping system. Tracking should defer to other motion controllers if unplugged or docked.

Input Mapping

You can use either the Motion Controller input mapping (IM) events

http://i.imgur.com/toBD86X.png

or hydra specific ones

http://i.imgur.com/4Y2QyLh.png

Other Resources:

Video Series
2-part tutorial series by Weevilman, based on the 0.8.2 for UE 4.9.

Part 1

https://www.youtube.com/watch?v=CtWH8pgD-7Y

Part 2
https://youtube.com/watch?v=Vevt7f_sRgM

Changelist

0.9.5
-UE4.15 update

0.9.4
-fixed derived values (acceleration, velocity and angular velocity)

0.9.3
-fix unplugged event not triggering

0.9.2
-No hydra specific components required for full tracking. If you’re using Input Mapping + Motion Controller abstraction, just follow UE hardware abstracted documentation. This is the recommended method of using the plugin.
-Optional HydraControllerComponent used to receive 0.8 style hydra specific events and poll for additional data
-Hydra data now encapsulated as a HydraControllerData UStruct and emitted in the custom events
-Historical data removed, use a generalize structure instead
-C++ method should now access data in the same form as blueprints.
-4.14 update
-Input mapping keys renamed to fit closer to how Motion Controller keys are named.
-documentation update for new API

0.8.9
-Merged compile fixes for 4.12
-Updated binaries

0.8.8
-Changed to git flow, look for latest downloads under https://github.com/getnamo/hydra-ue4/releases
-Uses send controller event for late update only not tick
-added docs url and changed load order
-added world scaling support from vr-editor
-dependencies moved to saner locations

0.8.3
-Updated to 4.10
-Experimental branch merged into master

E0.8.2
-Added ButtonPressed and ButtonReleased events to HydraPluginComponent
-Cleaned up code a bit
-Added ability for the plugin to auto-hide your attached MeshComponents,
see readme for details.

E0.8.1
-Added HydraPluginComponent with Blueprint Assignable Multi-Cast
Delegates. Click the component and click + to add an event subscription
to the current blueprint
-Plugin components and their events are now multi-cast add them wherever
you want
-Added input mapping events for each controller dock/undock
-Fixed PIE crash, seems stable now
-Removed Binaries folder, just drag and drop Plugins. Packaging does
copy the require dll, but may not run.

E0.8.0
-Update to 4.9
-Adds support for UE 4.9 hardware agnostic Motion Controller interface,
both for Input Mapping and Left/Right hand 1:1 motion.
-This commit removes past compatibility, wait for stable release if you
wish to have both.

0.7.8
-Update to 4.8

0.7.7
-Update to 4.7
-Fixed a memory leak.

0.7.6
-HydraPlayerController will no longer cause a crash when used in project.

0.7.5
-contains all compile fixes and prebuilt binary for UE4.6

0.7.4
-Changed AnyButtonPressed event into ButtonPressed(enum
HydraControllerButton) and ButtonReleased(enum HydraControllerButton)
allowing for a single event to handle all buttons if desired.
-Reduced controller lag by 1 frame, this was introduced in 0.7 due to a
bug from blueprint controller class extension

0.7.3
-Minor code consistency fix
-Added white listing of only supported (windows) platforms

0.7.2
-fixed a crash caused by not having your interface set. This will not
longer cause your session to crash, but instead emit log and on-screen
errors.

0.7.1
-Synced folder layout with other plugins. To install you now need to copy both Binaries and Plugins
-Added support for 32bit shipping build, for either packaged or shipping build copy Binaries after packaging has been complete.

0.7
-Updated to UE4.5
-New Component based system using interfaces; now able to extend any
blueprint class to have a Hydra component and receive the HydraInterface
events! See readme or unreal thread for details.
-All events now emit a UHydraSingleController, allowing for easy probe
of additional data at the event state.
-Some compatibility may be broken, but old style C++ extension is still
possible using the old delegate (still retained). New style C++ plugin
extension leads to less code, see convenience actor for details.

0.6.5
-Fixed C++ input mapping, if you’re extending your own project class with the hydra delegate, make sure to copy HydraDelegate.cpp found in the plugin source into your project source; this will allow the project to compile for the editor. Remove when compiling for shipping to stop duplicate file error caused by compiler collapsing the dll into single exe.

0.6.4
-Updated to UE4.4

0.6.3
-Added shipping build convenience folder, package and copy the slimmed down Plugins folder to enable the plugin.
-See shipping post, github, or wiki for shipping instructions and troubleshooting.

0.6.2
-Added integrated angular velocity support, updated data, functions, and events to reflect
-C++ class extension needs less filler code, see HydraPluginActor/HydraPlayerController for examples of updated syntax.
-Moved core functionality from the delegate into the plugin
-Historical Data now a pointer to plugin data instead of holding own copy of data.
-Removed Slate dependency from Delegate
-Removed IHydraPlugin.h dependency from HydraDelegate sub-classes
-HydraPluginActor is now added to the input chain if its used by default, allowing it to receive input mapping events.
-Bug Fixes

Older Resources
-v0.7 Quick Setup and How to Use.
-Wiki - Currently Outdated, use github for documentation
-Plugin v0.5 video, still relevant regarding general setup, use with blueprint convenience actors, and C++ class extension.
https://youtube.com/watch?v=zRURG4Zp0Zo**

Wow, thanks for this! Sixense is planning STEM (and Hydra backward compatible) UE4 support, but not til post STEM launch. This’ll be great in the meantime to get started working on ideas.

Source

Edit: Looks like you’ve posted in that very thread. Congrats on figuring it out!

Wanted to make one more post to say I just had a chance to watch the tutorial - it was excellent! Thank you for the through explanation and the blueprint (and C++) examples.

Much appreciated.

Hey Getnamo,

I would like to say awesome work for figuring this out.

Cannot wait to get started working with this.

Thanks for making / posting this! nice work! glad we don’t have to wait for Sixense to implement something.

Other than the few crashes this works an absolute charm! Well done :smiley: I think we all owe you a beer!

A nice straight forward tutorial too.

I love it so far, the code is very neatly written and integrates with everything the proper way.

Plugin needs an update for 4.1 I guess :slight_smile: now it says it is not compatible.

I’ll have a look and recompile.

NB: You do have the full source to the plugin

Will look into the source / compiling it myself if only for educational purposes.

Thanks again for your work already.

Plugin Updated for 4.1 with small code consistency and comment changes and a new readme.
Download V0.5.1

If you want to recompile the earlier 0.5 in your project instead follow these guidelines from epic:

Fantastic work. Thank you so much. Is it possible to use the joysticks and buttons on the Hydra with the input and axis mappings in the engine?

I haven’t bound this myself but it should be doable using the guidelines outlined in https://www.unrealengine.com/blog/input-action-and-axis-mappings-in-ue4

Not 100% sure on the how part as of yet as the standard for custom input is not fully documented. This is why the plugin provides maximum flexibility as you can extend your own class to handle inputs and therefore place it where you feel it is most relevant for your project.

Really great work, very excited to see people integrating technologies like this in to UE4.

This was one of the things I was wondering about as well. If you’re interested in extending the plugin to implement the input system integration I’d be happy to help point you in the right directions.

One of the intentions of the way that FKey references inputs by FName is that adding new inputs in a plugin should be straightforward, however, it does not have a plugin based consumer of the API that I’m aware of yet.

The first step would be to call EKeys::AddKey for each of the new keys, probably as part of your module initialization. Then in your module you would need a tickable object, potentially using FTickableGameObject which pumps calls to FSlateApplication. Probably OnControllerAnalog, OnControllerButtonPressed/Released, and possibly OnMotionDetected, though I’m imagining there is some work that needs to be thought out about how to make the motion functions work with the two controllers.

Interesting, I’ll definitely ask you some questions on this after looking at it sometime later this week. The concept is clear, but its always the devil in the details. I remember looking at this earlier, but without success in finding direct examples (all native keys and gamepad binds seem to be buried in the engine).

This is pretty awesome! I just integrated Hydra support into a fresh template project and am happily moving around and rotating two gizmos with the hydras :slight_smile:

Would it be helpful to anyone if I released my HydraInputActor-derived blueprint that handles almost all the things?

One thing I’ve noticed, Hydras rotation and joystick structs seem to be not directly mapped to UE4’s… for example, Sixense’s Pitch is UE’s Yaw, Yaw is inverted Roll, and Roll is inverted Pitch. Though I’m not sure if this isn’t maybe because of the project template and perspective I was using.

In any case, great job on getting the Sixense stuff integrated! Plugin install was very simple and worked right away, so thanks for that! :slight_smile:

Quick question – this is really a fantastic contribution, it’s a shame that Sixense aren’t doing a bit more to support you with it.

I’m having a problem with it on OS X, I follow the steps in the tutorial (drag the plugin folder to the project folder), and when I click Enable on the list of installed plugins, after restart I get the following alert:

**Plugin ‘HydraPlugin’ failed to load because module ‘HydraPlugin’ could not be found. This plugin’s functionality will not be available, etc etc.
**

I see in the folder structure there’s a binaries folder for Win64. I’m sure I can’t just rename this, but is there a good way to get binaries for Mac or is that not the cause of the error?
Thanks, so much.

Fantastic. I just made support for the hydra in my game with you’r plugin, it works really well and no crashes for me yet hehe. only one question tho, how do i separate the controller so i get Vector2D info from one stick only and not both via blueprint?

Thank you very much for the plugin it’s a life saver when sixsense is be a little slow.

BallisticDK

The plugin currently only supports Windows. I haven’t tried integrating other platforms yet, this is something I wish I had the time to do properly, instead I used a direct DLL bind which is windows only api. The plugin does come with the full source, so if you feel like you can integrate it, go for it! (it’s probably only missing the sixense osx dylib which can be found in the latest SDK from sixense). Otherwise the best action would be to wait for the official plugin :(.

Each blueprint event emits an integer called ‘controller’. Simply add an IF statement and compare it to the controller you want (typically 0 for left, 1 for right) and any statements after that IF statement will only be for the controller you want. Additionally if you want to support people potentially misplacing their controllers, you can make a call to ‘HydraWhichHand(int32 controller)’ which will determine which hand the controller is being held in (returning 0 for left, 1 for right). This is determined by where the controller was last docked (which side of the dock it was).

Fantastic Thank you :smiley: