Clicking mesh in React Native

Wow, @ryantrem sorry to do this to you again but I think I just found what I was looking for in this thread here: DeviceSourceManager for touch inputs - #3 by Deltakosh
No idea how I missed that before, so according to that I can do this kind of thing:

        touchDevice = deviceSourceManager.getDeviceSource(BABYLON.DeviceType.Touch); 
        if (touchDevice) {
            touchPosition.copyFromFloats(touchDevice.getInput(BABYLON.PointerInput.Horizontal),
                                      touchDevice.getInput(BABYLON.PointerInput.Vertical),
                                      0);

I was thinking that I could get that from the event, but I guess I have to save the ‘device’ to get the input data from it.
So touchDevice.getInput(BABYLON.PointerInput.Horizontal) gives the horizontal screen position and touchDevice.getInput(BABYLON.PointerInput.Vertical) gives the vertical one, I’m guessing.
I had tried touchDevice.getInput(PointerInput.LeftClick) which gives just a number so that’s what got me confused.

1 Like