Jump to content

Babylon js OnPickTrigger does not work for android chrome


Arshanwer
 Share

Recommended Posts

Hello everyone, I recently created a roadblock game using babylon js. Everything went well and was hosted 4 days ago. Today I tried playing the game and apparently the onPickTrigger does not seem to work anymore. No bugs are thrown either. What's weird is that the game still works perfectly on my Iphone but does not work on any android (using chrome browser) devices.

Tried to look at the recent updates on babylon js to figure out what has gone wrong but I'm clueless . 

Any help will be highly appreciated as  my client is fussing about this and I am stuck not knowing where to start from since it does not throw any javascript errors.

Link to comment
Share on other sites

The game is pretty big, working on posting the code on PG. No I am not using touch none and pep.js but I am using hand.js 1.3.11..

Let me try to explain it in detail about the problem. As you start the game it display’s a button “play” which is a mesh with a material on it. I use ActionManager onPickTrigger on the “play” mesh to dispose itself and start the game. This feature was working untill last week 27th jan 2018. After hosting on 27th it still was working fine. From yesterday it just stopped working on android devices (used chrome browser) but still works normal on iphone safari and chrome browsers. 

Link to comment
Share on other sites

This is the first time I am trying to create a PG and Im travelling back to office. Will do it as I get there. The sample you gave does work on my android as well but not my game. Could you go to this link and check if the game works in your android ? http://surfmaticchallenge.com/

note: Lower your music volume as the game has an annoying background music playing.  

If you could pass me your email I can send you my project, if that is ok with you. 

Link to comment
Share on other sites

I switched to PEP.js and added touch-action="none" to the canvas and was able to start the game on Chrome for Android v 64.0.  After I click a dirty shirt it zooms in and the game locks (I did win a 30% discount once!), but I think that is more related to what main.js is doing.  Your program is ~3,000 lines of JavaScript, so hard to say what may be the cause.

You are attaching and detaching the canvas a lot in the code.  I have not seen that before, but I don't imagine that is helping a lot with pointer events.  I would just remove all the code and start adding and see where it breaks.  I don't have time unfortunately, but otherwise post a PG (playground) to reproduce and we can help.

Also, it's convenient on Chrome for Android over adb to see pointer events in console (on Desktop) for degugging.  That may be helpful.

Good luck.

Link to comment
Share on other sites

I commented out the hand.js script and added this: <script src="https://code.jquery.com/pep/0.4.3/pep.js"></script>

Edited your canvas to add an attribute: <canvas touch-action="none" ...</canvas>

I made also minor changes to the code.  I don't know if they made a difference - I commented out the layermask, the first scene you created (which you overwrote right after), all the attach/detach canvas.  I was able to get 1 dirty shirt max and then it locked up, so I was guessing something in the code.  Wish I could help you more, but I'm super busy right now.  Cheers. 

Link to comment
Share on other sites

I tried that and still no luck, so I decided to strip down the project and removed all the chunks of code and left out just the homescreen play button and the logo. Used babylon action manager onpicktrigger. Weird thing is the picktrigger works for the logo but not for the play button.

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...