Summary
In this chapter, we explored a variety of software patterns for handling user input for your VR projects. The player uses a controller button to create, inflate, and release balloons into the scene. First, we tried the standard Input class for detecting logical button clicks, like the "Fire1" button, and then learned how to access device-specific SDK input, such as the OpenVR trigger button with haptic feedback.
In our scene, we implemented a simple input component for polling the button actions. Then, we refactored the code to use scriptable objects to hold the input action data. In the third implementation, we used Unity Events to message input actions to listening components. We also enhanced the scene to attach the balloon to your virtual hand position, and added the ability to pop the balloons as explosive projectiles! Lastly, we used an interactable framework (for SteamVR and Daydream) to implement grabbing and throwing mechanics, using components provided in given toolkits...