This program animates a space rocket and camera moving along animator controlled curves in 3D space. The animator is able to interactively control acceleration, velocity, and position along the path as well as orientation. Written in C++ and uses the QT application framework.
The following video shows the program animating in both the editing view and from the point of view of the camera.
The animator adds keyframe frame nodes to the curves by clicking the Add point to Rocket Spline and Add Point to Camera Spline buttons. Nodes are added to the end of the corresponding curve at a position near the last node on the curve.
The animator is able to view the animation from either the view in the editing window or from the view of the camera curve. Clicking the Animate button starts the animation. Any mouse input or keyboard input during playback will stop the animation and take the user back to the editing window.
The velocity slider controls the maximum velocity of the rocket ship. The acceleration slider controls how fast the rocket accelerates to its maximum velocity.
Figure 1. Editing Interface
This program features the ability to edit orientation and preview the animation within the 3D perspective window.
Use the left mouse button to select and edit a keyframe node. Clicking the right mouse button will deselect the node.
To edit the position of a node, click and drag one the axis aligned handles to move the node in the direction of the corresponding axis.
To edit the rotation of a node, either click and drag across the screen to rotate about an arbitrary axis or click and drag one of rotation axis' to rotate about the corresponding axis.
Figure 2. Editing Position and Rotation of a Node
While no nodes are selected, hover the mouse over one of the curves to view where the rocket ship and camera would be at that point in the animation. A virtual screen displays where the rocket ship would appear on a screen from the point of view from the animation camera.
Figure 3. Animation Preview
The editing view camera is controlled using keyboard input:
W/S - Move forward/backward in the direction of camera
A/D - Move camera left/right
T/G - Move up/down along camera's up vector
Q/E - Rotate camera left/right (about up vector)
R/F - Rotate camera down/up (about right side vector)
Z/X - Roll camera left/right about its direction vector
Catmull-Rom Splines are used to interpolate position between keyframe nodes. The splines are parameterized by arc length along the curve.
Quaternions are used to interpolate between keyframe rotations using the spherical linear interpolation method (SLERP).
The arcball algorithm is used to rotate a node through the 3D perspective window.
Filename |
Description |
---|---|
quaternion.cpp | Implements the Quaternion data structure |
catmullromspline.cpp | Data structure for interpolating position along a curve controlled by keyframe positions |
camera3d.cpp | Interface to control perspective and movement in the 3D scene |
arcball.cpp | Implements arcball method of rotation from the 3D perspective window |
translationnode.cpp | Interface for controlling the position of a keyframe node from the 3D perspective window |
splinenode.cpp | Combines ArcBall and TranslationNode to implement an interface for controlling and storing both translation and rotation of a keyframe node. |
splinenodeset.cpp | Manages set of SplineNode keyframe nodes for a curve. |
orientationcurve.cpp | Uses a SplineNodeSet along with a CatmullRomSpline to generate data to query the position and rotation of a keyframe node at a point on the curve. |
virtualcamera.cpp | Draws a virtual screen in the editing window to show the user where an object would be located in the animation view. |
spaceship.cpp | Data for drawing the space rocket model |
cameramodel.cpp | Data for drawing the camera model |
utils.cpp | Contains miscellaneous shared functions |
Download for QT 5.3.0: Animator Controlled Curves Program
Source: https://github.com/rlguy/animatorcontrolledcurves