0

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?

Axel Isouard
  • 1,498
  • 1
  • 24
  • 38
Molitoris
  • 935
  • 1
  • 9
  • 31
  • Welcome to Stack Overflow ! Please show us what you've already tried, this would help us a lot to find a solution for your problem. – Axel Isouard Sep 27 '12 at 11:08
  • 1
    You can find the hole code on GitHub under the name "vantastic". Some comments in the code are german. I'am sorry for that. – Molitoris Sep 27 '12 at 14:26

0 Answers0