I'm currently working on a Rubik's cube project in WebGL. I have successfully created 27 small cubes that come together to form one large cube. However, I am struggling with how to rotate specific groups of cubes based on their position rather than by individual names. Since the cubes are constantly changing positions, I need a dynamic method to identify and manipulate them as needed. Any advice on how I can achieve this? Is there a way to select and rotate a group of cubes based on their relative positions within the larger cube structure?
At this point in my code, I have only managed to create the individual cubes and assemble them into the larger cube shape.
Your assistance would be greatly appreciated. Thank you in advance.