shouldCollide method

bool shouldCollide (Body other)

This is used to prevent connected bodies from colliding. It may lie, depending on the collideConnected flag.

@param other @return

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 (JointEdge jn = _jointList; jn != null; jn = jn.next) {
    if (jn.other == other) {
      if (jn.joint.getCollideConnected() == false) {
        return false;
      }
    }
  }

  return true;
}