aframe - 错误,相机锁定在移动轴上
问题描述
我希望你有一个美好的一天,碰巧在桌面模式下它工作得很好,但在移动设备上它只在一个轴上移动并且也没有检测到陀螺仪传感器,同样的事情发生在最新版本 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.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
})
}
推荐阅读
- flutter - 如何在行数据颤动中设置对齐方式?
- c# - 如何修复:“无法将类型隐式转换为‘字符串’”错误
- django - 禁止进入以继续 Django 调查中的下一个问题
- c# - 将自定义令牌 RequestValidator 添加到 ASP.NET(不是核心)
- python - 如何处理/确保 Google 服务帐户连接始终稳定
- python - 在字符串中添加数字并在python中乘以2
- macos - 如何调试无法在 macOS 10.14.6 上启动的应用程序
- php - PHP 警告:参数必须是使用 xampp 实现 Countable 的数组或对象
- javascript - 如何在不减少原始数字的情况下将 1 添加到 JavaScript 变量?
- laravel-envoy - Laravel Envoy 错误:参数太多,预期参数“命令”