just store their 3d bounds and include some way to check if a point is inside them
then step a point in a selected direction until it is within an object's bounds; it has now hit that object
you can use a bunch of these to hack-ily implement 3d rendering by sending a ray out for every pixel