Daiki Posted October 15, 2017 Share Posted October 15, 2017 Hello, if you dedected at babylon objects will use this code. var internalMesh40 = BABYLON.SceneLoader.ImportMesh("", "http://xxx/", "untitled.obj", scene, function (newMeshes, particleSystems) { // Set the target of the camera to the first imported mesh internalMesh40 = newMeshes[0]; internalMesh40.position = new BABYLON.Vector3(91.3,3.5,98.5); internalMesh40.isPickable = true; internalMesh40.actionManager = new BABYLON.ActionManager(scene); //ON MOUSE ENTER internalMesh40.actionManager.registerAction(new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPointerOverTrigger, function(ev){ scene.hoverCursor = " url('http://jerome.bousquie.fr/BJS/test/viseur.png') 12 12, auto "; })); //ON MOUSE EXIT internalMesh40.actionManager.registerAction(new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPointerOutTrigger, function(ev){ })); }); I want now but not only that the object is dedected but also if you press the E pushes an overlay or Modal opens. Unfortunately I have not been able to find anything yet. Do you have an idea? Sincerely Julian Quote Link to comment Share on other sites More sharing options...
Wingnut Posted October 15, 2017 Share Posted October 15, 2017 Hi Julian. You ask for moon and stars, but I am nice. I will take you part-way down the trail. https://www.babylonjs-playground.com/#11CHPW#2 We import mesh. When pointerOver mesh, cursor changes, and we do background random color. We store ref to mesh... inside scene.hovered. When pointerOut, cursor normal, background changes color again. We clear ref inside scene.hovered. When pressing 'e'... nothing happens (unless something is hovered). Pressing 'e' when hovering model, background changes color again. (line 40) Warning: I added no canvas.focus(), so you must click on canvas ONCE... to make 'e' keypress active (when hovering). Line 40+ is where you will launch the window or gui panel... for mesh scene.hovered. Scene.hovered will contain the mesh that is hovered-over.. when 'e' was pressed. You CAN launch an absolute-positioned HTML div, or even an iFrame, if you wish. var myDiv = document.createElement('div') works fine...then use document.body.appendChild(myDiv). Then set myDiv.style.position = "absolute" and myDiv.style.top = some%, and myDiv.style.left = some%, etc. Or, you can use our new Babylon GUI system, which isn't as powerful as HTML, but it is VR and webVR ready. Lots of demos are nearby. It works great for launching information panels/containers, and its text does word-wrapping fine, but its containers are not yet ready for overflow/scrolling. I hope this helps. Stay in touch. Addendum: https://www.babylonjs-playground.com/#11CHPW#3 I decided to add a small pop-open panel-of-Babylon-GUI when you press 'e' while hovering mesh. Not very exciting, but a good starter for you, if you choose. Ok bye again. Quote Link to comment Share on other sites More sharing options...
Daiki Posted October 15, 2017 Author Share Posted October 15, 2017 Thanks for your help and effort. I think I can do something with it. Quote Link to comment Share on other sites More sharing options...
Daiki Posted October 17, 2017 Author Share Posted October 17, 2017 Hello, now I have yet another question. Is there the possibility of several lines or with HTML and PHP to act thereby? Just as it is now that I can only write a certain line, it is unfortunately not for me to use. I need something like bootstrap of modal or Lightbox. Thank you very much and greetings Julian 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.