unity知识点
@TOC
Rokid Unity OpenXR Plugin 是为Unity 开发者提供的在 YodaOS-Master 空间计算操作系统上开发空间计算应用的工具。它基于OpenXR 标准开发,帮助开发者在 YodaOS-Master 上进行空间构建、虚实交互、空间感知,并最终构建完整的空间应用。
博客将会介绍如何实现 用Unity引擎开发Rokid主机的射线交互操作。希望这篇博客对Unity的开发者有所帮助。 大家好,我是心疼你的一切,不定时更新Unity开发技巧,觉得有用记得一键三连哦。 欢迎点赞评论哦.下面就让我们进入正文吧 !
提示:以下是本篇文章正文内容,下面案例可供参考
[video(video-BHsvOSC7-1759242361776)(type-csdn)(url-https://live.csdn.net/v/embed/495124)(image-https://v-blog.csdnimg.cn/asset/8ac2265345d990b82b8a9f15f23007aa/cover/Cover0.jpg)(title-Rokid模型操作)]
配置的话跟着官网配置就好了,就不过多赘述了。 开发环境搭建文档SDK导入
导入示例demo步骤: 第一步先打开:Package Manager 第二步:选择Rokid UXR SDK 在选择Sampies 点击Install就可以了
第三步:如下图找到示例demo学习即可
里面一共20几个Demo
代码:
using System.Collections; using System.Collections.Generic; using UnityEngine; using Battlehub.RTHandles; public class ModelData : MonoBehaviour { public Transform carPrefab; private Transform cartemporary; //临时的 public PositionHandle positionHandle; public RotationHandle rotationHandle; public ScaleHandle scaleHandle; // Start is called before the first frame update void Start() { } /// <summary> /// 生成模型 /// </summary> public void CreateModel() { if (cartemporary==null) { Transform transfo = Instantiate(carPrefab); cartemporary = transfo; } } /// <summary> /// 移动模型 /// </summary> public void PosModel() { CloseJH(); if (cartemporary != null) { cartemporary.GetComponent<PositionHandle>().enabled = true; } } /// <summary> /// 旋转模型 /// </summary> public void RotModel() { CloseJH(); if (cartemporary != null) { cartemporary.GetComponent<RotationHandle>().enabled = true; } } /// <summary> /// 缩放模型 /// </summary> public void ScaModel() { CloseJH(); if (cartemporary != null) { cartemporary.GetComponent<ScaleHandle>().enabled = true; } } /// <summary> /// 删除模型 /// </summary> public void DesModel() { if (cartemporary != null) { Destroy(cartemporary.gameObject); } } void CloseJH() { if (cartemporary != null) { cartemporary.GetComponent<PositionHandle>().enabled = false; cartemporary.GetComponent<RotationHandle>().enabled = false; cartemporary.GetComponent<ScaleHandle>().enabled = false; } } // Update is called once per frame void Update() { } }
如果想要更深,更复杂的场景,需要结合其他的Demo学习,就能编辑更多功能的应用
Rokid是一家专注于人机交互技术的产品平台公司,深耕5G+AI+AR领域的软硬件产品开发,为不同垂直领域的客户提供全栈式解决方案,打造智能时代的超级工人,有效提升用户体验、助力增效。 本次总结的就是使用Unity引擎开发Rokid主机的射线交互操作实现, 有需要会继续增加功能 如能帮助到你,就帮忙点个赞吧,三连更好哦,谢谢 你的点赞就是对博主的支持,有问题记得留言评论哦! 不定时更新Unity开发技巧,觉得有用记得一键三连哦。么么哒!
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。