Rigging Guide
Overview
The Rubik's Cube node is designed to integrate into a standard Maya rig with as few requirements as possible.
The node does not assume a particular hierarchy, control type, or rigging methodology. Instead, it interprets the connected inputs within the context of the cube, allowing the surrounding rig to be organized in whatever manner best suits the production.
Only a small number of connections are required for the node to function.
Creating the Node
Create a rubiksCubeNode and specify the desired cube size.
node = cmds.createNode(“rubiksCubeNode”)
size = 3
cmds.setAttr(f”{node}.size”, size)
The node exposes three arrays of layer controls:
rowRotation
columnRotation
sliceRotation
Each array needs size number of inputs.
The node assumes:
Row controls rotate about the Y axis.
Column controls rotate about the X axis.
Slice controls rotate about the Z axis.
The source of these values is entirely up to the rigger. They may come from transform rotations, custom attributes, utility nodes, or any other network that produces a numeric value.
The cubelet outputs are provided as the array outOffsetParentMatrix. There are (size)³ - (size-2)³ number of outputs. Connect each output matrix to the offsetParentMatrix of the objects representing cubelets. The cubelets should have no data in their transformation channels with their transformation being driven entirely through the offset parent matrix.
The last required connection is the rigRoot message attribute. Connect the message attribute from the object being used as the rig root control. This connection allows the Save/Load tool to find the rubiksCubeNode when the root control is selected.
No additional constraints or space-switching setup is required.
Rig Hierarchy
The node does not require a specific control hierarchy.
The only requirement is that every cubelet belongs to the same local coordinate system.
Suggested Control and Hierarchy Layout
Although the node accepts any source of numeric values, a conventional control layout provides the most intuitive animation experience. As such, it is recommended to place controls at each row, column, and slice that the control affects and use the appropriate rotation channel for the inputs on the node.
The index of the layer rotation input indicates which row, column, or slice is affected by that input.
For odd size cubes, the layer coordinate corresponds to:
layer[index] = index - (size-1) / 2
For even sized cubes, the layer coordinate corresponds to:
layer[index] = index - 0.5 - size / 2
with the column layer corresponding to the X coordinate, row to the Y coordinate, and slice to the Z coordinate
The controls and cubelets can then be parented under the root control, providing a constant relationship between the controls and cubelet layers.