adam Posted August 27, 2016 Share Posted August 27, 2016 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 Quote Link to comment Share on other sites More sharing options...
Nabroski Posted August 27, 2016 Share Posted August 27, 2016 http://www.babylonjs-playground.com/#1DXDX2#9 adam 1 Quote Link to comment Share on other sites More sharing options...
adam Posted August 27, 2016 Author Share Posted August 27, 2016 Thanks Nabroski. Is there a way to click on the sphere in both cameras? At first I was thinking I could track the position of the mouse. That wouldn't work very well for mobile devices, though. Quote Link to comment Share on other sites More sharing options...
Nabroski Posted August 27, 2016 Share Posted August 27, 2016 Hello things become more complicated with action managerhttp://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 theirhttp://www.babylonjs-playground.com/#1DXDX2#13 Quote Link to comment Share on other sites More sharing options...
adam Posted August 27, 2016 Author Share Posted August 27, 2016 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. Nabroski 1 Quote Link to comment Share on other sites More sharing options...
adam Posted August 27, 2016 Author Share Posted August 27, 2016 I found scene.onPointerObservable: http://www.babylonjs-playground.com/#1DXDX2#19 it fires too late to avoid the double click between the viewports. Quote Link to comment Share on other sites More sharing options...
adam Posted August 27, 2016 Author Share Posted August 27, 2016 I found scene.onPrePointerObservable and it is now working. http://www.babylonjs-playground.com/#1DXDX2#21 Quote Link to comment Share on other sites More sharing options...
Nabroski Posted August 27, 2016 Share Posted August 27, 2016 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! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.