Creating Animated Hands for Your Unity VR Game


Welcome to the second episode of our VR game development series. In the previous episode, we set up Unity for VR and established a camera rig. Now, it’s time to make our virtual hands come to life. This tutorial is brought to you by Unity and the generous support of our Patreon community, where you can access project source code and exclusive content.

Chapter 1: Adding Animated Hands

In this chapter, we’ll replace the placeholder cube with fully animated hands using Oculus hand models. This will add a level of realism to your VR experience.

  1. Import Oculus Hand Models:
  • Download the Oculus hand models Unity package (find the link in the description).
  • Import the package into your Unity project. There are several ways of doing this:
    From the menu:
    go Assets -> Import Package…
    From context menu in the Project View enter context menu -> Import Package…
  1. Replace the Cube:
  • Delete the cube object you created in the previous episode.
  • Drag the Oculus hand models into your scene.
  • Place the left hand model under the “Left Hand” GameObject and the right hand model under the “Right Hand” GameObject in your hierarchy.
  1. Explore the Animator:
  • The hand models come with an animator component.
  • Open the Animator window by selecting one of the hand models and navigating to Windows > Animation > Animator.
  • The animator controls the hand animations based on the input we provide.

Chapter 2: Handling VR Input

To bring the hands to life, you need to handle VR input. This is how you read the state of controller buttons and trigger hand animations.

  1. Create a Custom Input Component:
  • Select one of the hand models.
  • Add a component and create a new script. Name it something like “AnimateHandOnInput.”
  1. Import Input System:
  • At the top of your script, add the Input System: using UnityEngine.InputSystem.
  1. Define Input Action:
  • Create a public input action property to reference the actions you want to listen to. For example, to handle pinch animation, define: public InputActionProperty pinchAnimationAction;
  1. Set Input Action in the Inspector:
  • Mark this property as public to set the action directly in the Unity Inspector.
  1. Read Input State:
  • In the Update function, retrieve the value of the input action. For instance: float pinchValue = pinchAnimationAction.action.ReadValue<float>();
  1. Use Input for Animation:
  • Utilize the pinchValue to trigger animations.
  • For example, set the value on an animator component: handAnimator.SetFloat("pinch", pinchValue);
  1. Repeat for the Other Hand:
  • Repeat the above steps for the other hand’s input, such as grip animations.

Chapter 3: Testing the Animated Hands

  1. Compile the Script:
  • Save the script and return to Unity.
  • Set the animator component in the Inspector for both hand models, linking them to the handAnimator parameter in your script.
  1. Test the Animation:
  • When you click Play, the hands will animate based on your controller inputs.
  • Try pressing the trigger and grip buttons to see the animations in action.


You’ve successfully added animated hands to your VR game, enhancing the immersive experience for players. In the next episode, we’ll delve into locomotion systems, covering teleportation and continuous movement. Don’t forget to like and subscribe to stay updated. If you wish to access source code and exclusive content, consider joining our Patreon community. Thank you for following along, and see you in the next tutorial!

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top