Quick and Dirty Razer Hydra Support in UE4 Blueprint

Edit: To use the calibration feature, stand in a t-pose (arms at shoulder level extended to either side) and press the calibration button (start by default).

It doesn’t matter what pose your character is in during calibration as long as they are generally standing.

Many thanks to Getnamo for his Razer Hydra (info and download) plugin and excellent help figuring out how to set this up (more detail about calculations). I was definitely overcomplicating things.

Copy the Hydra Plugin into your project dir and enable it in the Plugins menus, restart.

Make a new BP derived from HydraPlayerController. I called mine DHydraPlayerController, D being for Dungeon (Survival).

Go to World Settings and set the game mode override settings to use your HydraPlayerController BP you just made.

GameMode Override settings for Hydra player controller.

GameMode Override settings for Hydra player controller.

Event graph for Hydra player controller.

This is in the Hydra player controller. Notice the variables there and the function Calibrate Hydra (I use start, easy to find on the controller). The base offset one is just a static 40 in Z, it doesn’t change. I could use a float but I plan on doing a more thorough calibration step in the future to get more exact mappings, so I’m leaving it as a vector for now. The midpoint we calculate.

Event graph for Hydra player controller.

Event graph for Hydra player controller.

Next comes the Calibrate function, also in the controller:

Calibrate function in Hydra player controller.

Calibrate function in Hydra player controller.

Next we’re going into the character’s animation blueprint

Open your character's animation Blueprint.

Open your character’s animation Blueprint.

First, add these variables

Character anim Blueprint variables.

Character anim Blueprint variables.

Then create this (looks messy but is simple). Pull off the character node to get the controller.

Set positions in the animation Blueprint event graph. Pull from the character node to get the Controller.

Set positions in the animation Blueprint event graph. Pull from the character node to get the Controller.

The last step is to set up something like this in the AnimGraph. Ignore the wiring that goes off screen, it’s just doing a static rotation to fix the default hands for my particular character.

Set up the hand IK using the animation blueprint variables from before.

Set up the hand IK using the animation blueprint variables from before.

I’m using component space for the IK target positions.

I’ll be porting this in a more polished state into the VR Game Templates by Mitch (of Team Metatron).

8 thoughts on “Quick and Dirty Razer Hydra Support in UE4 Blueprint

  1. Great stuff! I have it kind of working except for 2 issues:

    My hands are rotating
    They don’t move in the z axis at all

    Any ideas what I might be doing wrong? Thanks!

    Like

    • The hands *are* rotating? It’s supposed to have them rotate.

      As for the Z-axis, most likely the axes for the positions need to be swapped around somehow. Try moving the Hydra in each direction and seeing if any of them are doing movement wrong on the hand (e.g., you move controller in Z and it moves in Y or something).

      I suggest posting to the thread here as there’re already debugging discussions going on, so it should be easier to help you out there: https://forums.unrealengine.com/showthread.php?3505-Razer-Hydra-Plugin

      I’m still in the process of cleaning things in my implementation up, but once I do I’ll be posting an updated tutorial that goes more in depth.

      Like

      • Sorry, I meant to say they “aren’t” rotating. I tried swapping the axis but my hands never move in the Z axis. I think it has something to do with my IK setup because my arms stay stiff. Can’t find any good UE4 tutorials on IK.

        Thanks though! I’ll check on that forum

        Like

      • So if they are staying stiff, I suspect the positions might be scaled too high – try multiplying the final position by 0.5 before putting it into the IK node. Also if you’re using Two-Bone IK, make sure to set the joint target (which should be about where the elbows are).

        Like

  2. Hello! I just wanted to say thanks for posting this even though I’ve already seen all of your screenshots on Getnamo’s thread. They’ve been a huge help to me. By the way, nice to meet you! I’m aialexander if you hadn’t already guessed as much! It’s good to be aquainted with you on WordPress!

    Like

    • Thanks for commenting 🙂

      I’ve got the basics of a tutorial and template ready, though it still needs some tweaks and refinement before it’ll be properly ready. It’s quite a bit better than the hacky screenshots I took before, though fundamentally not much different. I’m glad you’ve found it useful.

      BTW a useful alternate calibration method is to get the position of a single controller (hold the hydra up to middle of the collar bones) and simply not divide by 2, just do the * -1. I find it gives more accurate results. Ultimately calibration is all about getting the mid shoulder point.

      Liked by 1 person

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s