This.app.touch no longer used to detect touch devices?

Is it just me or this.app.touch can’t be used to detect touch devices anymore?

https://playcanvas.com/editor/scene/1843118
On both of my desktops, this.app.touch is not null.

Hi @Newbie_Coder,

Do your desktops have a touch input device?

Usually we enable with the browser debug tools a touch emulator e.g. a mobile/tablet device to test on desktop.

this.app.touch seems to work for me.

My devices have touchpads (to control mouse) but not a touch screens :thinking:

Just checked using navigator touchpoints, returns 256 on my lap :face_with_raised_eyebrow: That’s why this.app.touch is not null.

However, even if I didnt had any touch points my engine-only project loads

touch: new pc.TouchDevice(document.body)

, for all devices, so the check using this.app.touch won’t make sense in my case

const hasCursor = window.matchMedia('(pointer:fine)').matches

so far this gave me the most accurate results (giving that phones have no pointer/cursor)

1 Like