# How to animate a cube pivoting more than once without affecting it's original position

Hi I'm in desperate need of help, I'm creating an animation for a Magic Cube.

This video shows what I need to create

So far I have been able to move the pivot of a cube one way and then again another by using an armature and an empty, however because these are now linked up I cannot figure out how to move the cube another turn

http://i33.photobucket.com/albums/d8...19at162154.png

here demonstrates the point i'm at, I have place empty cubes to show where I need the actual cubes to be, however if I attempt to link them the original position has changed. Is there anyway I can animate these cubes rotating with the one above them?

I'm new to Blender and have had to learn after using 3Ds max for a while I'm struggling a lot would really appreciate the help please! Also I hope this makes sense...

• The image link is broken, maybe incomplete, please check. – Leon Cheung Feb 19 '14 at 17:23

One way is to do this with help of empties. to parent them one after one:

For example, in the GIF below, D (the cube) is parented to empty C; C is parented to B; B is parented to A, which is the top-level parent here ("great-grandfather" :P). Then, insert keyframe for C, B and A in turn.

By using this method, the hierachy should be well planned before parenting, based on the expected rotation orders.

You may also want to replace the empties with armature of bones. You can see the hierachy better in this way since bones have head and tails, though a bit more complicated.

P.S.: For a pivot-switchable animation like this(especially with rotations), which can be really tricky, you have to find a way to control the pivots (better to be "pivot objects") to have them in position in time.

A driver based approach

In answer to Rolling cube animation. How to? which is marked as a dupe of this question, although I'm not too sure...

The cube is given a speed custom property, ie how many frames to move 1 blender unit.

location.x is driven by (frame / speed) where frame is current frame, speed is the custom prop.

rotation.y is driven by frames * radians(90) / (w * speed) w is the side dimension of the cube. The cube will "roll" 90 degrees every w * speed frames.

location.z is driven by abs(cos(var) * sin(var)) var is the cube's rotation.

• What you have to change in parameters if instead of cube you have a brick for example? – Stan von Zarovich Nov 27 '15 at 9:58
• Simple case is scaling on y. The driver is set up to rotate 90 degrees by the time it has travelled the width of the square edge it is "rolling" on. Lets say for instance every 10 frames it travels one side's width, and hence rotates 90 degs, and steps up in middle on pivot. Same would apply for a non regular brick w x b x h rolling on w x b would need a switch to rotate 90 in time to travel w frames when stepping on w, then rotate 90 when in b frames, based on the angles step w for (0, 90), step b for (90, 180) etc btw there's something strangely hypnotic about rolling cubes. – batFINGER Nov 27 '15 at 12:55

You might use a pivot constraint.

The Child Of constraint might be interesting as well.