- Home /
Help with Circle Overlap Collision Detection
I want to find if two 3d object(round/circle) are Touching, if One is On Top of another or if it is Overlapping. I don't know where to start because collision detention wont work here. I am not looking for a code but if you can provide one, that would be awesome. I am just looking to see if Unity already has API to do this or if anyone got the idea of how to do this. Any help will be appreciated. Please look at the picture attached for more information.
The typical solution to this problem is colliders. If they are on the same plane, then a sphere collider or capsule collider will work. If they can be on different planes and/or can be rotated so that they are not parallel in the plane sense, you'll need to use a mesh collider that is simple enough that it can be marked as convex.
It can also be done mathematically with certain restrictions on how the circle is rotated.
Wow I believe this is the same person that answered my last question :). I know about mesh colliders and thats what I planned to use but how can I do it with Oncollisionenter?
I don't know you situation or your goals, but since you want to allow them to overlap, take a look at OnTriggerEnter() and OnTriggerStay() in the reference manual. Note that at least one of the circles will need a Rigidbody, though it does not need to move due to physics if you don't want it to. You need to set the isTrigger to true for the colliders.
$$anonymous$$y goal is to make each model to be on the floor then detect if one is overlapping another one. OnTriggerStay is what I am currently using but that doesnt tell it when it is overlapping. It only says when it is touching while no longer moving...
I'm not sure I have the nuances of this situation. Just reduce the size of the collider so that the edge of the collider is on the inside of the ring. Then you won't get the OnTriggerStay() until the rings overlap.
Your answer
Follow this Question
Related Questions
Hand-Held Weapon Collision Detection Not Working (going through walls) 1 Answer
How do I make OnTriggerEnter() respond to just one collider? 2 Answers
Test if BoxCollider is within another BoxCollider? 4 Answers
How can I destroy my Player when it touches another object? 1 Answer
How to set circle collision detectors more accurate 1 Answer