- Home /
Overlap Circle - am I not using it correctly?
(For clarification, this is using Physics2D)
I'm trying to draw a trajectory of where a ball shaped character will end up in a level when fired from a particular point. I can generate a rough trajectory using a series of linked ray-casts (checking between timeframes) but the problem with this is that a ray has an infinitesimal small diameter - so while a point could pass through a gap, a ball may not.
To overcome this, I've thought the best way to test if a ball would hit is to perform an OverlapCircle call at each point of the trajectory when it doesn't find a ray-cast collision. If it finds something then it should perform some finer raycasts to the extremities of the ball to determine exactly where it has collided so I can give the trajectory a correct course change.
The problem I'm having is that the OverlapCircle doesn't appear to correctly detect anything at all and worse it performs differently within the editor than it does on an Android device! The documentation doesn't even explain if it returns positive if its a partial overlap or encompassing overlap so clarification on that would be useful!
So am I using it correctly or does it only apply to certain situations? Can anybody suggest alternative approaches to what I'm trying to do?
Your answer
![](https://koobas.hobune.stream/wayback/20220613124430im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Ignore sub-colliders for center of mass in Rigidbody2d? 1 Answer
Colliders not working 1 Answer
Target Wheel Rotation/Physics 0 Answers
Player gets stuck on collision when jumping up a platform. 3 Answers