Tilting of tetrahedron

  1. Our game has a tetrahedron wherein 3 faces (Red, Green & Blue) are visible & 1 face (Black )is down.
  2. The game needs to move tetrahedron by tilting in any direction along its edge & not vertex. ie If I tilt from Green side then Green face goes down.
  3. Next after tilting I need to rotate the tetrahedron in the new position itself.
  4. This process will be repeated for entire game with this tetrahedron.

The problems are

  1. In case of cube if I tilt it along the edge then the axis is also tilted by 90deg. So after every tilt I get any one axis pointing upwards which makes it easy to pivot that axis for doing rotation at that position itself.
  2. Now in case of a tetrahedron, after tilting there is no certainty of getting any one axis pointing upwards. This makes it difficult to do subsequent tilting as the axis for edge is not at an odd angle.
  3. Also since no vertical axis exits at 90deg doing rotation is also not possible…

How should we go about achieving repeated tilting & rotation for a tetrahedron??

My first thought would be to “instrument” the tetrahedron using empty game objects. For each face, place an empty game object on the center of the edge such the empty game object’s “down” would face down if that edge was touching the surface. You will then need to link the three game object somehow and associate them with the face (might make all there children of yet another empty game object). When a face is hit, compare the down of all three empty game object associated with that side. The one with the closest match (should be near perfect) will associated with the edge to use. This object will both identify the edge and give you the vector to use for the angle axis rotation.

I’m fuzzy on point #3 above “in the new position.” I’m assuming you want to rotate the tetrahedron so that some side is facing forward. You can raycast and find the normal of the “front” face and use it to rotate the object correctly.