The previous article talked about the movement of Pico neo3 in Unity. Today, I will explain how Pico neo3 interacts with UI pages in Unity3D. Many people think that using Pico devices for engine development is too troublesome, and they are not familiar with Pico API usage. , I don't know much about the interactive events of the UI page.
1. First import Pico SDK into Unity, you can refer to my previous article Pico SDK import
2. Delete the Camera camera that comes with Unity, find the Pvr_UnitySDK subfolder Prefabs, and drag the Pvr_UnitySDK prefab under the Prefabs folder into the scene, then the camera is ready, as shown in the figure below
Event is the event, Head is the head, and EyeMask refers to the eyes of the Pico device. Add the script Pvr_Input Module script to the Event, and set the Pico button for Unity events and UI interaction events. The system defaults to the TouchPad button (that is, the rounded rocker) , choose this according to your usage habits
3. Find the Scenes folder under the Pvr_Controller folder, open the Pvr_Controller_Demo scene in the Scenes folder, find the sub-object HeadControl of Pvr_UnitySDK, put it in the Assets directory, and then return to the previous scene, the steps are shown in the figure below
4. Put HeadControl into Pvr_UnitySDK to make it a sub-object, at the same level as Head. Find the ControllerManager prefab under the Pvr_Controller folder and put it into the scene to become a sub-object of Pvr_UnitySDK, which is at the same level as Head and HeadControl in Pvr_UnitySDK. ,As shown below
5. Add the script Pvr_Controller Demo for ControllerManager, this script comes with PicoSDK, just add it directly
Enable the sub-object dot, ray_alpha, ray_LengthAdaptive of the sub-object PvrController0 of ControllerManager
Enable the sub-object dot, ray_alpha, ray_LengthAdaptive of the sub-object PvrController1 of ControllerManager
Check the Length Adaptive Ray on the ControllerManager component, and the specific operation steps are shown in the figure below
6. Create a Canvas, set the Render Mode property of the Canvas to World Space, drag the Head of the Pvr_UnitySDK sub-object into the Event Camera of the Canvas, and add the script Pvr_UI Canvas(Script) to the Canvas. This script is provided by PicoSDK and can be added directly Yes, the steps are shown in the figure below
7. Set the Scale of the Canvas to a ratio of 0.05 0.05 1, and create a Button component on the Canvas for testing. The test results are as follows
The Pico device can interact with the UI interface of Unity
PicoSDK imported UI page interaction
At this point, the Pico device can normally interact with Unity on the UI page
In the next article, I will share with you the API usage of PicoSDK, so as to complete the interactive operation of Pico handle event type
If you have any questions, you can add me to chat with WeChat at yf1553653788