In order find if there is an intersection between the ray and the 3D AABB:

The bounding box must have 6 faces and must be a cuboid:

1) The face with the min on x

2) The face with the max on x

3) The face with the min on y

4) The face with the max on y

5) The face with the min on z

6) The face with the max on z

3D AABB object collision function:

a) Test if the origin is in the box.

if min x is smaller than max x,

and min y is smaller than max y,

and min z is smaller than max z,

then the origin is in the box.

b) For each of the AABB faces, test if the ray may intersect with it:

c) Split each face (W) up into its UV coordinate system.

d) Pass in the value of the W face, and it's max and minimum U and V into the plane collision function to test for ray collision for each of these faces.

e) If the ray intercepts any single face of the AABB, there is collision with the AABB.

return true,else false.

AABB face collision function

a) For the U coordinate,

use V = U/V*W + CameraEye to get the V intercept of the AAplane.

b) For the V coordinate,

use U = V/U*W + CameraEye to get the U intercept of the AAplane.

c) If the V intercept is between min V and max V,

and the U intecept is between min U and max U,

then the ray intercepts the plane,

return true,else false