export function AABB(obj1, obj2) { if (checkOverlap(obj1.position.x, obj1.dimensions.x, obj2.position.x, obj2.dimensions.x)) { return true; } else if (checkOverlap(obj1.position.y, obj1.dimensions.y, obj2.position.y, obj2.dimensions.y)) { return true; } else if (checkOverlap(obj1.position.z, obj1.dimensions.z, obj2.position.z, obj2.dimensions.z)) { return true; } return false; } function checkOverlap(x, w, yx, yw) { if (x > yx || x < yx + yw || x + w > x || x + w < yx + yw) { return true; } }