# How To Move A Rubick's Cube (Constraints?)

I want to make a simple game with this model I uploaded to BlendSwap… http://www.blendswap.com/blends/misc-objects/rubick-s-cube/
I have no idea how to go about doing this… I tried using the shape keys function, but there was some heavy distortion going on… I am not very well versed in using constraints, but I have a feeling that it would be possible to make this cube functional using this process. Can somebody please help me?

### Attachments

If you wanted to do this in the game engine you could set something up with near sensors, that would set parents. Make each part of the cube a separate object. make a sensor object for each of the six sides of the whole cube.
Each piece of the cube will need to detect which side of the cube it’s currently shifted to so you will need to place a near sensor on each piece of the cube for all six sides. Consider setting up your controls then separating it into the separate pieces so the controls will be on the duplicates.
The theory is you can have six objects animated to turn the pieces of the cube that are near them. The individual pieces of the cube will need to be parented by the near sensor so they will only turn when they are meant to.
It’s starting to get complicated in my head and I’m really just brainstorming. I think it’s very doable though.

I suggest following:

• each cube is separate
• have a “rotator” in the middle (empty)

when you want to rotate a slice:

• parent all cubes of the slice to the rotator
• rotate the rotator (with action or motion)
• unparent the parented cubes
• check for winning condition

You have to design following tasks:
UI
-how to provide the slice to be rotated (e.g. via mouse click)
-how to provide the rotation direction (e.g. via mouse click)
Logic:
-how to identify cubes of a slice e.g. via collision sensor at an (invisible) sensor plane
-how to identify the winning condition

I hope it gives you an idea

i have made small exemple for blender 2.48

http://blendercave.tuxfamily.org/?page=objet&id=240

I do not think that will be difficult to adapt to the 2.62