“The Animator’s Spellbook” — Enchanting Hand Animations in Unity VR

Richard Morgan
6 min readJan 6, 2024

Introduction

Welcome, VR alchemists and Unity sorcerers! You’re about to embark on a mystical journey to animate hands in the virtual realms using Unity’s XR Interaction Toolkit. It’s time to weave your magic and bring digital digits to life with a wave of your coding wand!

Scouting for Digital Hands

Finding the Perfect Hands: Venture into the mystical lands of Filebase and seek out the most charismatic hand models. Look for models that speak to you — they could be sleek and futuristic or rugged and battle-worn.

Importing with Style: Once you’ve acquired these digital treasures, unzip them like unraveling ancient scrolls and elegantly drag them into the realm of Unity. If they look a tad out-of-place, fear not! With a flick of your wand (or cursor), convert those materials to match the radiant glow of Unity’s Universal Render Pipeline.

Dressing the Hands for the Ball

Material Alchemy: Create a new material in Unity’s mystical forge. Infuse it with the essence of light blue and the transparency of a ghost. This concoction will transform your hand prefabs into ethereal appendages worthy of a VR deity.

Applying the Magic: Bestow this new material onto your hand prefabs. Watch as they metamorphose from mundane models into hands that shimmer with otherworldly grace.

The Dance of Bones

Hand Animation Ritual: Scour the depths of Filebase again for the most fluid and graceful hand animations. Once in your grasp, let them flow into Unity like a gentle stream.

Breathing Life: Understanding the skeleton dance is key. Both hands and animations have bone structures. When you apply the animation to your prefab, it’s like casting a spell that binds the bones to your will, making the hands move as if alive.

Syncing the Arcane Skeletons

Mystical Matching: The skeletons of your hand prefabs and animations must harmonize. If they’re discordant, employ the Underscore Replace tool from Filebase — it’s like a potion that aligns their mystical energies.

The Conductor of the Hand Orchestra

Creating the Animation Controller: In Unity’s enchanted library, right-click and conjure an Animation Controller. This artifact will be the conductor of your hand animations, orchestrating their every move.

Linking the Controller: Bind this newly forged Animation Controller to your hand prefab. It’s like attaching strings to a marionette, preparing it for the grand performance.

Choreographing the Hand Ballet

Setting the Stage: In the Animation Controller, create realms named Open and Closed. These are the stages where your hand animations will perform their ballet.

Animating with Elegance: Assign your hand animations to these realms. It’s like teaching dancers the steps for their debut performance.

The Grand Performance

Crafting Transitions: In the Animator’s mystical flowchart, connect these realms with enchanted transitions. Disable ‘Has Exit Time’ to prevent your animations from getting lost in an eternal dance.

Triggering the Magic: Summon triggers named Select and Deselect from the ancient tomes of XRI Default Input Actions. Apply these as conditions to your Animator transitions to control when the hands open and close.

Final Touches: Ensure the ‘Animate Model’ option is enkindled on your XR Rig controllers. This is the final incantation that brings it all together — the grand finale where your hands perform their mesmerizing dance.

Conclusion

And there you have it, noble creators of worlds — your VR characters now possess hands animated with the fluid grace of living beings! Your journey through the mystical arts of Unity animation is just beginning. Keep exploring, keep enchanting, and let your virtual worlds be filled with the magic of lifelike motion!

Addendum: No- Nonsense Step-by-Step Guide

1. Import Hand Models

  • Find Model in Filebase: Search for a suitable hand model in Filebase.
  • Download and Import: Download the model, unzip it, and drag and drop it into Unity.
  • Convert to URP: If using the Universal Render Pipeline (URP), convert the materials of the model to be compatible with URP.

2. Apply Hand Models

  • XR Rig Integration: Add the hand model prefab to the XR Interaction Toolkit’s XR Rig Left and Right Controllers.

3. Customizing Hand Appearance

  • Create New Material: Make a new material in Unity with a light blue, slightly transparent shader.
  • Apply Material: Assign this new material to your hand model prefab to achieve the traditional VR hand look.

4. Importing Hand Animation

  • Find Animation in Filebase: Search for hand animations (like default and fist positions).
  • Download and Import: Download these animations, unzip, and drag and drop the FBX files into Unity.

5. Understanding Hand Bone Structures

  • Prefab and Animation Bones: Hand prefabs come with a bone structure, as do hand animations.
  • Applying Animations: To see an animation applied to a prefab, select a motion in the asset preview and drag and drop the prefab into the preview.

6. Matching Skeleton Naming Conventions

  • Consistency is Key: Ensure the naming conventions of the prefab match the animation for compatibility.
  • Tool for Compatibility: Use the Underscore Replace tool from Filebase to make the model and animation work together.

7. Create Animation Controller

  • Creating Controller: Right-click in the prefab folder in Unity and create an Animation Controller.
  • Assign Controller: Drag and drop this Animation Controller onto the Prefab.

8. Create Animation States

  • State Setup: In the Animation Controller, create empty states named Open and Closed for the hand animations.

9. Associate Animations to States

  • Adding Motion: Drag and drop the respective animations into the Open and Closed states you just created.

10. Configure State Transitions

  • Animator Flowchart: Connect these states with transitions in the Animator window.
  • Looping Control: Disable ‘Has Exit Time’ in transition settings to prevent the animations from continuously looping.

11. Implementing Triggers

  • Create Triggers: Use the Select and Deselect triggers, which are pre-configured in the XRI Default Input Actions.
  • Apply Conditions: Set up these triggers as conditions in the Animator transitions.
  • Enable Animation: Check the ‘Animate Model’ option on the Left and Right Controllers of the XR Rig.
  • Integrate Triggers: Add the Select and Deselect triggers to the Model Select Transition and Model Deselect Transition of the XR Rig.

--

--