Behaviour of <rigid_constraint>s and <instance_rigid_body>s


I am implementing an import/export module to COLLADA Physics and have a problem with <rigid_constraint>s. The <attachment> and <ref_attachment> refer to a <rigid_body> specifically. But as I understand it, a given <rigid_body> can be instantiated multiple times in a scene. This poses a conflict, since a constraint doesn’t make much sense anymore if it links more than 2 bodies, imho.

What behaviour is intended? Should the attachments refer to <instance_rigid_body>s instead? Is it illegal to use other than 1 instance when a body is constrained?

Less urgent question: If a <rigid_body> is part of a <physics_model>, which is instantiated in a <physics_scene>, but it there is no corresponding <instance_rigid_body>, is the body part of the scene anyway (without any modifications?) Currently I’m implementing it as not, since this wouldn’t fit conceptually with multiple instantiation, but I’m not sure.

I would greatly appreciate it if someone could clarify this for me.

COLLADA is declarative and does not mandate any particular method or rule for instantiation. Instantiation is application defined as to how much of the representation is shared or copied between instances.

No, the description is declarative showing the relationships defined by the author of the content. How an application instantiates that description, and how many times, is left to the application (use-case). Since physics engines are not standardized, the <instance_rigid_constraint> element has a child <extra> element in which to describe per-instance data (overrides).

Yes, in that case it is an inline or embedded declaration. This is as opposed to declaring things in library elements and instantiating them in the appropriate places.

Think of the declarations in the document as prototypes (Builder Design Pattern) or templates from which you instantiate the objects you will actually manipulate in the application.

I hope that helps.

Thank you for the answers.