- Home /
Get all objects that intersects with a object
How do I know which objects are within the bounds of another object. They wont move so I guess onTrigger functions wont do it. I looked at "Intersects" but that only seems to work for one other bound and just gives back true/false, like this:
if (bounds1.Intersects(bounds2))
{
// do something
}
I would like to get all objects that intersects with a specific object. Is there any simple solution for this?
also posted here: http://forum.unity3d.com/threads/138889-get-all-objects-that-intersects-with-a-object?p=945656#post945656
Answer by Berenger · Jun 06, 2012 at 06:29 PM
Start by gathering all the objects around with OverlapSphere, radius bounds1.extents.magnitude. The, test the Intersect with all of them.
Your answer
![](https://koobas.hobune.stream/wayback/20220613072439im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
collider bounds intersect but than for a UI button element 0 Answers
BoxCollider2d.bounds.Intersects Not Working 2 Answers
Checking to see if BoxCollider intersects with another collider doesn't work. 1 Answer
Problem with getting colliding objects 3 Answers
Problem with detecting if instantiated objects are overlapping 1 Answer