Jump to content

GUI button issue with chrome


jeremy948
 Share

Recommended Posts

Hello,

I'm currently doing a shooter game for mobile devices with babyonjs. I use babylon GUI to display fixed buttons on my screen (for example a fire button).

Everything worked before, but since few days GUI buttons are not working anymore with chrome on mobile device (it's working with safari and firefox).

Do you have any idea about that ?

thanks

Link to comment
Share on other sites

At the beginning i tried to remove some elements from my game, but it looks like it's not working even for a very simple case.

I tried this PG from the doc https://www.babylonjs-playground.com/#XCPP9Y#1 with 2 android devices (chrome browser). If i just try the PG from this url it's working. But if i download it (zip) to start it from my server it's not the same result :

For the 1st android device (chrome version < 64) it's working (as well as iOS/safari devices).

For the 2nd android device (chrome 64) the click doesn't trigger anything. It looks like a problem related to the last chrome version, it would be nice to make it works on any devices :D

(i added PEP.js and touch-action none in <canvas> and in the css)

Link to comment
Share on other sites

Facing the same issue, I stripped down my project and I tried but the tui button click works for mesh that is on top left corner but anywhere else. I know it does not make sense but I tried every possible way to figure out why and I couldnt.. Everything works well when its on PG irrespective of the chrome version.

Link to comment
Share on other sites

I tried to find an other way to make buttons on the screen. In my shooter game (first person shoot for mobile), i 'm using FreeCamera with mouse input instead of touch input because i feel it much more natural to target something. The problem is multi touch is not working.

I wanted to use scene.onPointerDown, then trigger something depending on pointer position (to replace gui buttons). But since multi touch is not supported, if i use one finger to move the camera and i use a 2nd finger to shoot, the first pointer (1st finger to move camera) is not moving anymore. The 2nd pointer take the lead, there is no multi touch.

If you have any solution to manage multi touch with mouse input on device or some idea for controls in a shooter game, please share :D thanks

Link to comment
Share on other sites

I found the problem : my device screen is 360x568 and pointer event got coordinates from that. But the scene was much bigger so the button coordinates didn't match with this pointer event coordinates. Thats why the button didn't trigger anything. 

I changed the viewport <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=1"> and it worked.

 

 

 

Link to comment
Share on other sites

On 2/5/2018 at 2:36 AM, jeremy948 said:

I found the problem : my device screen is 360x568 and pointer event got coordinates from that. But the scene was much bigger so the button coordinates didn't match with this pointer event coordinates. Thats why the button didn't trigger anything. 

I changed the viewport <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=1"> and it worked.

 

 

 

It worked! Thank you!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...