Touch screen js

Hi, is there a js script that handles default touch events? For example

One finger move
Two-fingered zoom
Two-fingered rotate

I have the basic script working: https://developer.playcanvas.com/en/tutorials/basic-touch-input/

It would be cool to have a default script for all standard touch actions.

Thanks.

There are a number of standard JS libraries that you can use for this. hammer.js was one that has been used in the past: https://hammerjs.github.io/

1 Like

Ended up using the code from this: https://playcanvas.com/project/446385/overview/starter-kit-model-viewer

That script doesn’t do 2 finger rotate though

You are correct. However I found hammerjs difficult to implement and the play canvas script was very close to what I was after and very easy to implement.

If you are still interested in hammer.js, you can look at the old model viewer starter kit which used it: https://playcanvas.com/editor/scene/443455

1 Like