Oculus VR UI gaze interaction in Unity
According to the translation of the "UI gaze interaction in VR" to organize and complement, only the implementation steps.
Original link:
"UI gaze interaction in VR"
http://gad.qq.com/article/detail/7173433
Add-on package download address:
Oculussampleframework.unitypackage
https://developer.oculus.com/downloads/package/oculus-sample-framework-for-unity-5-project/ Pre-configuration
Import Oculus Plug-in package Oculussampleframework.unitypackage
If you are using Unity 5.1 or later, make sure that you check Virtual Re in the Rendering settings, Setting, Player:other, Project Settings, Edit . Ality supported. implementation Process
Replace camera Remove camera in scene add Ovr/prefabs/ovrcamerarig preset body to scene as camera to adjust to the right position
Change the input module select the EventSystem object in hierarchy to remove the Standaloneinputmodule component that handles regular mouse input add Ovrinspector/scripts/ovrinputmodule script Drag the Centreeyeanchor under the Ovrcamerarig object to the Raytransform attribute of the ovrinputmodule so that the rays are always emitted from the middle of the eyes The Joypadclickbutton and Gazeclickkey in Ovrinputmodule are used to set buttons for touch handles and operating UI on the keyboard, respectively.
Add a gaze pointer to add a ovrinspector/resources/prefabs/gazepointerring preset to the scene to indicate the position of the current gaze in addition to the Ovrgazepointer script, there is a script related to particle effects. If you do not need to delete the Centreeyeanchor under the Ovrcamerarig object, drag and drop it onto the Raytransform property of the Ovrgazepointer script so that the pointer follows the Ray
Set Canvas to set the render mode property of the canvas that requires gaze action to world Space to set the Eventcamera in the canvas to Centereyeanchor under Ovrcamerarig Removes the canvas-bound graphicraycaster component for monitoring mouse interaction with GUI elements add ovrinspector/scripts/ovrraycaster scripts for processing rays in the Ovrraycaster component, Set the blocking objects property to all so that the gaze behavior can lock other interactive objects in the scene
Change how the pointer moves
If you want to move the pointer through another input device, take this step and take the right-hand touch controller as an example. Select the EventSystem object to change the Raytransform property of the Ovrinputmodule to Righthandanchor under the Ovrcamerarig object so that the ray is emitted from the touch controller of the right hand Select the Gazepointerring object to change the Raytransform property of the Ovrgazepointer script to Righthandanchor under the Ovrcamerarig object, so that the pointer follows the Ray
Add a mouse under world coordinates
Do this if you need to provide the functionality of the mouse-action UI that exists with the gaze for the VR scene. To add a ovrinspector/resources/prefabs/canvaspointer preset as a child of a canvas object To add a ovrinspector/scripts/ovrmousepointer script to a Canvas object by setting the pointer property in the Ovrraycaster script of the canvas object to the newly added Canvaspointer object