DeviceSourceManager issue with the touch input on iPad

Hi, i’m try to use the class DeviceSourceManager for managing the user inputs but i have problem with the touch input on iPad whit Safari, the device connection is detected but when i use the getDeviceSource method for get the device it return ever null.
I have try the code on Android whit Chrome and it work.

My code is like that:

let dsm = new BABYLON.DeviceSourceManager(scene.getEngine());

dsm.onDeviceConnectedObservable.add(function(device){
 	console.log("Connected device type: " + device.deviceType); //Log type 3    	
 });

scene.registerBeforeRender(function() {
    let touch = dsm.getDeviceSource(BABYLON.DeviceType.Touch);
    console.log(touch); //Log null        
 });

I have used: Babylon v4.2.0, PEP v0.4.3, Safari on iPadOS 14.
Thanks for help.

Adding @PolygonalSun

Lemme take a look and see what’s going on

Sorry about the delay on this. The issue appears to be how the iPad/Safari is storing pointerIds and how the DeviceSourceManager searches for the first touch. Safari will put in large negative values for the pointer Id and the DSM starts by searching based off of positive ids (how every other browser works). I am working on a fix for this right now.

2 Likes

Fix is in PR: DeviceSourceManager - Fix touch on iOS by PolygonalSun · Pull Request #10552 · BabylonJS/Babylon.js (github.com)

3 Likes

Will be in the next nightly later today.

PR is merged

1 Like

Hi @PolygonalSun , thank you very much for the fix, i will retry again to use DeviceSourceManager class on Apple devices.

1 Like