- Home /
Is it possible to edit the precision of Physics2D casts and overlap queries?
Hi, folks. So, I'm having an issue where Physics2D.OverlapCircle
is returning incorrect information when there's a short distance between them and a collider that they would intersect. Below, I'm doing a series of circle-overlap queries (in red) between two colliders in order to determine the amount of free space between them, as below:
Each time an overlap query is obstructed it tries again with half the radius -- but as you can see, the queries still fail even as the circle escapes the bounds of Collider B because they treat the gap of (0.005) meters between them and Collider A as an overlap.
I understand that different physics operations work only at a certain level of precision for performance reasons, but is there a way for me to customize this? The Physics2D engine settings seem to expose the contact offset threshold, and so I was hoping that somewhere else there might exist a similar field for queries like this.
Anyway, thanks for the read -- let me know if anything like this exists!