Animation Nodes Rubik's Cube I am trying to create a Rubik's Cube using the Animation Nodes addon. The aim is to be able to make a specific sequence based on a custum group node system.

They could be a node for each individual action, like turn the top. (you are going to have the option to turn it left or right with a boolean option).

The main problem to solve is how do you know which cubes to move when you make an action? I solved this problem with no errors by making a custom group recognizing the layers depending on the positions of each cube.



This does work really well but the problem I currently have is I am not really used to use the an matrices. I tried to make a prototype in order to make the layer rotate around the center, but the problem is the animation seems to cumulate on each frame and you can't go back by returning to the first frame.

[

If you could help me to find a solution for my non knowledge of the matrix system this would be really helpful.

Maybe the approach I am using to create this is not the most efficient one...



Edit

I tried my best to fix the matrix problem and found an other approach which is parenting every cube of a face / layer to the center cube of the layer (unlike the real Rubik's, there is still a center cube in order to control mid layers).

I created this custom node group, and when I animate the rotation of a center cube after linking the correct cubes to it, it works well!

But if I try to make it a group and then put two one after the other, the animations get cumulated, and you have both of the rotation occuring at once. Also this make the rotation of the linked cubes happen a strange way, and I didn't figure out why. 



I provided some text help in the blend file to help you understand the project without going through each individual node because the project is a little bit complex now.
Here is my solution:




 (updated to v3.5)

How to Use:

-First, download and install Animation Nodes v1.6 from here.

-Open the file, DIY your own sramble and solution notation list in Text Editor.

-Tweak parameters on Settings node if needed, then play animation.

Advantages:


Use standard move notations to control moves.
Allow playback.
Solvable (any move is pre-calculated).
The whole cube is parented to a root object for additional transformation control.
With a few more additional features for convenience.


Basic Idea:

First, generate a sequenced euler list by the notations read from textblock(s) for each move.

Second, generate bool list for each unit to decide whether it should be rotated according to the notation during each move (e.g. when notation is U, it means only the top layer will be moved, while the mid layer and bottom layer will keep still).

For the unit objects, a custom property called Position ID is implemented, which indicates the exact position of each unit right before next move starts. After moving(rotating), the Position ID will be overwritten by a new one according to the new position.

[TBC..]