shouldCollide method
This is used to prevent connected bodies from colliding. It may lie, depending on the collideConnected flag.
Implementation
bool shouldCollide(Body other) {
// At least one body should be dynamic.
if (_bodyType != BodyType.dynamic && other._bodyType != BodyType.dynamic) {
return false;
}
// Does a joint prevent collision?
for (final joint in joints) {
if (joint.containsBody(other) && !joint.collideConnected) {
return false;
}
}
return true;
}