Many VR games include the ability to climb a wall or ladder; that is, locomotion in a vertical direction. In this section, we will implement a wall-climbing exercise using a hand-over-hand grab-and-pull mechanic. Given a climbing wall, the player can reach up and grab a hold, then pull themself up, reach with the other hand to grab another hold, and so on. But if you let go with both hands, you'll fall! For this, we're going the use the XRI Toolkit's Interactor and Interactable components. We'll build a wall with a series of GrabHold prefabs. Then, we'll write two scripts. A GrabPull script notifies the ClimbController when the player has grabbed or released a hold. The ClimbController moves the XR Rig, and it detects when the player has completely let go, causing them to fall.
Begin with a basic scene such as the one defined at the top of this chapter, as follows:
- Open the scene by clicking File | Open Scene...