# Determine which face of die is up in 3D space

I'm developing a game using jmonkeyengine 3, but this question is more about math (rotation) than anything else, so I think I'm asking on the correct site. I'm terrible with math and I've tried to figure out what I can on my own, but when in doubt.. ask! You don't need to know anything about jmonkeyengine to answer the question.

Sooo.. here's what I have set up:

• The camera doesn't move
• Its rotation is (0,1,0,0)
• Its direction is (0,0,0,-1)
• A die is dropped so that 4 is visible (you can see the 4 pips in the camera)
• When dropped, the die with 4 showing reports rotation (0,0,0,1)
• The camera also has function "getLeft" which reports a vector (-1,0,0)
• and the function "getUp" which reports a vector (0,1,0)

At any given point in time, how could I compare the rotation of the camera to the rotation of the die to determine the resulting roll?

-
How are we to interpret these 3 and 4-tuples, geometrically? –  anon Feb 28 '12 at 3:27
Let me hazard some guesses, and please tell us whether I'm right: The $4$-vectors are unit quaternions that represent rotations that represent orientations of the objects in space relative to some initial orientation? The $3$-vectors are ordinary $3$-vectors in ordinary space? The results of getLeft and getUp would make sense if the quaternion $(0,1,0,0)$ of the camera represents a rotation through $\pi$ about the $x$ axis, "left" is $(-1,0,0)$ in the initial orientation, and "up" is $(0,-1,0)$ in the initial orientation. –  joriki Feb 28 '12 at 9:57
I would have thought that the direction of the camera is the direction at or from which it is considered to view the scene at an infinite distance. What I don't understand, though, is a) why is this a $4$-vector and not a $3$-vector, and b) why do you want to use the rotation of the camera in determining the result -- shouldn't the result be determined by the rotation of the die and the direction of the camera? –  joriki Feb 28 '12 at 9:59
Yes, joriki.. I'd assume the direction of the camera is more important than the rotation, I just included the rotation for added info. And I didn't realize the tuples were vague (I thought they were commonly used in this way).. the 4s are quaternions, and I've never seen them past 0-1, so I'd assume it's based on unit circle. The 3s are just standard vectors. –  Snailer Feb 28 '12 at 14:15
Anyone.. please?? –  Snailer Mar 1 '12 at 16:26