Jump to content

Mesh actions with WebVRFreeCamera and Oculus headset


Lande
 Share

Recommended Posts

Hello everyone!.

I am developing an application with Babylon.js and I have setup the WebVRFreeCamera on my scene. I have been playing with babylon actions, pickResults etc using the mouse pointer, and now I was trying to get the mesh that is in the camera view trajectory so I can trigger actions or activate behaviours. I have tried using Babylon.Ray and looking around the documentation with no luck,

I have been also testing React VR, and it has event binding to the meshes on the scene. Something like this:

<Mesh source={{mesh:'cube.obj', texture:'cube.jpg'}} onEnter={this.OnEnterCallback} onExit={this.OnExitCallback} />

It makes easy triggering events when  gaze in / gaze out happens around the different meshes, and I would like to know if you can guide me in the right direction to do this with babylon.

I have seen that scene has scene.getActiveMeshes, but I returns an SmartArray of visible meshes in the camera, and It would be cool to have something more precise.

I hope you can guide me!. 

Thanks!

Link to comment
Share on other sites

Hi Lande,

funny, I just answered the exact question in an email ;)

So, a simple playground to get things started:

http://www.babylonjs-playground.com/#1IDANY - this is almost exactly what babylon is already going every frame for checking the meshUnderPointer, of course in this case I am using the middle of the screen and not the XY of the pointer. The same can be done in VR to check where the camera is looking at.

Hope this gets you and everyone with the same issue started!

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