I have the following problem. I have a camera that is initially looking at a cube. The cube is with center at (0, 0, 0). The camera that is initially on (0, 0, 60). The camera can rotate and translate using OrbitControls, while cube stays fixed. I want for a given position of the camera, to determine which side of cube is oriented to “up”, “left”, “right”, “down”, “front” and “back”. For example on the given picture we see that we are looking at left side of cube and on right side is the front.

I know how to solve the problem if the camera is fixed, but the cube rotates(apply inverse matrix of cube to the normal of face which we are interested in(for example (-1, 0, 0) for left, than find face with normal with smallest angle to this vector). But I cant design an algorithm for the camera moving case.