I'm writing a Rubik's Cube application in Java 3D. I didn't have any problem to draw the cube. The rotation of the cube in the universe function too.
Now I will rotate the different faces. This function as long as I rotate only one face. But when I will make multiple rotation. For example the front face and the right face then the programm choce the wrong stones of the Cube.
Structure of the Cube
In the Content Branch Graph I have a 3-dimentional Array of Transform Groups into this Transform Groups I have a 3-dimentional Array of Stones. The Stone-class I have create on myself. It draws a square wiht a Quad Array.
At the moment I select the stones based on the array of the Transform Group. Afer the rotation I reorder the Transform Group into the array.
Here is what I've done so far :
void rotateWhiteFace()
{
Transform3D rotate = new Transform3D();
rotate.rotZ(Math.toRadians(angel2));
for (int x = 0; x < stoneTransform.length; x++)
for (int y = 0; y < stoneTransform.length; y++) {
stoneTransform[x][y][2].setTransform(rotate);
}
angel2 = angel2 + 90;
}
Do you have a answer how I could make multiple rotations?