How to detect whether two billboards overlap
Thank you for your question! To the best of my knowledge, our base API does not have a method that allows you to detect if two billboards are overlapping. One possible workaround might be to simply check if two billboards are near each other using the
sizeInMeters member and the position of the billboard. Any suggestions from the rest of the community?
Well, it comes down to what zoom level you’re at when you do the testing, so probably I’d write a listener on the zoom level that checks the distance between the pins to a factor of that.
What’s the use case for this? For pins you can look into clustering as well, if it’s all about visualising close pins.
I convert the position to screen coordinates, and then judge whether it coincides.This solved my problem。
how you convert is there a api method for that ?
it sounds very reasonable - I also thought about this, BUT how do you determine the objects that are in sight of the camera and the distance for near objects?
I understand that I can just check ALL objects in the scene - BUT it seems to me not optimal and stupid to be honest, especially when it comes to hundreds of objects with variable data and taking into account the height, for example. Thus, I would really be interested to see your sample code for a solution.
I wonder if there is a member in
Transforms that would do this conversion.
I think that it might be worth looking into how clustering does it, as there are some events in there you can hook into. But again, what’s the use case? If it’s for visualising near objects, clustering is the thing (whether you use it or not, you can use check how it does it). What’s the end goal?
This would be a good place to start, though it gets pretty involved. I had the vague idea there might have been a way to intercept the callback when a group of entities is going to be clustered and not replace all of them with one cluster entity, but I don’t think that’s actually the case – once the
clusterEvent fires for a given group, the original entities are already being replaced for that render pass. Still might be helpful depending on the OP’s use case.
You can always be sneaky and introduce two sets; the original icons, and another which are invisible tiny dots with the same coordinates, do the clustering only on the invisible dots, and control your icons with the incoming events? It really comes down to what the OP wants to do with the detection.