aframe icon indicating copy to clipboard operation
aframe copied to clipboard

Look controls only working horizontally on touchscreen

Open a0m0rajab opened this issue 3 years ago • 4 comments

Description:

  • A-Frame Version: 1.2.0
  • Platform / Device: Android (honor 8x)
  • Reproducible Code Snippet or URL:

The look controls only working horizontally on touch screen, is this a feature or a bug?

a0m0rajab avatar Nov 10 '21 09:11 a0m0rajab

Here is the related code: https://github.com/aframevr/aframe/blob/dbe90665c8b5936818cc0157285217015f02009e/src/components/look-controls.js#L351

a0m0rajab avatar Nov 10 '21 09:11 a0m0rajab

Thanks. this is a design decision https://github.com/aframevr/aframe/issues/4190

dmarcos avatar Nov 11 '21 21:11 dmarcos

That's totally understandable,

What about putting a flag to activate the rotation? so that we can let the user decide if they would activate it or not! if you like that, I would edit the PR for this.

there is good example for this issue btw, which is used at 3Dvista https://www.kadirgasanat.com/sanaltur/ethem/

it's less sensitive to the gyroscope movements and always centralize the camera for the view.

a0m0rajab avatar Nov 12 '21 14:11 a0m0rajab

Stolen from stack overflow:

      AFRAME.components["look-controls"].Component.prototype.onTouchMove = function (t) {
        console.log('on touch move event!')
          if (this.touchStarted && this.data.touchEnabled) {
              this.pitchObject.rotation.x += .6 * Math.PI * (t.touches[0].pageY - this.touchStart.y) / this.el.sceneEl.canvas.clientHeight;
              this.yawObject.rotation.y += /*  */ Math.PI * (t.touches[0].pageX - this.touchStart.x) / this.el.sceneEl.canvas.clientWidth;
              this.pitchObject.rotation.x = Math.max(Math.PI / -2, Math.min(Math.PI / 2, this.pitchObject.rotation.x));
              this.touchStart = {
                  x: t.touches[0].pageX,
                  y: t.touches[0].pageY
              }
          }
      }

Platform-Group avatar Jul 24 '23 08:07 Platform-Group