Unity3D虚拟现实交互制作(拓展) 第九章 环境设置与交互 3.Interaction in VR.docx

Unity3D虚拟现实交互制作(拓展) 第九章 环境设置与交互 3.Interaction in VR.docx

  1. 1、本文档共32页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 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;

您可能关注的文档

文档评论(0)

WanDocx + 关注
实名认证
内容提供者

大部分文档都有全套资料,如需打包优惠下载,请留言联系。 所有资料均来源于互联网公开下载资源,如有侵权,请联系管理员及时删除。

1亿VIP精品文档

相关文档