Unity VR Basics 2023 – Climbing

The last thing I want to cover in the Unity VR Basics, is climbing! In order to enhance our immersive experiences, we need to learn how to properly use the XR Interaction Toolkit’s climbing functionality. 

We used to have to implement our own climbing system, but now that Unity has added this into the XR Interaction Toolkit, we will be able to cruise on through and get it into our games quickly.

Climbing Prefabs

Let’s start by adding some of the prefabs provided by the XR Interaction Toolkit.

  • Assets -> XR Interaction Toolkit -> 2.x (your version) -> Starter Assets -> Prefabs -> Climb
    • Drag Climbing Wall into the Scene
    • Drag Ladder into the Scene

 

With these two in the Scene, let’s go over what makes them work and how we can climb them.

Climb Interactable

If we select the Ladder or Climbing wall and then select one of Handles (Climbable), we’ll see that it has a Climb Interactable. This Climb Interactable will give all the child objects below it the ability to be climbable, as long as they have a Collider of some kind. Let’s review some of the attributes of this component.

  • Interaction Manager – Will dictate how the interactable and the interactor will interact!
  • Interaction Layer Mask – Can be used to determine what Interactors will be able to interact with it.
  • Distance Calculation Mode – This will specify how distance is calculated to Interactors, from fastest to most accurate.
  •  Select Mode – Allows for either Single selection with swapping allowed or Multiple selection
  • Focus Mode –  Allow Single focus, Multiple focus or none to disallow focus.
  • Climb Configuration 
    • Climb Provider – Game component required to enable the Climb Interactable to work.
    • Climb Transform – Transform that defines the coordinate space for climb locomotion. Will use this Game Object’s Transform by default.
    • Filter Interaction By Distance – Controls whether to apply a distance check when validating hover and select interactions.
    • Climb Settings Override – Can be used to allow free movement around the X, Y and Z axis.
 

Something important to notice with the Ladder object, is with it’s Top Handles. These top handles have their very own Climb Interactable component attached to them. This is because they use the Climb Settings Override to allow for free movement on the Y and Z axis. It’s important to provide some form of climbable object like this if you intend players to make it to a different platform. Otherwise, your player may struggle to get their body above the higher platform and will just fall down.

Note: You may need to change the Climb Interactable’s Interaction Layer Mask to ‘Interactable’ and ‘Interactable Ignore Ray’ if you’ve been following the previous tutorials. (This is because our XR Direct Interactors are set to this Layer Mask)

Climb Provider

We need to add a Climb Provider in order to get all of our Climbable objects to work.

  • XR Origin -> Locomotion System 
    • Add Empty Game Object called ‘Climb Provider’ and Select it
      • Add Component ‘Climb Provider’
      • System = Locomotion System?

Shockingly, that’s all we need to do! Just start up the scene and you’ll be able to climb these objects.

1 thought on “Unity VR Basics 2023 – Climbing”

Comments are closed.