Instaniation of Instantiations of Instantiations

I wanted to add support for the instantiation of physics models to my code. At first I thought I had found a design flaw in COLLADA but, now, I don’t think so.

I was able to get it to work, but it wasn’t very obvious.

Currently you define a ‘physics_model’. Then, you typically instantiate individual rigid bodies and contraints within physics models from a physics_scene.

However, I coudln’t figure out how to instantiate a physics model from a physics model. Until I realized that the physics model has to be able to hold instantiations itself. In other words a physics_scene and a physics model are just two forms of the same thing.

First you define the source physics model. Then you have to define a new physics model that instantiates all of the rigid bodies and constraints within the model. Finally, in the physics scene you instantiate the instantiation model giving it a parent transform.

It does in fact work, but it hurt my head to get it figured out.

Here is a sample file that defines a jenga stack, then defines an instantiation of the jenga stack and finally, instantiates the jenga stack three times relative to different nodes.

I thought the test case might be useful to somebody else as well.

http://www.amillionpixels.us/jenga.dae