How would you detect if a billboard gui is overlapping another billboard gui?

I want to figure out if a billboard gui is overlapping another billboard gui using a script. How can I do this? Also how can I find out how many billboard guis are overlapping it?

I’d definitely look into checking the AbsolutePositions of each of the GUIs and use some math to see if they’re overlapping. Probably wouldn’t be too complicated. Just remember that this would have to be done from a local script.

1 Like

I do not know much about BillboardGui’s, however I suppose you can use some math to calculate the angle and “distance” that the Gui is away from the player. Overlapping Gui’s would have different distance. However, what @Physicism is probably easier.

2 Likes

Is there any math equations you could show me? I could figure it out by myself, but… that would be a little difficult.

I have a feeling that WorldToScreenPoint would work best.
But at the same time, I don’t because I think it only detects 3D Objects.

You don’t come to the DevForum expecting people to do your work for you. You’ve been given a direction to explore, so I would try exploring it, and then come back if you reach any problems you can’t work through.

Depends on the BillboardGui size. Using Scale means it’s sized in Studs, using offset sizes it in screen pixels. Therefore, you just apply transformations with CFrames based on Camera Rotation onto the Adornee position + StudsOffsetWorldSpace and then screen pos.

If you really need an example I could write one, but it’d be best if you try first.

Once you find the four corners of your billboard GUi you can do collision checking using AABB with the different vertex data to check for overlaps. See AABB: 2D collision detection - Game development | MDN

2 Likes

I did not ask for much, nor did I ask someone to make a whole entire script for me.

I am not the best when it comes to math, nor am I the best when it comes to understanding math either so thats why I asked for an equation.

1 Like