src/collisions/src/collision-utils.js
function detectIntersection(a, b) {
  if (a instanceof Sphere) {
    if (b instanceof Sphere) {
      return sphereCollisionDetection.sphereVsSphere(a, b);
    } else if (b instanceof Aabb) {
      return sphereCollisionDetection.sphereVsAabb(a, b);
    } else if (b instanceof Capsule) {
      return sphereCollisionDetection.sphereVsCapsule(a, b);
    } else if (b instanceof Obb) {
      return sphereCollisionDetection.sphereVsObb(a, b);
    } else {
      return sphereCollisionDetection.sphereVsPoint(a, b);
    }
  } else if (a instanceof Aabb) {
    if (b instanceof Sphere) {
      return aabbCollisionDetection.aabbVsSphere(a, b);
    } else if (b instanceof Aabb) {
      return aabbCollisionDetection.aabbVsAabb(a, b);
    } else if (b instanceof Capsule) {
      return aabbCollisionDetection.aabbVsCapsule(a, b);
    } else if (b instanceof Obb) {
      return aabbCollisionDetection.aabbVsObb(a, b);
    } else {
      return aabbCollisionDetection.aabbVsPoint(a, b);
    }
  } else if (a instanceof Capsule) {
    if (b instanceof Sphere) {
      return capsuleCollisionDetection.capsuleVsSphere(a, b);
    } else if (b instanceof Aabb) {
      return capsuleCollisionDetection.capsuleVsAabb(a, b);
    } else if (b instanceof Capsule) {
      return capsuleCollisionDetection.capsuleVsCapsule(a, b);
    } else if (b instanceof Obb) {
      return capsuleCollisionDetection.capsuleVsObb(a, b);
    } else {
      return capsuleCollisionDetection.capsuleVsPoint(a, b);
    }
  } else if (a instanceof Obb) {
    if (b instanceof Sphere) {
      return obbCollisionDetection.obbVsSphere(a, b);
    } else if (b instanceof Aabb) {
      return obbCollisionDetection.obbVsAabb(a, b);
    } else if (b instanceof Capsule) {
      return obbCollisionDetection.obbVsCapsule(a, b);
    } else if (b instanceof Obb) {
      return obbCollisionDetection.obbVsObb(a, b);
    } else {
      return obbCollisionDetection.obbVsPoint(a, b);
    }
  } else {
    if (b instanceof Sphere) {
      return sphereCollisionDetection.sphereVsPoint(b, a);
    } else if (b instanceof Aabb) {
      return aabbCollisionDetection.aabbVsPoint(b, a);
    } else if (b instanceof Capsule) {
      return capsuleCollisionDetection.capsuleVsPoint(b, a);
    } else if (b instanceof Obb) {
      return obbCollisionDetection.obbVsPoint(b, a);
    } else {
      return false;
    }
  }
}
function detectIntersection(a, b) {
  if (a instanceof Sphere) {
    if (b instanceof Sphere) {
      return sphereCollisionDetection.sphereVsSphere(a, b);
    } else if (b instanceof Aabb) {
      return sphereCollisionDetection.sphereVsAabb(a, b);
    } else if (b instanceof Capsule) {
      return sphereCollisionDetection.sphereVsCapsule(a, b);
    } else if (b instanceof Obb) {
      return sphereCollisionDetection.sphereVsObb(a, b);
    } else {
      return sphereCollisionDetection.sphereVsPoint(a, b);
    }
  } else if (a instanceof Aabb) {
    if (b instanceof Sphere) {
      return aabbCollisionDetection.aabbVsSphere(a, b);
    } else if (b instanceof Aabb) {
      return aabbCollisionDetection.aabbVsAabb(a, b);
    } else if (b instanceof Capsule) {
      return aabbCollisionDetection.aabbVsCapsule(a, b);
    } else if (b instanceof Obb) {
      return aabbCollisionDetection.aabbVsObb(a, b);
    } else {
      return aabbCollisionDetection.aabbVsPoint(a, b);
    }
  } else if (a instanceof Capsule) {
    if (b instanceof Sphere) {
      return capsuleCollisionDetection.capsuleVsSphere(a, b);
    } else if (b instanceof Aabb) {
      return capsuleCollisionDetection.capsuleVsAabb(a, b);
    } else if (b instanceof Capsule) {
      return capsuleCollisionDetection.capsuleVsCapsule(a, b);
    } else if (b instanceof Obb) {
      return capsuleCollisionDetection.capsuleVsObb(a, b);
    } else {
      return capsuleCollisionDetection.capsuleVsPoint(a, b);
    }
  } else if (a instanceof Obb) {
    if (b instanceof Sphere) {
      return obbCollisionDetection.obbVsSphere(a, b);
    } else if (b instanceof Aabb) {
      return obbCollisionDetection.obbVsAabb(a, b);
    } else if (b instanceof Capsule) {
      return obbCollisionDetection.obbVsCapsule(a, b);
    } else if (b instanceof Obb) {
      return obbCollisionDetection.obbVsObb(a, b);
    } else {
      return obbCollisionDetection.obbVsPoint(a, b);
    }
  } else {
    if (b instanceof Sphere) {
      return sphereCollisionDetection.sphereVsPoint(b, a);
    } else if (b instanceof Aabb) {
      return aabbCollisionDetection.aabbVsPoint(b, a);
    } else if (b instanceof Capsule) {
      return capsuleCollisionDetection.capsuleVsPoint(b, a);
    } else if (b instanceof Obb) {
      return obbCollisionDetection.obbVsPoint(b, a);
    } else {
      return false;
    }
  }
}
function detectIntersection ( a , b ) { if ( a instanceof Sphere ) { if ( b instanceof Sphere ) { return sphereCollisionDetection . sphereVsSphere ( a , b ) ; } else if ( b instanceof Aabb ) { return sphereCollisionDetection . sphereVsAabb ( a , b ) ; } else if ( b instanceof Capsule ) { return sphereCollisionDetection . sphereVsCapsule ( a , b ) ; } else if ( b instanceof Obb ) { return sphereCollisionDetection . sphereVsObb ( a , b ) ; } else { return sphereCollisionDetection . sphereVsPoint ( a , b ) ; } } else if ( a instanceof Aabb ) { if ( b instanceof Sphere ) { return aabbCollisionDetection . aabbVsSphere ( a , b ) ; } else if ( b instanceof Aabb ) { return aabbCollisionDetection . aabbVsAabb ( a , b ) ; } else if ( b instanceof Capsule ) { return aabbCollisionDetection . aabbVsCapsule ( a , b ) ; } else if ( b instanceof Obb ) { return aabbCollisionDetection . aabbVsObb ( a , b ) ; } else { return aabbCollisionDetection . aabbVsPoint ( a , b ) ; } } else if ( a instanceof Capsule ) { if ( b instanceof Sphere ) { return capsuleCollisionDetection . capsuleVsSphere ( a , b ) ; } else if ( b instanceof Aabb ) { return capsuleCollisionDetection . capsuleVsAabb ( a , b ) ; } else if ( b instanceof Capsule ) { return capsuleCollisionDetection . capsuleVsCapsule ( a , b ) ; } else if ( b instanceof Obb ) { return capsuleCollisionDetection . capsuleVsObb ( a , b ) ; } else { return capsuleCollisionDetection . capsuleVsPoint ( a , b ) ; } } else if ( a instanceof Obb ) { if ( b instanceof Sphere ) { return obbCollisionDetection . obbVsSphere ( a , b ) ; } else if ( b instanceof Aabb ) { return obbCollisionDetection . obbVsAabb ( a , b ) ; } else if ( b instanceof Capsule ) { return obbCollisionDetection . obbVsCapsule ( a , b ) ; } else if ( b instanceof Obb ) { return obbCollisionDetection . obbVsObb ( a , b ) ; } else { return obbCollisionDetection . obbVsPoint ( a , b ) ; } } else { if ( b instanceof Sphere ) { return sphereCollisionDetection . sphereVsPoint ( b , a ) ; } else if ( b instanceof Aabb ) { return aabbCollisionDetection . aabbVsPoint ( b , a ) ; } else if ( b instanceof Capsule ) { return capsuleCollisionDetection . capsuleVsPoint ( b , a ) ; } else if ( b instanceof Obb ) { return obbCollisionDetection . obbVsPoint ( b , a ) ; } else { return false ; } } }
This module defines a collection of static utility functions for detecting and responding to
collisions.
 
@param {Collidable} a
@param {Collidable} b
@returns {boolean}
This module defines a collection of static utility functions for detecting and responding to collisions .