## Rotations

A problem that has existed since the birth of computer graphics is one of interpolating the intermediate frames from given key frames that control rotation. For example, if you have three key frames which represent camera orientations of front, top, and back, you'll typically get a sudden jump as soon as the camera reaches or even passes close to the top position. This problem is caused by the fact that the polar coordinate system has singularities at the north and south poles. Rotation curves, which look very smooth and beautiful in the curve editor, are totally incapable of producing nice, smooth rotations in 3D space.

Realsoft 3D solves this problem by using advanced Quaternion interpolation for rotations.

The orientation of an object is controlled through three rotation angles called heading, pitching, and banking. Defining any orientation for an object through these three angles is easy and intuitive.

Let's see how well this quaternion system can solve the following well-known rotation problem:

Tutorial level: Medium

Example project: 'animation\rotation\rotating cube'

1. Switch to the front view and create an analytic cube. Activate animation recording.

2. In frame 20, rotate the cube 90 degrees in either direction. To get accurate 90 degree rotation, hold down the Shift key while dragging the rotation handle. This activates the angle grid.

3. Switch to the side view, move to frame 40 and rotate the object 90 degrees.

4. Switch to the top view, move to frame 60 and rotate the object 90 degrees.

Now, reset animation recording and play the animation. As you can see the cube rotates nicely through all defined key frames exactly the way you would expect.

So, it looks like this quaternion interpolation system can handle rotations intuitively. However, there is one minor drawback with this system.

 5. Open the choreography window, click the Poperties tab and select the Rotate Quaternion attribute. The three curves that define the heading, pitching and banking angles look very wild and may even contain sudden jumps. Heading, pitching and banking curves generated by Quaternion interpolation

The explanation for these crazy curves is that the heading, pitching and banking angles simply must jump around to produce a natural looking rotation in 3D space! These strange curves really represent the rotation angles. The problem is that it is difficult to edit these curves in a sensible way.

### Euler angles

The quaternion interpolation system produces superior rotations, and is therefore, the default method used. To use the more standard Euler angle interpolation method, check the Rotate in HPB check box in the Gen tab of the property window of your object.

Note You have to set this option before you animate your object.

### Rotating in lattice space

Another way of controlling rotations is to define an axis, and then an angle, which defines how much the object is rotated about the axis. You can do this using the lattice mapping system. The basic idea is the same as for path animations, the difference being that the object is now rotated in lattice space instead of translated.

To illustrate this, we'll create a cube that rotates around a NURBS curve.

Tutorial level: Medium

Example project: 'tutorprojects\animation\rotation\rotate in lattice space'

 1. First create a cube, and then a NURBS curve which defines the rotation axis. 2. Select the cube and the axis (in this order) and activate Lattice Mapping/Rotate from the toolbar. Specify a rotation angle to the Angle field on the control bar and click Accept. 3. Play the animation and the cube rotates about the axis object. Set up a rotation in lattice space

One benefit of using this method is that you can now animate the axis, which is a normal geometric object. For example:

4. Activate animation recording and move the time slider to the last frame. Rotate the axis 30 degrees (any direction is fine), and move the axis to a new position.

5. Play the animation. The cube rotates about a moving and rotating axis object.

As an alternative to using the Lattice Mapping/Rotate tool, you can also use the Lattice Mapping/Map tool and then animate the Lattice Rotation attribute manually in the choreography editor.