当前位置:   article > 正文

PICO 开发_pico开发

pico开发

一:开发环境搭建。

1:新建unity 3D工程。

2:官网下载SDK。

https://developer-global.pico-interactive.com/

官方推荐用第一个。Pico Unity Integration SDK。

文档:

https://developer-cn.pico-interactive.com/document/unity/chapter-overview/

3:unity导入下载的离线包。

4:模型下载。

sketchfab.com

需要翻墙,快一些。

5:到这一步直接运行,有摄像机画面,但不会随头部运动而动。

真机调试,选择此处。

到这一步直接运行,头部会跟随运动,无手柄显示,只有一根红线。

此两处点yes。 go ahead。

6:到这一步直接运行,手柄会动,但没预制体。

添加手柄跟随运动。

添加手柄预制体。

7:将XR Origin高度设置为0,符合人眼角度。

二:实时监控数据工具。

直接下载,然后拷贝进PICO监测。

(已有新得办法。)

三:实时预览工具。Pico和电脑端Unity同画面。

1:将安装包拷贝进Pico安装。

2:运行PC端预览工具。

(已有新得办法。)

四:更改手握激光棒颜色

五:传送。

1:地面添加Teleportation。

2:XR Origin添加Teleportation Provider和Locomotion System(添加后适应地形组件,不容易倒掉),并将自身添加进去。

3:将XR Origin赋值给地面的提供者。

4:默认为侧键传送。

六:更改传送确认键。

七:锚点传送。

一:新建地面。

二:添加锚点组件。

三:将头显加入组件。

四:更改传送描点位置。

1:在地面下添加正方体。

2:将正方体赋值给锚点位置。

正方体显示的话,可以将正方体隐藏。

八:左扳手方向键控制物体移动。

  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.XR; //引入XR命名空间
  5. public class ControlObject : MonoBehaviour
  6. {
  7. // Start is called before the first frame update
  8. void Start()
  9. {
  10. }
  11. // Update is called once per frame
  12. void Update()
  13. {
  14. //移动偏移量 定义二维向量。
  15. Vector2 vec2DAxis = Vector2.zero;
  16.         //获取左手柄的值,赋值给上面定义的变量。
  17. InputDevices.GetDeviceAtXRNode(XRNode.LeftHand).TryGetFeatureValue(CommonUsages.primary2DAxis,out vec2DAxis);
  18. transform.position = new Vector3(transform.position.x + vec2DAxis.x * Time.deltaTime, transform.position.y,transform.position.z + vec2DAxis.y * Time.deltaTime);
  19. }
  20. }

放在自身,则为自身移动。

九:物体加入动力学。

添加Rigidbody。

十:检测按键。

  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEditor.TextCore.Text;
  4. using UnityEngine;
  5. using UnityEngine.XR; //引入XR命名空间
  6. public class ControlObject : MonoBehaviour
  7. {
  8. // Start is called before the first frame update
  9. void Start()
  10. {
  11. }
  12. // Update is called once per frame
  13. void Update()
  14. {
  15. //移动偏移量
  16. Vector2 vec2DAxis = Vector2.zero;
  17. //不同按键
  18. bool isGrip = false; //握手按键(中指)
  19. bool isTrigger = false; //扳手按键(食指)
  20. bool isMenu = false; //菜单按键
  21. bool isPrimaryButton = false; //手柄主键
  22. bool isSecondaryButton = false; //手柄副键
  23. InputDevices.GetDeviceAtXRNode(XRNode.LeftHand).TryGetFeatureValue(CommonUsages.primary2DAxis,out vec2DAxis);
  24. transform.position = new Vector3(transform.position.x + vec2DAxis.x * Time.deltaTime, transform.position.y,transform.position.z + vec2DAxis.y * Time.deltaTime);
  25. InputDevices.GetDeviceAtXRNode(XRNode.RightHand).TryGetFeatureValue(CommonUsages.gripButton, out isGrip);
  26. if(isGrip)
  27. {
  28. this.gameObject.GetComponent<MeshRenderer>().material.color = Color.green;
  29. }
  30. InputDevices.GetDeviceAtXRNode(XRNode.RightHand).TryGetFeatureValue(CommonUsages.triggerButton, out isTrigger);
  31. if (isTrigger)
  32. {
  33. this.gameObject.GetComponent<MeshRenderer>().material.color = Color.red;
  34. }
  35. InputDevices.GetDeviceAtXRNode(XRNode.RightHand).TryGetFeatureValue(CommonUsages.menuButton, out isMenu);
  36. if (isMenu)
  37. {
  38. this.gameObject.GetComponent<MeshRenderer>().material.color = Color.yellow;
  39. }
  40. InputDevices.GetDeviceAtXRNode(XRNode.RightHand).TryGetFeatureValue(CommonUsages.primaryButton, out isPrimaryButton);
  41. if (isPrimaryButton)
  42. {
  43. this.gameObject.GetComponent<MeshRenderer>().material.color = Color.blue;
  44. }
  45. InputDevices.GetDeviceAtXRNode(XRNode.RightHand).TryGetFeatureValue(CommonUsages.secondaryButton, out isPrimaryButton);
  46. if (isSecondaryButton)
  47. {
  48. this.gameObject.GetComponent<MeshRenderer>().material.color = Color.white;
  49. }
  50. }
  51. }

十一:VR版UI界面

1:添加XR组件,UI Canvas。别的和UI一样。

2:添加组件后,要保证Width和Height足够大,而去缩小Scale。不然会糊。

**Pico UE开发打包。

1:

打包教程:

https://www.bilibili.com/video/BV1bg411p7mT/?vd_source=dd4795916fd6c08bb59ae5fea830857f

官网文档说明(5.0):https://docs.unrealengine.com/5.0/zh-CN/how-to-set-up-android-sdk-and-ndk-for-your-unreal-engine-development-environment/

**十一:PICO预览UE工程

1:安装SteamVR。

2:安装pico游戏串流助手

https://www.picoxr.com/cn/

pico端游戏串流助手是自带的。

3:pico端启动游戏串流助手,连接

4:UE安装steamVR插件,运行。

教程

一:【杨同学 PICO 应用开发】用 PICO 实现类似于贝壳找房的 “VR 看房” 功能;附带有详细的 Unity 操作步骤

1:链接

https://www.bilibili.com/video/BV1DG411c7Gg/?spm_id_from=333.788&vd_source=dd4795916fd6c08bb59ae5fea830857f

2:截图

二:PICO 4 实用VR开发指南 - 5分钟从零开始打造 VR 街景

1:链接

https://www.bilibili.com/video/BV1q3411f7hs/?spm_id_from=333.788&vd_source=dd4795916fd6c08bb59ae5fea830857f

2:截图

三:教程 元宇宙PicoNeo3开发初探

1:链接

https://learn.u3d.cn/tutorial/PicoNeo3-liu?chapterId=63562b25edca72001f21d00b#62f87d3ba77d45001f8e734c

2:截图

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:【wpsshop博客】
推荐阅读