views:

480

answers:

2

Hi,

I'm trying to use Papervision for Flash, for this project of mine, which involves a 3D model of a mechanical frame, consisting of several connected parts. Movement of one of the parts results in a corresponding change in orientation and position of other parts of the frame. My understanding is that using a scene graph to handle this kind of linked movement would be the ideal way to go, at least, if I were to implement in one of the more established 3D development options, like OpenGL or DirectX. My question is, is there an existing scene graph implementation for Papervision? Or, an alternative way to generate the required 3D motion?

Thank!

+2  A: 

I thought Papervision is basically a Flash-based 3D rendering engine, therefore should contain its own scene graph.

See org.papervision3d.scenes.Scene3D in the API.

And see this article for a lengthier explanation of the various objects in Papervision. One thing you can do is google for articles with the key objects in P3D, such as EngineManager, Viewport3D, BasicRenderEngine, Scene3D and Camera3D.

As for "generating the motion", it depends on what you are trying to achieve exactly. Either you code that up and alter the scene yourself, or use a third-party library like a physics library so as to not have to code all that up yourself.

alphadogg
A: 

You can honestly build one in the time it would take you to search for one:

Create a class called Node with a virtual method Render(matrix:Matrix), which holds an array of child nodes. Create a subclass of Node called TransformNode which takes a reference to a matrix. Create a subclass of Node called ModelNode which takes a reference to a model.

The Render method of TransformNode multiplies the incoming matrix with its own, then calls the render method of its children with the resulting matrix.

The Render method of ModelNode sends its model off to the renderer at the location specified by the incoming matrix.

That's it. You can enhance things further with a BoundsNode that doesn't call its children if it's bounding shape is not visible in the viewing frustum.