Can't export rigidbody physics as simple shapes :|

Hello,

I am trying to export physics data (specifically rigid bodies) from my Maya scene using the new COLLADA 1.4 spec. I’ve gotten it to basically work, however I noticed that the geometry of my scene (basically a sphere, cylinder, and box created as Polygons) are all exported as <meshes>
Any ideas? Below is a snippet of my current output:


<rigid_body sid="rigidBody2">
   <technique_common>
      <shape>
         <physics_material url="#rigidBody2-PhysicsMaterial"/>
         <geometry url="#pSphereShape1-lib"/>
      </shape>
   </technique_common>
</rigid_body>
...

<geometry id="pSphereShape1-lib" name="pSphereShape1">
   <mesh>
     <source id="pSphereShape1-lib-Position">
      <float_array count="1146" id="pSphereShape1-lib-Position-array">
(lots o' points follow)

Is there any easy way to tell it to export the shapes as simple primitives (e.g. <sphere>, <cylinder>, etc.?)

Thanks in advance,
Joey

Specs:
Maya 7.0 / ColladaMaya0.89 / COLLADA 1.4

Hey Joey, your post looks lonely so I figured I’d try to help. I’ll warn you in advance though that I’ve never really used Maya, so everything I’m about to say may be wrong.

I took a look through the ColladaMaya code (open-source for the win!) and it seems to want a “stand-in” attribute to be defined on the Maya object, otherwise it’ll directly use the mesh geometry for the rigid body instead of an analytical shape. I created a sphere in Maya and set it as a rigid body, then went to the “rigidBody1” tab in the object property browser thing and saw that in the “Performance Attributes” category there’s a stand-in drop-down that you can set to none, cube, or sphere. Maybe if you use that you’ll get the analytic shape you’re looking for. I can’t test it myself since I’m using Maya PLE and it won’t let me export to Collada (or any other format for that matter).

If that’s not it, I’m sure Christian Laforte of Feeling Software will be around eventually to point you in the right direction. Good luck.

  • Steve

The solution is to use Nima, which is a free plug-in (available from the Feeling Software web site) that integrates AGEIA’s PhysX engine inside Maya. ColladaMaya knows about Nima and will export its analytical shapes as <capsule>, <sphere>, <box>, etc. Nima also supports a bunch of additional features that are useful in COLLADA, such as 6-dof constraints.

Hope that helps,

Christian

BTW, Steve was right: there is code in ColladaMaya that supports native rigid dynamics, and in theory it should still support stand-in shapes (sphere and cube IIRC). It’s very limited though, so I highly recommend using Nima.

One final thing: it’s not very well documented, but you may need to install PhysX 2.4.1 from the AGEIA web site prior to installing Nima beta 5. PhysX 2.4.1 is a free download: go in AGEIA’s Developers->Downloads section.

Hey guys, thanks for your responses! Steve, I tried your Performance Attribute advice earlier, and was able to get other basic shapes exported, but as was alluded to, it was a somewhat limited (i.e. I could only represent a box as a perfect cube)

The Nima option sounds like a good idea, though I’m wondering if there might be a problem. Right now, we’re using Havok for our physics. While it does have its own exporter for generating collision data, our pipeline is strongly commited to COLLADA, for which it doesn’t appear that they support (it only generates a binary or its own unique xml) (I noticed that when I tried exporting the Havok-created rigid bodies from Maya, they didn’t register at all in COLLADA, unlike the rigid bodies created directly with Maya Dynamics)

I’d love to use the Nima plug-in to generate the COLLADA data, but is it still possible using that to export the whole model as one COLLADA file including physics data (apart from running a separate exporter for the physics info?) One requirement of our process is read in only one COLLADA file per model, and later generate a game asset for it, using a custom tool. This is why I was hoping that there’s only one file export necessary.

Oh, and the other step was to later translate the COLLADA back into a format that the Havok API can easily digest. This may sound complicated, but so far it seems like the only way to get the physics data through our pipeline…does this approach sound reasonable?

Thanks again!
Joey

I’m sorry to hear about your trouble. I guess you’ll have to bug Havok, since they are the ones at fault here. We invited them many times to participate in the COLLADA Physics initiative and they didn’t. Contrast this with AGEIA, which participated actively and even sponsored the development of Nima and ColladaMaya’s physics export capability.

Someone with a lot of time and expertise in the Maya API could conceivably modify Nima to integrate Havok instead of PhysX, but be prepared for a lot of work. Otherwise, you can also try modifying ColladaMaya, which would be easier… but we at Feeling Software are not going to do that anytime soon, since Havok costs a lot of money and hasn’t shown any interest in our work.

Havok has participated in the COLLADA specification, they also have told me personally that they will be supporting COLLADA as input format as soon as one of their customer is asking for it.

So, please, open a bug/request to Havok regarding COLLADA support. Please let me know if you are having difficulties. (you can email collada ‘at’ collada.org)

I’d love to use the Nima plug-in to generate the COLLADA data, but is it still possible using that to export the whole model as one COLLADA file including physics data (apart from running a separate exporter for the physics info?) One requirement of our process is read in only one COLLADA file per model, and later generate a game asset for it, using a custom tool. This is why I was hoping that there’s only one file export necessary.

I do not see why you cannot have one single file with all the information.
Christian, is there a problem with this ?

Oh, and the other step was to later translate the COLLADA back into a format that the Havok API can easily digest.
Joey

It really does not matter what physics engine is used inside your DCC tool, since the COLLADA Physics is designed to work with any physics engine.
As I said, Havok told me they will support COLLADA as soon as their customer ask for it. You can always switch to another physics engine if the one you are currently using does not match your content pipeline.
I would be surprised if Havok does not help you with COLLADA, since one of their main value is to make tools that fit within their customers pipeline.

I do not see why you cannot have one single file with all the information.
Christian, is there a problem with this ?

Sorry, I originally missed that sub-question. :wink:

To make it clear: ColladaMaya will produce one file by default when exporting, and that file will include the regular scenegraph, the COLLADA Physics content, the COLLADA FX content, etc.

The use of Nima is suggested because this is the only way to expose many of the COLLADA Physics concepts in Maya. Maya’s native dynamics are too limited. That said, as Rémi pointed out there’s nothing to prevent you from importing COLLADA Physics into any physics engine of your choice. That’s why the COLLADA Physics common profile exists: it was designed as a good subset of what PhysX, Havok, ODE and Bullet supported.[/quote]

Thanks again for all of the helpful advice. I will communicate with Havok soon to find out what exact support they provide. I guess it’s a two-part issue, one is exporting the Havok content to COLLADA, the other is checking to see if they have any kind of COLLADA loader/converter for reading in the the physics data at run-time

(BTW, I don’t remember if I mentioned it earlier, but we’re only using the rigid bodies in Havok, just for simple collision detection, nothing more)

Thanks,
-joey

Then the common COLLADA physics should work fine for you.
You just need Havok to provide with a COLLADA loader, or a COLLADA converter.

You do not need to export the Havok content to COLLADA, you should be fine using NIMA with COLLADA-MAYA directly (you do not need the Havok maya plug-in)

Regards