【问题标题】:A-FRAME + mobile phone) how touch move up or down by finger gestureA-FRAME + 手机)如何通过手指手势触摸上下移动
【发布时间】:2017-11-17 19:03:44
【问题描述】:

我的产品在下面(请用手机查看)

https://pano-mixer360.com/viewer/sphere/11/43

在向左或向右移动的情况下, 通过手指手势触摸移动效果很好。

但是, 在向上或向下移动的情况下, 通过手指手势触摸移动不起作用!有问题。

我该怎么办?

使用

A-Frame0.5.0 Safari iOS 10

我的代码

<a-scene>
  <a-entity position="0 0 0">
    <a-entity>
      <a-entity camera="userHeight: 1.6" look-controls>
      <a-entity id="myCursor" cursor="fuse:true maxDistance:30; timeout:500;" scale="0.05 0.05 0.05" position="0 0 -1" geometry="primitive: ring" material="color: #00ff00; shader: flat; opacity:0.5">
        <a-animation begin="cursor-fusing" easing="ease-in" attribute="scale" fill="none" from="0.3 0.3 0.3" to="0.01 0.01 0.01"></a-animation>
      </a-entity>
    </a-entity>
  </a-entity>
  <a-sky src="test.jpeg" rotation="0 0 0"></a-sky>
</a-scene>

顺便说一句, 我试过克隆look-controls.js

https://github.com/aframevr/aframe/blob/master/src/components/look-controls.js

并将 #L173 行替换为

x: radToDeg(hmdEuler.x) + radToDeg(yawObject.rotation.x),

如同使用 yawObject。

但它现在正在工作。 因为触摸移动监听器(#L301-L313)没有设置rotaion.x!

也许, 我应该计算旋转。x

yawObject.rotation.x = ????

但我不明白如何计算。

请帮帮我

【问题讨论】:

    标签: aframe


    【解决方案1】:

    问题是关于pitchObject 而不是yawObject,将代码放入您克隆的look-controls.js 中的onTouchMove 函数中

    var deltaX = 2 * Math.PI * (evt.touches[0].pageY - this.touchStart.y) / canvas.clientHeight;
    this.pitchObject.rotation.x -= deltaX * 0.5;
    

    【讨论】:

      猜你喜欢
      • 2017-04-23
      • 2021-05-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多