Click on Mesh but only on a Area

Good day,

I have an imported mesh, which consists of several elements. How can I perform a click event there, which lists a specific action?

This is not a problem so far - but the clicking should not take place on the complete element (for example, the tire) but on a specific area on the element. For example, if I have a box as an element which is 10/5/2 large, then the click should only be scored if this has happened in the lower right corner.

Even better there would be a point, which shows me WHERE I can click to change the respective element.

The whole I can illustrate in this example something, as I imagine this in about (only the other actions happen)

The respective points should then be set automatically, if possible!

Thanks for Help :slight_smile:

Hi Daniel,

In the demo you submitted, the hotspots are actuallly implemented using HTML and not a part of the 3D world per se. This is something you can achieve with HTML GUI libraries (like the well documented CastorGUI) or using Babylon’s native GUI library (would be my recommendation).

You can also create an invisible mesh at the position you want to have the click at, and attach the click event to it (and not to the object itself). This mesh can be a simple invisible primitive, so it doesn’t affect performance at all.

Hope this helps somehow!



Thanks for the answer! The latter would help, and I think that would be the end of it.

I think for now you have helped me, should I still have other problems I’ll simply write again :smile:

Thanks and have a nice day!