Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-core/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/list/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Aframe Eror,移动设备中锁定在轴上的摄像头_Aframe - Fatal编程技术网

Aframe Eror,移动设备中锁定在轴上的摄像头

Aframe Eror,移动设备中锁定在轴上的摄像头,aframe,Aframe,我希望你有一个美好的一天,它发生在桌面模式下工作完美,但在移动设备上它只在一个轴上移动,也没有检测陀螺传感器,同样的事情发生在最新版本1.0.4中,它可以是什么,我如何解决它 我在检查,不仅发生在我身上,还有来自官方网站和其他人最近项目的所有例子 编辑:由于第一个答案,我找到了解决方案,如果其他人有相同的问题,请添加以下代码 AFRAME.components["look-controls"].Component.prototype.onTouchMove = functio

我希望你有一个美好的一天,它发生在桌面模式下工作完美,但在移动设备上它只在一个轴上移动,也没有检测陀螺传感器,同样的事情发生在最新版本1.0.4中,它可以是什么,我如何解决它

我在检查,不仅发生在我身上,还有来自官方网站和其他人最近项目的所有例子

编辑:由于第一个答案,我找到了解决方案,如果其他人有相同的问题,请添加以下代码

AFRAME.components["look-controls"].Component.prototype.onTouchMove = function (t) {
                    var PI_2 = Math.PI/2,
                    e,
                    o = this.el.sceneEl.canvas,
                    i = this.yawObject,
                    j = this.pitchObject;
                    this.touchStarted && this.data.touchEnabled && (e = 2 * Math.PI * (t.touches[0].pageX - this.touchStart.x) / o.clientWidth, f = 2 * Math.PI * (t.touches[0].pageY - this.touchStart.y) / o.clientHeight, j.rotation.x += .3 * f, i.rotation.y += .5 * e, j.rotation.x = Math.max(-PI_2, Math.min(PI_2, j.rotation.x)), this.touchStart = {
                            x: t.touches[0].pageX,
                            y: t.touches[0].pageY
                        })
                    }

它适用于我的像素3。确保您的浏览器处于移动模式,而不是桌面模式。仅限于y轴的触摸平移是一项设计决策,旨在保持虚拟地平线和真实地平线始终对齐。感谢您的帮助,这是我的问题,如何使视图与以前的版本一样自由?几年前我曾与一架飞机合作过,但我以前没有这样的飞机。
AFRAME.components["look-controls"].Component.prototype.onTouchMove = function (t) {
                var PI_2 = Math.PI/2,
                e,
                o = this.el.sceneEl.canvas,
                i = this.yawObject,
                j = this.pitchObject;
                this.touchStarted && this.data.touchEnabled && (e = 2 * Math.PI * (t.touches[0].pageX - this.touchStart.x) / o.clientWidth, f = 2 * Math.PI * (t.touches[0].pageY - this.touchStart.y) / o.clientHeight, j.rotation.x += .3 * f, i.rotation.y += .5 * e, j.rotation.x = Math.max(-PI_2, Math.min(PI_2, j.rotation.x)), this.touchStart = {
                        x: t.touches[0].pageX,
                        y: t.touches[0].pageY
                    })
                }