赞
踩
https://developer-global.pico-interactive.com/
官方推荐用第一个。Pico Unity Integration SDK。
文档:
https://developer-cn.pico-interactive.com/document/unity/chapter-overview/
需要翻墙,快一些。
真机调试,选择此处。
到这一步直接运行,头部会跟随运动,无手柄显示,只有一根红线。
此两处点yes。 go ahead。
添加手柄跟随运动。
添加手柄预制体。
直接下载,然后拷贝进PICO监测。
(已有新得办法。)
1:将安装包拷贝进Pico安装。
2:运行PC端预览工具。
(已有新得办法。)
一:新建地面。
二:添加锚点组件。
三:将头显加入组件。
四:更改传送描点位置。
1:在地面下添加正方体。
2:将正方体赋值给锚点位置。
正方体显示的话,可以将正方体隐藏。
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.XR; //引入XR命名空间 public class ControlObject : MonoBehaviour { // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { //移动偏移量 定义二维向量。 Vector2 vec2DAxis = Vector2.zero; //获取左手柄的值,赋值给上面定义的变量。 InputDevices.GetDeviceAtXRNode(XRNode.LeftHand).TryGetFeatureValue(CommonUsages.primary2DAxis,out vec2DAxis); transform.position = new Vector3(transform.position.x + vec2DAxis.x * Time.deltaTime, transform.position.y,transform.position.z + vec2DAxis.y * Time.deltaTime); } }
放在自身,则为自身移动。
添加Rigidbody。
using System.Collections; using System.Collections.Generic; using UnityEditor.TextCore.Text; using UnityEngine; using UnityEngine.XR; //引入XR命名空间 public class ControlObject : MonoBehaviour { // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { //移动偏移量 Vector2 vec2DAxis = Vector2.zero; //不同按键 bool isGrip = false; //握手按键(中指) bool isTrigger = false; //扳手按键(食指) bool isMenu = false; //菜单按键 bool isPrimaryButton = false; //手柄主键 bool isSecondaryButton = false; //手柄副键 InputDevices.GetDeviceAtXRNode(XRNode.LeftHand).TryGetFeatureValue(CommonUsages.primary2DAxis,out vec2DAxis); transform.position = new Vector3(transform.position.x + vec2DAxis.x * Time.deltaTime, transform.position.y,transform.position.z + vec2DAxis.y * Time.deltaTime); InputDevices.GetDeviceAtXRNode(XRNode.RightHand).TryGetFeatureValue(CommonUsages.gripButton, out isGrip); if(isGrip) { this.gameObject.GetComponent<MeshRenderer>().material.color = Color.green; } InputDevices.GetDeviceAtXRNode(XRNode.RightHand).TryGetFeatureValue(CommonUsages.triggerButton, out isTrigger); if (isTrigger) { this.gameObject.GetComponent<MeshRenderer>().material.color = Color.red; } InputDevices.GetDeviceAtXRNode(XRNode.RightHand).TryGetFeatureValue(CommonUsages.menuButton, out isMenu); if (isMenu) { this.gameObject.GetComponent<MeshRenderer>().material.color = Color.yellow; } InputDevices.GetDeviceAtXRNode(XRNode.RightHand).TryGetFeatureValue(CommonUsages.primaryButton, out isPrimaryButton); if (isPrimaryButton) { this.gameObject.GetComponent<MeshRenderer>().material.color = Color.blue; } InputDevices.GetDeviceAtXRNode(XRNode.RightHand).TryGetFeatureValue(CommonUsages.secondaryButton, out isPrimaryButton); if (isSecondaryButton) { this.gameObject.GetComponent<MeshRenderer>().material.color = Color.white; } } }
1:添加XR组件,UI Canvas。别的和UI一样。
2:添加组件后,要保证Width和Height足够大,而去缩小Scale。不然会糊。
打包教程:
https://www.bilibili.com/video/BV1bg411p7mT/?vd_source=dd4795916fd6c08bb59ae5fea830857f
1:安装SteamVR。
2:安装pico游戏串流助手
pico端游戏串流助手是自带的。
3:pico端启动游戏串流助手,连接
4:UE安装steamVR插件,运行。
1:链接
2:截图
1:链接
2:截图
1:链接
2:截图
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。