5

我有一个 A-Frame WebVR 场景。我正在尝试将其放入 iframe 中。

<iframe src="https://aframe.io/aframe/examples/boilerplate/hello-world/"></iframe>

但是当我进入 VR 时,它并没有全屏渲染到 VR 耳机。如何在 iframe 中启用立体 VR?

4

2 回答 2

7

您必须allowvr="yes"在 iframe 上设置。如果你去https://aframe.io,你会看到所有的例子都是 iframe 的,所以你可以按照他们的例子。

<iframe allowvr="yes" src="https://aframe.io/aframe/examples/boilerplate/hello-world/"></iframe>

请注意,这不适用于移动智能手机,因为 iOS Safari 等移动浏览器不允许 iframe 访问设备方向和设备运动传感器。这可以通过将消息设备方向数据发布到 iframe 来解决。这是在https://github.com/googlevr/webvr-polyfill/issues/173提交的

于 2016-11-17T10:36:42.953 回答
1

一个页面上只能<a-scene>存在一个。或者,我们可以使用<iframe>withallowfullscreen="yes"allowvr="yes"

<iframe allowvr="yes" allowfullscreen="yes" src="https://aframe.io/aframe/examples/boilerplate/hello-world/"></iframe>
于 2019-05-14T19:28:44.903 回答