unity+高通vuforia开发增强现实(AR)教程(三) (勘误)

按照原作者的想法,是可以实现手机观察到播放封面,但没法点击播放。针对这个问题,我翻看了官方论坛,因为最新的unity包缺少了一个C#文件。把缺少的文件加上,可以实现播放,以下为详细说明:

The objective here is to show how to replicate the essence of the Vuforia-VideoPlayback sample scene using the Vuforia prefabs and the drag and drop approach of Unity:

  • Create a new Unity project
  • Import the Vuforia video playback unity package
  • Create a new scene
  • Drag the ARCamera prefab into the Unity scene
  • Under the DataSetLoadBehaviour in the Inspector tick “Load Data Set StonesAndChips”, and the 'Activate' checkbox below this
  • From '/Qualcomm AugmentedReality/Prefabs' drag the ImageTarget prefab into the scene
    • For the Image Target select “StonesAndChips” as the dataset and the Image Target should change to the Stones texture
  • From Vuforia Video Playback/Prefabs drag the Video prefab to be the child of the Image Target
    • In the Inspector under “Video Playback Behaviour (Script)” set the path to 'VuforiaSizzleReel_1.m4v'
  • Drag the TrackableEventHandler from Scripts to the Image Target (this plays the video)
  • Remove the DefaultTrackableEventHandler script from the Image Target as it is not needed.
  • Autoplay works already, however tapping the video does not yet work. In order to fix this, simply create a VideoPlaybackController script, fill it with the code below, and then attach this to the ARCamera.

       大概意思就是(我英语不好,懂意思就好= =#,英语好的还是读上文吧):

  • 创建一个新的Unity工程
  • 引入Vuforia video playback的unity包
  • 创建一个新的场景
  • 拖ARCamera进场景(ARCamera搜索下很好找到)
  • 点击场景中的ARCamera,右边Inspector栏目,DataSetLoadBehaviour(script)中“Load Data Set StonesAndChips”和 'Activate'都打上勾
  • 从'/Qualcomm AugmentedReality/Prefabs'目录中Image Target拖入场景,右边Data Set选择“StonesAndChips”
  • 从“Vuforia Video Playback/Prefabs”目录中Video拖入场景,右边“Video Playback Behaviour (Script)”中path栏输入'VuforiaSizzleReel_1.m4v'(测试是播放这个视频),或者也可以使用
    http://oneshot.qualcomm.com/webAR/content/strawberryfields_H264_AAC.mp4
    这个网络视频进行测试

  • 把TrackableEventHandler这个C#文件放到Image Target中,主要是用来播放视频的
  • 从Image Target中移除DefaultTrackableEventHandler这个文件的使用,因为这个文件根本不需要,移除的话其实把它的打勾去掉也可以
  • 自动播放要不要打
  • 1
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 6
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值