Here is my problem Image
I want to check if the balls are touching, which works perfect. Sometimes however that ball with the arrow isn't picked up which of course makes sense since it isn't touching anything. However, I want to give a little bit of leeway so that if a ball is say 4 pixels/0.001m away, it should be considered as touching. So what idea/ how would i go about implementing it. I looked at the isTouching code and here is what I can come up with.
var b1 = body1;
var b2 = body2;
Transform xf;
Transform xf2;
b1.GetTransform(out xf);
b2.GetTransform(out xf2);
var touching = AABB.TestOverlap(b1.GetFixtureList().GetShape(), b2.GetFixtureList().GetShape(), ref xf, ref xf2);
if (!touching)
continue;
I still need to test if there is a ball faraway, and I am clueless to what I can do.