VR Dev – Part 7: Frustrating Flailing Arms

Posted: April 8, 2013 in Hydra support in UDK, VR Dev
Tags: , , ,

Hey VR Heads!

Work and volunteering took up a lot of my time this week, but I managed to make some meager progress with Hydra integration in UDK. I used examples from a couple of places:

Craig just keeps posting awesome things! I took the camera modes that he constructed from his latest release.

This post by Comicaztaway is a tutorial for getting the arm of a skeletal mesh to move with the mouse, Little Big Planet style.

After a lot of experimentation and frustration, I arrived at what you see in the video. Nowhere close to where I want to be, but its progress nonetheless. I will make a tutorial video outlining what I did in the near future. In the mean time, here is the quick-and-dirty tutorial:

  • Make a copy of, and then edit CH_AnimHuman_Tree. Add b_RightWeapon and b_LeftWeapon to the AnimTree. Create 2 new SkelControl_CCD_IKs named RightArmIK and LeftArmIK.
  • Make the edits that Comicaztaway sugests in his post, then close and save the package.
  • Add the following code to your Pawn.uc:

var SkelControl_CCD_IK RightArmIK;
var SkelControl_CCD_IK LeftArmIK;

simulated event PostInitAnimTree(SkeletalMeshComponent SkelComp)
RightArmIK = SkelControl_CCD_IK( mesh.FindSkelControl('RightArmIK') );
LeftArmIK = SkelControl_CCD_IK( mesh.FindSkelControl('LeftArmIK') );

Begin Object class=SkeletalMeshComponent Name=SkeletalMeshComponent0
End Object

  • Add the following code to your PlayerController.uc:

var vector RightArmLocation;
var vector LeftArmLocation;
var HydraGamePawn Utp;
var HydraGamePlayerInput Hgp;

// function for SkelControl movement.
function UpdateRotation(float DeltaTime)
Hgp = HydraGamePlayerInput(PlayerInput); // gives us access to the Hydra variables
Utp = HydraGamePawn(Pawn); // this simply gets our pawn so we can then point to our SkelControl

// assigns vector RightArmLocation to the position of the Right Hydra Wand.
RightArmLocation.Z = Pawn.Location.Z + Hgp.RightHandPosition.Z;
RightArmLocation.Y = Pawn.Location.Y - 200 - Hgp.RightHandPosition.Y;
RightArmLocation.X = Pawn.Location.X - 400 - Hgp.RightHandPosition.X;
Utp.RightArmIK.EffectorLocation = RightArmLocation;

// assigns vector LeftArmLocation to the position of the Left Hydra Wand.
LeftArmLocation.Z = Pawn.Location.Z + Hgp.LeftHandPosition.Z;
LeftArmLocation.Y = Pawn.Location.Y - 400 - Hgp.LeftHandPosition.Y;
LeftArmLocation.X = Pawn.Location.X - 400 - Hgp.LeftHandPosition.X;
Utp.LeftArmIK.EffectorLocation = LeftArmLocation;

// Optional log feed, so you can see the number values and decide how to tweak the assignments above.
`log("RightArmIK.EffectorLocation Value is :"$Utp.RightArmIK.EffectorLocation);


I have weird numbers in there to offset position based on how I have my Hydra situated on my desk. The base station is off to my right. This solution is brute force and is not at all flexible, but may serve as a jump-off point for someone out there.

I will post the full files to GitHub sometime tomorrow, for now I have to get some sleep.

Oh yeah, on other thing: my Rift is due to arrive tomorrow! Next week’s video will include impressions and direct feeds if I can swing it.



  1. Daryl Lee says:

    Great job on the arm movement. It’s a real tough cookie to get down. Look forward to the more in-depth tutorial on that if you get the chance, but even what you have here is great.

  2. James says:

    Hehehe, progressing quickly! Enjoying the updates, hope you get your kit as expected!

    The ideal solution would involve an inverse kinematics solver which incorporates constraints based on the physiology of the avatar (twists at wrists, bends at elbows), in finding a realistic-looking pose corresponding to the position and orientation of the Hydra controllers. I’m not sure it’s something even the best of us could belt out in a single weekly update though (and also wedging the solution to this general problem somehow into the UDK) πŸ˜‰

    Hopefully you arrive at something that is both simple and works well!

    PS The flailing arms were hilarious

    • Awesome, thanks for the encouragement! I am glad you enjoyed the flailing! πŸ˜€

      That ideal solution sounds complicated, but fantastic. I still have a long way to go before I am at that level!

  3. cTool says:

    Awesome ! Let us know when you upload it to git, it will be a great VR playground πŸ™‚ (for me, at least)

  4. Ganonmaster says:

    I’ve been struggling to get a similar system working. For some reason I couldn’t get the right values into the skeletal control and my character’s arms would spaz out. I hope you can share some of the code when you’ve refined the controls. πŸ™‚

  5. Homepage says:

    Very good article! We will be linking to this great post on our site.
    Keep up the good writing.

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s