Hands-On Unity XR Interaction Toolkit : Unlocking Grab Movement

There are many ways to move in VR. Demeo is a successful table top VR game that decided to use one of the more unique forms of locomotion called Grab Movement. Let’s not waste anymore time and hop right in and learn how we can do it ourselves.

For this tutorial, I will be using my free VR Template provided here

  • Template explanation, description down below, but you can follow along in your own projects.
  • Duplicate blank scene, replace xr no locomotion with xr setup
  • Add some Scene elements
  • Show Grab Move provider, turn it off, create one from scratch
    • Grab Move Provider
      • System = Locomotion System
      • Gravity Application Mode = Attempting Move
      • Controller Transform = Left Controller
      • Reference = XRI LeftHand Locomotion/Grab Move
  •  

Setting Up the Scene (Skip if you're using your own project)

Let’s get our scene ready from the VR Template!

  • Assets -> Scene
    • Duplicate the Blank Scene and name it “Grab Move” then select it
  • In the Hierarchy, delete the XR Interaction Main Menu game object
  • Add a XR Interaction Setup game object to the Scene
  • Add a few Cubes to the Scene and scatter them around. These are just used as a point of reference to know when we are moving.
With that, our project should now be ready to play around with Grab Move

Grab Move Provider

The Grab Move Provider is incredibly easy to use. If you’re following along from the template project, you’ll see that after expanding the XR Interaction Setup and looking under the Locomotion System, we already have a Grab Move Provider in place! If you want to follow along, I’ll be explaining how to build a Grab Move Provider from scratch for those who are not following from the VR Template project.

If you’re not following from the VR Template project, do the following to add a Grab Move Provider.

  • Under Locomotion System add an empty game object and call it “Grab Move”
    •  Add component “Grab Move Provider”
      • System = Locomotion System
      • Enable Free X, Y, Z Movement = True
      • Use Gravity = True
      • Gravity Application Mode = Attempting Move
      • Controller Transform = Left Controller
      • Grab Move Action
        • Use Reference = True
        • XRI LeftHand Locomotion/Grab Move

Let’s go over some of the attributes

  • Enable Free X, Y, Z Movement – This determines if the player is allowed to move freely in the X, Y and Z direction.
  • Use Gravity – This will turn gravity on or off for the player.
  • Gravity Application Mode
    • Attempting Move – This will enable gravity as soon as the player tries to move. If you also have continuous movement active, then gravity would be applied after they move using the thumbstick.
    • Immediately – Gravity will be applied as soon as Grab Move has ended.
  • Controller Transform – This is the referenced game object used for translating movement when Grab Move is active.
  • Enable Move While Selecting – If the player is already grabbing and object, this will determine if they are still allowed to move using Grab Move.
  • Move Factor – The ratio of actual movement distance to controller movement distance.
  • Grab Move Action Reference – This is the reference to the input action that will be used for to activate the Grab Move Provider. In this example, it is the Grip button.
 If we were to boot up the scene now, we’d be able to use our Left Controller’s Grip to move around! Now that that’s working, let’s add the right hand.
  • Add component “Grab Move Provider”
    • System = Locomotion System
    • Enable Free X, Y, Z Movement = True
    • Use Gravity = True
    • Gravity Application Mode = Attempting Move
    • Controller Transform = Right Controller
    • Grab Move Action
      • Use Reference = True
      • XRI RightHand Locomotion/Grab Move
With both in place, we can now move on to the Two-Handed Grab Move Provider.

Two-Handed Grab Move provider

This component will allow us to both combine the left and right Grab Move Providers so we can use them to turn and scale our player.

  • Add Component “Two-Handed Grab Move Provider”
    • System = Locomotion System
    • Use Gravity = True
    • Left Grab Move Provider = Grab Move Provider (LeftHand)
    • Right Grab Move Provider = Grab Move Provider (RightHand)
    • Override Shared Settings On Init = True
    • Enable Rotation = True
    • Enable Scaling = False

 

Let’s cover some of the differing attributes found in this component.

 

  • Override Shared Settings On Init – This will override the  original settings for the Left and Right Grab Move Providers.
  • Require Two Hands For Translation – This will require both grab inputs to be active in order to use the Grab Move Providers.
  • Enable Rotation – This will allow us to rotate when both grip buttons are pressed.
  • Enable Scaling – This will allow us to scale ourselves up and down. This creates a zoom in effect just like in Demeo.

With that, we’re all set to use the Grab Move Provider! 

Conclusion

That’s it! 

If you want to add Scaling like in Demeo to zoom in and out, try turning off gravity and disabling the Character Controller on the XR Origin.

Beside that, I’ll see you in the next on! Cheers!

1 thought on “Hands-On Unity XR Interaction Toolkit : Unlocking Grab Movement”

Comments are closed.