Jump to content

Any way to track user actions?


Recommended Posts

I wrote a babylon.js scene and played it on a Google Pixel with a Daydream headset using a Cordova wrapper.  I'm stuck now because my scene actually consists of a few different scenes through which the user needs to click.  Is there any way I can recognize user actions in my script?  The Daydream controller is of course very new and so there's no Cordova plugin for it (nor is there for the Gear VR).  I tried to register an onPickTrigger action but that doesn't work - and not even a simple global canvas.onclick event gets noticed.  Is it just not possible in HTML5 VR apps to register user actions or am I missing something obvious?

Link to comment
Share on other sites

Hi @mathias_strasser, welcome to the forum.

  Would you have a moment to try a canvas.parentNode.onClick event?  In the playground, the canvas container is ID: canvasZone.

I'm not experienced in the Daydream Controller, but, JS events is JS events. 

Anyway, here is a little helper doc for Daydream Controller events.  https://developers.google.com/vr/unity/controller-basics

It looks like the Daydream Controller uses some unique event names.  Perhaps try adding event listeners for those unique names?


The controller reports the following button properties:

  • ClickButton: True if the Click button (a touchpad click) is currently being pressed.

  • ClickButtonDown: True for 1 frame after user starts pressing the Click button.

  • ClickButtonUp: True for 1 frame after user stops pressing the Click button.

  • AppButton: True if the App button is currently being pressed.

  • AppButtonDown: True for 1 frame after user starts pressing the App button.

  • AppButtonUp: True for 1 frame after user stops pressing the App button.


I'm not sure HOW BJS is going to proceed in dealing-with the 10,000 new controllers that will be invented in the near future.  I once proposed that all user inputs enter BJS land through an "Inputs ActionManager" class, but that idea was met with some less-than-optimal enthusiasm.  :)  (That is common for me... I am a professional at thinking-up half-baked/ridiculous ideas.)  heh

Anyway, perhaps others will comment with more info.  Don't expect miracles, because you are riding WAY UP on the "bleeding edge".  :)  Be well, welcome again.


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.

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.


  • Recently Browsing   0 members

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