制作属于自己的虚拟现实3D射击游戏
在最新一期的Wireframe杂志,Mark Vanstone向您展示如何将3D射击游戏转换为适用于多种查看器的VR游戏,从Google Cardboard到游戏头戴设备。

浏览器开发最近确实已经成熟了很多,有一个数字
令人兴奋的新功能层出不穷。在WebGL得到良好支持的地方,新的WebXR(之前的WebVR)现在正在成为标准。
in modern browsers. JavaScript ES5 has now been superseded by ES6, and with these new technologies, making browser-based apps – and specifically 3D games – is now a serious proposition. The other part of VR technology, the hardware, has also evolved – as mobile tech has become more powerful, so have the opportunities for cost-effective VR experiences.

如果你有一部旧手机,也许是 Make your own virtual reality 3D Shooter B iPhone 6 或者 Samsung S7,你可以花 £6 买一个 Google Cardboard 头显,把它变成一个基础的 VR 观看器。在本文中,我们将向你展示如何设置一个 3D 射击游戏,使其不仅可以在该硬件上运行,还可以在其他观看器(如 Gear VR 或 Daydream)甚至游戏头显(如 Oculus、HTC 或 Valve)上运行。所有这些设备都内置了可以支持 WebXR 或 3D 显示的网络浏览器,尽管它们的工作方式有一些差异,但在所有设备上显示 3D 场景的过程大致相同,因此我们可以使用 Three.js JavaScript 库。

首先,我们将从我们在《Wireframe》第32期制作的Three.js 3D射击游戏开始——如果你错过了那期,你可以下载一份副本. We’ll use the same models and much of the same code. The first change, though, is to update the code to run as an ES6 module. The non-module version of Three.js is being phased out at the end of 2020, so it’s probably best to get with the times and use the new stuff. As with our earlier shooter, you’ll need to run this code from a secure web server, which, for mobile phones and gaming headsets, will mean uploading it to somewhere suitable, but if you want to see it running, you can play it at technovisual.co.uk/vr.
基本的VR查看器
Now we need to consider the hardware we’re going to use to run our game. Let’s start at our baseline, Google Cardboard, and work up from there. Available from many outlets online (including 谷歌商店),这是一个挖空的套件,你可以将其折叠起来制成一个查看器。

在一个游戏耳机环境的浏览器窗口中,你可以启动一个Three.js VR体验。
有两个可供观看的镜片,侧面凹槽中有两个磁铁,还有用于固定手机的魔术贴。 侧面的磁铁用作选择机制,我们将在后面详细介绍。
Next, we have Gear VR-style viewers. There are many different types, priced from around £12 to £40, and these are essentially a better-built plastic version of the Cardboard but with a button on top to act as a selector. Phones of varying sizes can be used, and as long as the device isn’t more than about four years old, it should be up-to-date enough to run the 3D software.

For example, the six-year-old Samsung S5 is capable of displaying VR, but it’s a bit too slow to make the experience pleasant, whereas a five-year-old iPhone 6 is quite capable of displaying simple VR scenes smoothly. (With
iPhone 用户可能需要在 Safari 设置中启用实验性功能(Experimental Features),不过。)
Proper pro kit
游戏耳机有点不同,因为它们在耳机中有内置屏幕,并且在Oculus Go和Quest的情况下,其中还包含一个Android计算机。 有线耳机使用连接的计算机来生成显示 power,而且它们都 slightly 使用略有不同的方式。[number]
从更便宜的查看器生成三维显示的Three.js系统。[number]
随着时间的推移,很可能将有更多兼容的手机
独立游戏耳机使用的VR软件。游戏耳机还具有跟踪你运动和耳机倾斜角度的传感器,提供六个自由度。
Get the rest of the tutorial in Wireframe #44

这只是包含在《Wireframe》杂志最新一期中的综合性指南的一部分。如果你不是订阅者,你可以免费下载PDF副本从Wireframe杂志网站。从第50页开始,逐步创建你自己的VR射击游戏。
And if you want to take advantage of Wireframe magazine’s latest subscription deal, you can get it for just £10 at the 官方Raspberry Pi Press在线商店.
1条评论
下载apk
虚拟现实眼镜是100年后的发明
评论已关闭