- Home /
Detecting if two meshes intersect, precisely
I'm trying to gather all GameObjects a specific object intersects with. At the moment I'm using a broad sweep:
Collider[] colliders = Physics.OverlapSphere(latestObject.collider.bounds.center, latestObject.collider.bounds.extents.magnitude);
But as I understand it, this uses a bounding sphere around each object to test for overlap, and so it may not be very precise. I'd like to then check each returned object with a more precise approach. Is there an easy built in way to check one object against another more precisely? Or do I have to literally manually go into the meshes and do triangle<->triangle intersection tests?
Thanks for any help!
Answer by GerryM · Feb 11, 2013 at 01:29 PM
If your objects are convex and do not have more than 255 tris you can use the mesh collider to check for collision (intersection).
Thanks for the answer Gerry - unfortunately I cannot rely on my objects being convex.
I should note also that I don't need any information about the collision/overlap, except that it has happened...if that simplifies the problem.
I'm beginning to think I'll have to look at my own triangle-to-triangle intersection function? :/
Thanks, just wanted to make sure I wasn't reinventing any wheels.
Very useful link too - cheers Bunny83!
Your answer
Follow this Question
Related Questions
Mesh slicing or shattering 1 Answer
Click on object to activate another object 3 Answers
Set an object to invisible? 2 Answers
Game object with animations 0 Answers
Change Mesh/Gameobject onmousedown?,Swap mesh/gameobject randomly onmousedown 0 Answers