PLAYCUBE PLAYCUBE - 2 months ago 28
Javascript Question

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?

Answer

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

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