Jump to content

Second camera breaks clicks on main camera view


adam
 Share

Recommended Posts

In this PG:

http://www.babylonjs-playground.com/#1DXDX2#7

I set up a second camera which has a viewport at the bottom left of the screen.  That camera / viewport needs to be on top, but when it's on top I can no longer click the sphere through the main camera.  I can only click it through the smaller viewport.

I can get it to working again by adding the small viewport camera to the active cameras array first, but then the viewport is no longer on top.

http://www.babylonjs-playground.com/#1DXDX2#8

Link to comment
Share on other sites

Hello


things become more complicated with action manager
http://www.babylonjs-playground.com/#1DXDX2#11

but im not sure. https://developer.mozilla.org/en-US/docs/Web/Events

 

EDIT
@adam
push the needed meshes in an array this is kind of layer thing, you can not click from one to an other layer
instead you can access the database of the engine and work you way from their
http://www.babylonjs-playground.com/#1DXDX2#13

Link to comment
Share on other sites

I am able to click back and forth like this:

http://www.babylonjs-playground.com/#1DXDX2#15

I don't like how you have to click twice though.

It would be nice if we could register a function that gets called right before _updatePointerEvent and receives the pointerEvent.

https://github.com/BabylonJS/Babylon.js/blob/master/src/babylon.scene.ts#L689

then I could update scene.cameraToUseForPointers right when I need to.

Link to comment
Share on other sites

Anyhow when you push the cameras the right way (or something) its working also, 

 

this is non optimized code from a project of my, maybe you find something useful, i also try to get familiar with github :)

http://htmlpreview.github.io/?https://github.com/tolkanabroski/babylonjs-tutorials/blob/master/testp.html

https://github.com/tolkanabroski/babylonjs-tutorials/blob/master/testp.html

 

maybe, their is more, and i dont have the time to find out, where the things start to work, maybe its also a bug, but a good one, -  sorry
i think what we are doing always project related, u are right their should be a global solution!

 you solution works great!

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