HI all
I do some development of webGL app and having quite a few questions if and how it works on mobile devices (android/apple).
I know that webGL is officially not supported, but it somehow works well except one thing. The problems are controls. my app is created the way it is controlled by mouse. And the controls does not work well on touch dispalys (because finge swime is absolute positioning, mouse is relative). So far I havent found a way how to tell webGL app whether it runs on device with touchable display or not.
IS THERE ANY WAY? That would solve my issues.
However it might be that it returns true on WebGL on all browsers. In web browsers, there is no JavaScript/browser API to detect whether the current system supports touch except to register a touch handler and see if you receive any touch events. Translated into Unity, try registering a Touch input event handler, and if you receive any input, you know you’ll have touch supported.
Yup, seems to return true on desktop (tested Firefox/Chrome).
And looking at pure javascript solutions, they seem to work same way (waiting for single touch, to know if touch is actually enabled…)
Issue with that is that you cannot display touch specific content, until user clicks screen… (i guess can add initial start screen that requires 1 click to continue then…)
so heres my simple script to wait for touch, and then could something:
I want to use an arrow joystick and when I tap with two fingers and lift one it rotates. There is no way to clear the mouse. that is what is affecting. Or simply the webgl touch only works like this. However in another application I made in webgl I discovered that 2 touches would be the right mouse button. as it works fine. the problem is when you need to press at the same time with two fingers on the screen for a joystick.
That code that you made where do you insert it? and this works to get this issue fixed?
The truth is that webgl gives a lot of headaches. The day someone solves this and manages to make webgl compatible with all the defects it still has, they will become a millionaire.
i use that script on start screen,
after user clicks “start”-button, it will receive touch and then can enable/disable different controls for mouse vs touch. (need to add that on the script, or use other script to reference this (and have bool public for example))