Hello
I´m interested in how to program a working rubiks cube here in godot.
I know i can create a bunch of meshinstances with cubemeshes inserted and stack them into a big 3x3x3 cube.
But how can i make some of theese pieces rotate as a group around the group-center
and than sone of theese pieces rotate around another axis together with other pieces as another group?

i want to rotate a face of the cube by clicking it´s center-piece.

Right off, I would dynamically add the cubes to a parent node (Spatial) that is positioned at the rotation point you want to spin the pieces around (like the top center), perform the rotation by rotating the parent (which will rotate all the children), and then un-parent the nodes so they no longer are manipulated by the parent node’s rotation anymore. I’m not sure how feasible this is though, but that is what I would try if I was trying to make a rubics cube.

i´m not sure, if they stay at the rotated positions while un-parent them.

And how can i make the systen detect a click on the middle square of a cube-face to trigger rotation

    4 days later

    Now twisting one face works, but if i twist another face on another axis than, one corner-piece of the edge, that belongs to both twists is not re-parented for twisting this time.
    Which one it is, depends on the direction of the first twist.

    It seems, that the reason for this are not hidden inaccuracies in the translation values, because it also happens, if i cast the translation value to an int for comparing.

    I tested this with this print-command:
    print(cubie.name, ": ", offset, " = ", cubie.translation.x, " -> ", cubie.translation.x == offset)
    Output for the not re-parented piece:
    Cubie1: 1 = 1 -> False
    Which one it actually is, depends on the rotations on the first chosen axis.

    Here is the repository of my project:
    Rubiks_Cube githup