Polling for clicks
The simplest way to obtain user input is just get the current data from an input component. We've already seen this using the Input class and VR SDK. Presently, we will write our own input component that maps the Unity (or SDK) input to our own simple API in MyInputController
. Then, we'll write a BalloonController
that polls the input, as illustrated:
Our own button interface functions
You may recall that the MeMyselfEye
player rig may have device-specific toolkit child objects for a particular VR SDK. The version for OpenVR, for example, has their [CameraRig]
prefab. The version for Daydream has the DaydreamPlayer
prefab. It makes sense to add our MyInputController
component to MeMyselfEye
, as it may make device-specific SDK calls. In this way, should you want to maintain camera rig prefabs for a variety of platforms, and swap them in and out as you build the project for a different VR target, the API that is exposed to the rest of your application will be consistent and...