Hello everyone!
I need help with how to detect if one CSS2DObject overlaps with another CSS2DObject. The essence of the problem is that imagine a sphere, on the surface of which the camera is placed, and around the camera, CSS2DObjects are placed dynamically. I would like to achieve that when I place an object, it detects if it overlaps with another one.
What I have already tried: I retrieve the getBoundingClientRect() of the object’s HTML element and compare it with those of the other objects. This works as long as the objects are in the field of view; if they are not in view, then I do not get relevant values from getBoundingClientRect(). My goal would be that when the page loads, all objects are placed, we are looking in a given direction, and all objects are positioned so that they do not overlap each other (without having to rotate around).
Thank you in advance for your help!