当前位置:网站首页>Unity两种VR环境配置方法
Unity两种VR环境配置方法
2022-08-11 05:30:00 【黑白leo】
方法一、通过OpenXR、XRTK设定普通3D场景到VR场景
21版的VR template就是通过以下方式实现
①Source Files:
ProjectSetting → XR Plugin Management → OpenXR → Interaction Profiles
→ Choice Divices And Profile
②Interaction toolkit:
PackageManager → OpenXR Plugin + XR Plugin Management
+ XR Interaction Toolkit(导入Samples)
③Samples Folder(配置文件):添加到预设Preset
Defult Continuous Move/turn
Defult Left/right controller
Defult Snap turn
Defult Input Action
设置可在Preset Manager中查看
④Hierarchy面板中
右键XR基本组件:
XR Origin(Action-based)(相比Orgin多了手柄等) → 生成XR Interaction Manager
→ XR Interaction Manager下挂载Input Action Manager脚本,将XRI Default Input Action拖拽到脚本Element处
XR Origin内容
Offset → Main Camera + LeftHand Controller + RightHand Controller → 可以看到所有挂载在该控制器下的脚本以及它所有的Reference
移动方法:
LocalMotion System
瞬移:包含LocalMotion System、Teleportatation Provider、Snap Turn Provider脚本
连续移动:包含LocalMotion System、Continuous Move Provider、Continuous Turn Provider
需要注意在Continuous Move/Snap Privider中修改Left/Right Hand Move Action
移动区域:
Teleportation Area组件/Ground挂载Teleportation Area脚本
⑤交互
添加Grab Interactable脚本,自动添加刚体碰撞体,修改Righdbody为Continous Dynamic
将Grab Interactable脚本中的Smooth Rotation 和 Smooth Position 勾选
方法二、SteamVR 2.X
OpenVR是Valve开发的一套Sdk和Api,是一套VR/AR开放标准
SteamVR是基于Open Vr的虚拟现实体验方案,串联OpenVR底层驱动
接收用户输入,交由OpenVR处理,进行基本的VR环境设置(硬件设备、控制器配对等)
SteamVR Unity Plugin是基于SteamVR的开发工具
①Unity获取SteamVR Plugin导入
#SteamVR_UnitySettingsWindow脚本中SplashScreen的Show方法(119)改为false即可
②Input System核心是Action,SteamVR Plugin核心是Input System
SteamVR动作类型:Boolean、Single(类似Float)、Vector2、Vector3、Pose(位置,旋转)、Skeleton
Window → SteamVR input
③Interaction System中的Hand和Player 的使用
将预制体中的Player直接拖入面板
④Camera Rig 和 Player 区别
Camera Rig只包含相机,左右手控制器
Player包含SteamVRObject、FollowHead、InputModule、DebugUI、Snapturn
SteamVRObject中又包含碰撞体,左右手和相机
FollowHead是头部碰撞和声音输入
InputModuel是事件系统,交互方面的
边栏推荐
- Day 80
- Fourth Paradigm OpenMLDB optimization innovation paper was accepted by VLDB, the top international database association
- Tinker's self-introduction
- 黑马大事件项目
- 【无标题】
- Day 85
- JS advanced web page special effects (pink teacher notes)
- Minutes of OpenMLDB Meetup No.2
- js learning advanced (event senior pink teacher teaching notes)
- Day 68
猜你喜欢
【LeetCode-74】搜索二维矩阵
经纬度求距离
本地服务配置内网穿透实现微信公众号整合
OpenMLDB v0.5.0 released | Performance, cost, flexibility reach new heights
stack stack
swagger错误:WARN i.s.m.p.AbstractSerializableParameter - [getExample,421] - Illegal DefaultValue null
USB in NRZI to encode the data
父子节点数据格式不一致的树状列表实现
C-动态内存管理
nepctf Nyan Cat 彩虹猫
随机推荐
深度学习Matlab工具箱代码注释
星盟-pwn-babyheap
Thesis unscramble TransFG: A Transformer Architecture for Fine - grained Recognition
The official website of OpenMLDB is upgraded, and the mysterious contributor map will take you to advance quickly
【剑指offer系列】面试题日记(前期题)
C语言实现三子棋(代码详解)
Day 79
JS小技巧,让你编码效率杠杠的,快乐摸鱼
USB URB
Some formulas for system performance and concurrency
IndexError: index 9 is out of bounds for axis 0 with size 9;数组下标溢出问题
【LeetCode-147】对链表进行插入排序
OpenMLDB v0.5.0 released | Performance, cost, flexibility reach new heights
无效的修订:3.18.1-g262b901-dirty
Day 85
C语言实现扫雷游戏
C语言-7月21日-指针的深入
杀死进程-查看防火墙状态
mk file introduction
Wonderful linkage | OpenMLDB Pulsar Connector principle and practical operation