I have two bodies. One circle with a ball inside and one bird with a polygon. I am trying to detect collision between the sprites within the bodies and not the bodies themselves as in the code snippet below.
@Override
public void beginContact(Contact contact) {
Body a = contact.getFixtureA().getBody();
Body b = contact.getFixtureB().getBody();
if(contact.isTouching()){
System.out.println(contact.isTouching());
if (a.getUserData() == Constants.Enemy || b.getUserData() == Constants.Enemy) {
System.out.println("yes");
}
}
}
the method above prints out "yes" when the bodies are in a stage as on the picture below which is not right because the sprites have not touched with each other. Any ideas?