当前位置:网站首页>Interaction of Pico neo3 in Unity

Interaction of Pico neo3 in Unity

2022-08-11 07:52:00 is a small A

The last 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, not very understanding of the interaction events of the UI page.

1. First import the Pico SDK into Unity, you can refer to my previous article Import of Pico SDK

2. Delete the Camera that comes with Unity, find the Pvr_UnitySDK subfolder Prefabs, drag the Pvr_UnitySDK prefab under the Prefabs folder into the scene, and the camera is ready, as shown below

Event is the event, Head is the head, EyeMask refers to the eyes of the Pico device, add the script Pvr_Input Module script to the Event, and set the Pico button of the Unity event and UI interaction event. The system defaults to the TouchPad button (that is, the rounded corners).Joystick), this is selected according to your own habits

3. Find the Scenes folder under the Pvr_Controller folder, open the Pvr_Controller_Demo scene in the Scenes folder, find the HeadControl sub-object of the Pvr_UnitySDK, put it in the Assets directory, and then return to the previous scene, the steps are as shown below

4. Put the HeadControl into the Pvr_UnitySDK to make it a child object, the same level as the Head, find the ControllerManager prefab in the Pvr_Controller folder and put it into the scene to become a child object of the Pvr_UnitySDK, which is the same as the Head and the Head in the Pvr_UnitySDK.HeadControl is at the same level, as shown below

5. Add the script Pvr_Controller Demo for ControllerManager, this script comes with PicoSDK, you can add it directly

Enable dot, ray_alpha, ray_LengthAdaptive of the child object of ControllerManager's child object PvrController0

Enable dot, ray_alpha, ray_LengthAdaptive of the child object of ControllerManager's child object PvrController1

Check the Length Adaptive Ray on the ControllerManager component, the specific operation steps are shown in the following figure

6. Create a Canvas, set the Render Mode property of Canvas to World Space, drag the sub-object Head of Pvr_UnitySDK into the Event Camera of Canvas, and add the script Pvr_UI Canvas(Script) to Canvas, this script is provided by PicoSDK,You can add it directly, the steps are as shown below

7. Set the Scale of Canvas to a ratio of 0.05 0.05 1, and create a Button component on Canvas for testing. The test results are as follows

Pico devices can interact with Unity's UI interface

Interaction of UI pages imported by PicoSDK

At this point, the Pico device can interact with Unity on the UI page normally

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

原网站

版权声明
本文为[is a small A]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/223/202208110644323331.html