You will use the properties of a primitive cube’s pivot point to animate it rolling on its edges. This process will involve the use of the Channel Control window to make certain attributes keyable. Once they are keyable, they will be available in the Channel Box for you to set keys and edit their value. In this lesson, you will also use the Graph Editor to refine the animation curves to get exactly the kind of motion that you need.
Place a primitive poly cube into the scene and scale it to X=2, Y=2 and Z=2.
Select the Move tool and place the front of the cube at 0 along the Z axis (Z=-1).
Press the Insert key to go into edit mode and then move the pivot point to the middle of the cube’s front bottom edge.
You may want to use grid snapping to help you position the pivot.
Now press the Insert key to return to the Move tool then move the cube to the origin. (Y=1)
Select Display -> Transform Display -> Local Rotation Axes and Rotate Pivots. These icons will help you visualize these components as you begin animating the pivot.
Select Window -> General Editors -> Channel Control and select the following non-keyable attributes:
Rotate Pivot Translate X
Rotate Pivot Translate Y
Rotate Pivot X
Rotate Pivot Y
Use the Move button to make them keyable attributes. They will now appear in the Channel Box.
With the cube selected, set a key for Z rotation at frame 1.
Go to frame 10 then set Rotate Z to -90 and set another key.
Return to frame 1. Select the Rotate Pivot Translate X, Rotate Pivot Translate Y, Rotate Pivot X, and Rotate Pivot Y in the Channel Box then use your RMB to choose Key Selected.
Go to frame 10.
Open the Attribute editor and select the pCube tab.
Expand the Pivots section.
Expand World Space section.
Set World Rotate X Pivot to 2. You should notice that the pivot moves to the front of the cube. Now you can continue rotating the cube.
In the Channel Box, set a key for the Rotate Pivot Translate X, Rotate Pivot Translate Y, Rotate Pivot X, and Rotate Pivot Y channels.
Editing the World Rotate Pivot in the Attribute Editor affects these four attributes therefore they must all be keyed.
Go to frame 20.
Set another linear key frame for a Rotate Z to -180. Set the World Rotate Pivot to 4 then set keys for the four pivot channels in the Attribute editor.
If desired, keep rotating the cube and moving the pivot using the steps outlined above. If you playback the animation at this point, the roll of the cube will not seem correct. You need to change the animation curve tangents for the pivot attributes.
The incorrect motion is because the pivot point needs to stay in one location for 10 frames then jump to its new location.
Open the Graph Editor.
Select the four pivot action curves
Select Tangents -> Stepped.
This will create the desired results.
Source Link :)