Unable to find device Touch

gettings lots of input system errors again even though I’m calling detachControl().

Error: “Unable to find device Touch”

I will help fix the error in any way possible, but please can you look at preventing any future errors from this system that should not be in use? (also in the light of performance maximization)

The error is coming from all kinds of players/devices, both Android and iOS, playing https://tuggowar.io at (to me) seemingly random moments in the session (for example after 10 minutes of playing or after 1). There is no stack trace.

Which version of Babylon do you use?
Is there any more information which could help to debug?
Did you notice this behavior before or it happened after some changes?

you can see the version in the console (Babylon.js v5.0.0-beta.4). I think it might have started after updating from alpha 48 to this one.

some user agents:
Mozilla/5.0 (Linux; Android 11; ZS590KS) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.98 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 8.1.0; Lenovo TB-7104F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36
Mozilla/5.0 (iPhone; CPU iPhone OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/97.0.4692.84 Mobile/15E148 Safari/604.1
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Safari/605.1.15

It is always better to ask directly since it will save some time for everybody who is willing to help you.
Did you try to downgrade back to the state where there were no problems?

@PolygonalSun would be great if you can have a look at this one ?

Lemme take a look and see what’s going on. The error that you’re seeing comes from the pollInput function of the WebDeviceInputSystem and occurs when a device type (or a specific “slot” for input with that device) isn’t found. Just out of curiosity, has this just been occurring on mobile/touch-enabled devices?

the last user agent is Mac, but I suspect it could be an ipad as well so who knows. I’ll let you know if I know more. Please also find out why this code is even called with detached controls :innocent:

So here’s what I’ve found. For the error that you’ve found to occur, a Touch input needs to have been registered at some point. On top of that, the pollInput function needs to be called so that leaves three scenarios:

  • pollInput is being called directly (unlikely)
  • getInput is being called against a DeviceSource object (possible if you’re using the DeviceSourceManager in your code)
  • A loss of focus is happening on your app (eg. blur event; most likely)

During my investigation, I found that our blur eventlistener was still working during a detach so I suspect that the issue you’re seeing is because that blur event listener isn’t being disabled properly. I’m currently working on a fix for this and will update when it’s in PR. Just to confirm something while I work on this, are you using the DeviceSourceManager directly in your code at all?

1 Like

Fix is in PR: DeviceInputSystem: Fixed pointer blur function for Touch by PolygonalSun · Pull Request #11824 · BabylonJS/Babylon.js (github.com)

2 Likes

no, I don’t use that. should be fixed then I suppose!
The blur thing should explain the randomness of the error.

PR is merged

1 Like

I’m getting this warning now for every touch: `Max number of touches exceeded. Ignoring touches in excess of 0’.
This is thrown in WebDeviceInputSystem so it seems like this code is still running.

I think I’ll strip the whole thing out myself just to make sure, because it keeps making me uncomfortable.

I’m encountering the same issue like @mise, after upgrading to v5.0.0-beta.6 (previously running v4). I’m using a wacom tablet on linux, which apparently is recognized as a touch device for some reason. In chrome I’m getting the error „Max number of touches exceeded. Ignoring touches in excess of 0” on every click. Same error does not happen if running v5 in firefox or running v4 in any browser

@PolygonalSun would be great if you could have a look ?

please let me know if you plan on detaching this module (and all canvas pointer and touch events) when detachControls() is called as expected or if you would advice me to do this myself.

I don’t mean to sound entitled, I would just like some clarity about this.

@mise, originally, I was disabling actions that trigger when the events occur so that we could still keep track of inputs without taking any action. Given that the current approach isn’t working, I believe that I’ll need to just outright remove all events when detached and zero out the inputs to prevent any issues if anyone reattaches them. As far as that warning with the value of 0, it means that the system either doesn’t have a value for navigator.maxTouchPoints or that its value is 0. The warning should only appear on the pointerdown event so I’m curious what scenarios you’re seeing it in.

As for the WACOM tablet, @thomasaull, I suspect that it’s happening because pen inputs are treated similarly to touch but don’t actually have an effect on the value of navigator.maxTouchPoints. As I don’t have a tablet to test this, I may have to get someone to verify this for me. Fortunately, the fix for this is pretty easy.

I can work on a fix for both of these in tandem but @mise, if you can get me any additional information to help with a repro, I’d appreciate it because I suspect there’s some other underlying issue that I haven’t found yet.

ok, the only thing I can think of is that I was using the mobile simulator in Chrome when I saw them (when handling pointerdown to capture the touches). If you can’t reproduce that I’ll take another look.

1 Like