Search code examples
javascriptanimationthree.jsrotationmobile-devices

Three.js: Rotate object on mobile devices


Referring to a similar question here, I am trying to get an object rotated on smartphones/tablets. Since I got it with mouseDown method, this won't apply to the touching on mobile devices. Is there any solution for that?


Solution

  • Try touchstart and touchend as the event listeners for touch screens.

    window.addEventListener("touchstart", handleStart, false);
    window.addEventListener("touchend", handleEnd, false);