Processing of touch events in android internet browser

How can the touch move event be processed in a android tablet internet browser when using babylon.js

Hey! Welcome to the forum!
Do you want to setup some custom touch move actions? Can you be more precise please what would you like to achieve? Thanks!

Thanks for your answer roland.

I am currently using the functions below
to respond to mouse events.
This also works quite well.
But if I want to do the same thing via a tablet browser on Android with touch control, then
does not work.

this.camera = new FreeCamera(“camera1”, new Vector3(0, 0, 10), this.scene);
this.scene.onPointerObservable.add((pointerInfo) => {

switch (pointerInfo.type) {

                case PointerEventTypes.POINTERDOWN:
                ...
                case PointerEventTypes.POINTERUP:
                ...
                case PointerEventTypes.POINTERMOVE:
                ...
                case PointerEventTypes.POINTERWHEEL:
                ...
            }
        });

    }

This should work, could you provide a repro in the playground so that @PolygonalSun might have a look

I believe that the touch move event will be intercepted by the browser beforehand.
The entire canvas moves with the touch shift.
Is this a wrong attitude?

Does it make difference if you set this to false?

camera.attachControl(canvas, false);

EDIT: Actually I think we are not talking about camera movement here… Can you call event.preventDefault() after you have processed the event?

Thanks, I found a solution:

document.addEventListener(‘touchmove’, function(e) {
e.preventDefault();
}, { passive:false });

3 Likes