首页 > 解决方案 > 错误,相机锁定在移动轴上

问题描述

我希望你有一个美好的一天,碰巧在桌面模式下它工作得很好,但在移动设备上它只在一个轴上移动并且也没有检测到陀螺仪传感器,同样的事情发生在最新版本 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
                        })
                    }

标签: aframe

解决方案


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
                    })
                }

推荐阅读