If the position of any face has the coordinates x0, y0, z0 in the start position, and the dice is rotated by the angles pan, tilt, roll the coordinates are as follows:
x = (x0*cos(pan) + y0*sin(pan))*cos(tilt) + z0*sin(tilt)
y = (x0*sin(pan) + y0*cos(pan))*cos(roll) + ((x0*cos(pan) + y0*sin(pan))*sin(tilt) + z0*cos(tilt))*sin(roll)
z = (x0*sin(pan) + y0*cos(pan))*sin(roll) + ((x0*cos(pan) + y0*sin(pan))*sin(tilt) + z0*cos(tilt))*cos(roll)
You can then check the coordinates of each face and look which is at the top.
BUT, the engine can do these calculations for you, if you use vec_for_vertex like Espér said. Why are you so against it? Look at the complexity of these formulas and how easy if would be with vec_for_vertex!
Last edited by Lukas; 07/11/10 14:51. Reason: Corrected a * to a +