I know there is a way to connect GUI with the mesh in Babylon. But I am not sure how it works when user places the hotspot on the model. How can I detect that position on the model and add hotspot there which will then properly be linked to that position in 3D space.
This is type of annotations I am looking for (it should be fairly simply to create this using GUI)
Oh, that’s interesting. So I could create dummy mesh and on user click I could place that mesh on the position where is clicked on the model (so something like using picking rays to determine where it is clicked in 3D space). And with that dummy mesh I create GUI element which is parented to it, that way it will look properly in the scene, and I can even detect when the mesh is occluded, so I can make GUI element less/or no visible in the scene.
Yea. I feel like this solved my problem, even though I didn’t implemented it yet. Thank you for the great thinking. As always, life is easier with you guys. I am constantly grateful that I chose to work with Babylon instead of any other engine, you guys are amazing.
Also It is good practice to remove an observable when it is not being used. Because we added a POINTERDOWN observable on scene(line 49) we want to remove it when the scene is removed which is what is happening in this code. The onDispose is called when the scene is being disposed.
Thanks for your kind reply. Actually my need is , create some hotspots in webgl scene. But the hotspots should be created with the html and css, like a rounded image for hotspot and while clicking it some effects needs to be happened using css. is it possible ?
////
please have a look into the below link. In this some hotspot has been made with html and css .
I need this kind of hotspots in webgl scene. Is it possible
I think you should use Babylon GUI for the hotspots and change css on button click like you normally would. You might have to change your logic to open the popups.
If you definitely need html you would need to rely on the unproject functions from the maths lib to find your css position in the canvas so you could manually mix and match them
@sebavan Thanks for your reply. Any other way except html available in babylonjs to get a hotspot like this? Actually I tried Sprites. but when I use it and the performance is very low. So only I am searching some other way.;