This demo illustrates how a spline path from 3ds max may be used in Papervision 3D with the Singularity 3D Bezier spline. The example 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 using PV3D primitive objects. This makes the example code easy to work with, but visually unimpressive. A simple MAXScript was written to export spline data from 3ds max to XML. The Flex program reads the XML data (E4X is really cool), using the information to set CV and tangents in the 3D Bezier spline. The MAX-generated spline is illustrated below.
The spline data exported from 3ds max is
<spline name='Line01' knots='7' closed='true'>
<knot x='-123.018' y='53.5028' z='0.0'>
<invec x='-154.627' y='16.1465' z='0.0' />
<outvec x='-91.4084' y='90.8591' z='0.0' />
</knot>
<knot x='-7.033' y='88.4169' z='-91.3649'>
<invec x='-77.1479' y='83.8192' z='-91.3649' />
<outvec x='63.0819' y='93.0146' z='-91.3649' />
</knot>
<knot x='110.694' y='89.7132' z='0.0'>
<invec x='80.1177' y='107.975' z='0.0' />
<outvec x='141.27' y='71.4514' z='0.0' />
</knot>
<knot x='161.098' y='-13.6597' z='0.0'>
<invec x='166.459' y='30.5072' z='0.0' />
<outvec x='155.736' y='-57.8267' z='0.0' />
</knot>
<knot x='61.2687' y='-93.0454' z='-91.3649'>
<invec x='100.924' y='-86.7235' z='-91.3649' />
<outvec x='21.6135' y='-99.3672' z='-91.3649' />
</knot>
<knot x='-49.5287' y='-89.2301' z='-91.3649'>
<invec x='-2.977' y='-116.816' z='-91.3649' />
<outvec x='-96.0804' y='-61.6439' z='-91.3649' />
</knot>
<knot x='-154.02' y='-41.2029' z='0.0'>
<invec x='-145.71' y='-73.8184' z='0.0' />
<outvec x='-162.33' y='-8.58747' z='0.0' />
</knot>
</spline>
Two cameras are placed in the PV3D scene. The first camera (static view) allows a marker to be visualized moving along the path. Since the Cubic Bezier spline supports arc-length parameterization, the marker moves along the path at constant velocity. The second camera is animated and looks at the origin from the point of view of the maker.
Click the 'Animate' button to begin the animation. Switch between the two cameara views by clicking on the 'Observe Marker' or 'Observe Origin' buttons.
This example requires the Flash™ 9 player.
|