Online Example::Path Animation with Catmull-Rom Spline and Papervision 3d

This is a simple example illustrating how to use a Catmull-Rom spline for path animation wih Papervision 3D. It was generated using the PV3D 1.5 release. Working with the source code requires a bit of prior knowledge of how to use PV3D with FlexBuilder.

The example is distilled down to a very simple level. This makes it easy to work with, but visually unimpressive. A sphere and some axes are placed at the origin of 3D space. A series of knots is defined in the MXML file. When the scene is initialized, red cubes are placed at these knots. The array of knots is used to initialize control points of the Catmull-Rom spline. Arc-length parameterization is used to animate along the path with constant velocity.

A green sphere is placed at the first knot. Click the 'Animate' button to watch the sphere move along the 3D path.

This example requires the Flash™ 9 player.

You need to upgrade your Flash Player

This example requires the Flash™ 9 player.

For further reading,

:: Catmull-Rom Splines - An introduction to Catmull-Rom Splines.

:: Arc-Length Parameterization - Introduction to curve parameterization and how to reparameterize a curve on arc length. Techniques applied to a Catmull-Rom spline. Examples include how to distribute sprites evenly along a curve and path animation (including path following and orientation).

:: Arc Length of a Catmull-Rom Spline - Arc Length of parametric curves and derivative evaluation, applied to Catmull-Rom splines.

Source Code. Download the Singularity package (this example is in Singularity/demos/P3D/P3DTutorial.mxml). You must install the PV3D 1.5 code and make sure the Canvas3D.as file is in the org.papervision3d.flex folder. The SimpleSphere.as file must be placed in the org.papervision3d.examples folder.

You may obtain more PV3D AS3 example source from the SVN repository.