- 1、本文档共32页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
Interaction in VR
Overview
In VR, we frequently need to activate an object that a user is looking at. For the VRSamples, we have built a simple, extendable, lightweight system allowing users to interact with objects. This consists of three main scripts: VREyeRaycaster, VRInput, and VRInteractiveItem - a short description of these classes is below. The source code is also commented.
VREyeRaycaster
This script needs to be placed on the Main Camera. Every Update() the script casts a ray forwards using? Physics.Raycast?to see if the ray hits any colliders. This can also exclude certain? layers?- depending on your scene, you may wish to move all interactive objects onto a separate layer for performance reasons.
If a collider has been hit by the raycast, this script attempts to find a?VRInteractiveItem?component on the GameObject:
VRInteractiveItem interactible = hit.collider.GetComponentVRInteractiveItem(); //attempt to get the VRInteractiveItem on the hit object
From this we can determine whether the user is looking at an object, or has stopped looking at an object. If the user has started or stopped looking at an object, we can do something with it, such as call a method.
VRInput
VRInput is a simple class that determines whether swipes, taps, or double-taps have occurred on the GearVR - or the equivalent controls setup for PC input when using a DK2.
You can subscribe to events on?VRInput?directly:
public event ActionSwipeDirection OnSwipe; // Called every frame passing in the swipe, including if there is no swipe.
public event Action OnClick; // Called when Fire1 is released and its not a double click.
public event Action OnDown; // Called when Fire1 is pressed.
public event Action OnUp; // Called when Fire1 is released.
public event Action OnDoubleClick; // Called when a double click is detected.
public event Action OnCancel;
您可能关注的文档
- GNSS定位测量 卫星导航定位系统组成 电子教材-地面监控部分.doc
- H3CSE Security认证(社会培训) 网络协议 IP路由.doc
- H3CSE(H3C构建安全优化的智能广域网) H3CSE(H3C构建安全优化的智能广域网) 390实习案例23.doc
- HCNA Security认证(社会培训)冗余资源 HCNA Security认证(社会培训)冗余资源 防火墙安全策略配置.docx
- Illustrator图形绘制 图表与符号的应用 第6章教案.doc
- IP网络技术 7.1 任务一:ACL技术配置及其应用 11、ACL访问控制列表(中兴设备).doc
- J2EE课程体系_前端&JavaWeb全套教材 第一节HTML Html作业1.docx
- Java程序设计(新) 学生实训任务单 学生实训任务单.doc
- JSP程序设计 JSP程序设计 学生信息管理系统项目图.docx
- K102 仪器分析技术 W5302气相色谱仪常见检测器分类及工作原理和应用 W5302气相色谱仪常见检测其分类及工作原理和应用-4-微教材.docx
- 素质教育背景下的艺术教育反思教学研究课题报告.docx
- 初中科学教育中的STEAM教育理念研究教学研究课题报告.docx
- 初中体育课程中学生合作能力的提升教学研究课题报告.docx
- 鼓励创新与实践对学生未来成才的作用研究教学研究课题报告.docx
- 教育评估体系与教学改革的互动研究教学研究课题报告.docx
- 高中地理课程与社会发展的结合研究教学研究课题报告.docx
- 总体课程改革与未来人才培养的对接教学研究课题报告.docx
- 利用信息技术提升课堂教学的有效性教学研究课题报告.docx
- 教学减负对学生全面发展的影响分析教学研究课题报告.docx
- 课程整合对学科知识理解的促进效果教学研究课题报告.docx
文档评论(0)