specific collada file failure

Physics APIs, Physics file formats, Maya, Max, XSI, Cinema 4D, Lightwave, Blender, thinkingParticles™ and other simulation tools, exporters and importers
DrakkenWulf
Posts: 4
Joined: Sat Jan 05, 2008 8:20 am

specific collada file failure

Post by DrakkenWulf »

I'm in the first stages of a new project, and am having a terrible time getting things to work. I've enclosed a sample collada file. Dropping it into the 2.66A version of ColladaDemo, I cannot get the two dice to collide and then just sit on the larger box below them. I've tried subdividing the surfaces, exporting them as boxes only, all to no avail. Dice each have mass 1.0, and the box is 'static' (has mass 0.)

I really don't want to back out and move to a different engine. Any suggestions?

The 'full' version entails the dice colliding with the tabletop area, as well as the walls of the craps table. That was failing too, hence why I went to test versions.
You do not have the required permissions to view the files attached to this post.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: specific collada file failure

Post by Erwin Coumans »

The collada file has extremely large gravity: <gravity>0 -980 0</gravity>
Bullet collada importer doesn't apply the <unit meter="0.01" name="centimeter"/> at the moment, so please avoid scaling, and use 1 unit = 1 meter.

If you manually change gravity to 9.8 it works much better, please check attached file.

Hope this helps,
Erwin

Some general tips to avoid instable simulations: avoid scaling, make sure dynamic (moving) objects are not smaller then 0.2 units in any direction, avoid large mass ratios.
You do not have the required permissions to view the files attached to this post.
DrakkenWulf
Posts: 4
Joined: Sat Jan 05, 2008 8:20 am

Re: specific collada file failure

Post by DrakkenWulf »

Thank you for your prompt reply. The gravity value was the default from the ColladaMaya exporter, was not aware it was off by so much. After fixing that and splitting some polygons up to more naturally match my dice, the full version of the scene is now working again.

To others using the ColladaMaya tools: be sure to 'freeze' any non-translate and rotation transforms before exporting. I had a scale transform applied to the dice and that is lost during conversion. Also, have been having a lot of problems getting some objects to show up in the right places from the bullet demos. Turns out that ColladaMaya is not exporting the center of mass information at all, and even if you try to fix it in code it won't work.

Also, had more success getting btConvexTriangleMeshShape to interact with a btBvhTriangleMeshShape than i did with a seemingly simpler btBoxShape.

I'm attaching a sample file, in case anyone wants to use it as a test case. Note how you have to rotate the camera *down* to see the tabletop *above* the dice, even tho the original model has the floor below them. The origin of the tabletop is the world origin, but that is getting confused on import.
You do not have the required permissions to view the files attached to this post.
DrakkenWulf
Posts: 4
Joined: Sat Jan 05, 2008 8:20 am

Re: specific collada file failure

Post by DrakkenWulf »

More stuff I've learned, for others to make use of.

The collada importer really does need to take into account the visual node transforms in order to get output from ColladaMaya to import properly. The physics description does not include the full information needed, things will be offset in odd ways.

Also, if your initial btTransform is given a scale as part of the transform, it breaks the collision detection. This is *not* a bug, as you should clean your transform before sending it to btTransform. Once I cleaned the transform (normalizing the rotation part of the matrix) and applied the 'leftover' scale to the original vert points (during shape creation) the dice hit the table perfectly!
melax
Posts: 42
Joined: Mon Apr 24, 2006 4:55 pm

Re: specific collada file failure

Post by melax »

Erwin Coumans wrote:The collada file has extremely large gravity: <gravity>0 -980 0</gravity>
Bullet collada importer doesn't apply the <unit meter="0.01" name="centimeter"/> at the moment ...
The collada wrapper appears to scale most everything to be in meters. For example when creating a sphere it gets the radius as follows: domFloat radius = radiusRef->getValue()*m_unitMeterScaling;

It might be hard to prevent people in the future from exporting a collada file in some other unit system or scale. This inital problem could be fixed by also applying the scaling to the gravity value that is read from the collada file. Refer to line 310 of extras/bulletcolladaconverter/colladaconverter.cpp .
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: specific collada file failure

Post by Erwin Coumans »

Good point Stan, we should fix that.

By the way, we have been improving COLLADA Physics support for upcoming Bullet 2.67 version.

It will be possible to take an arbitrary Bullet dynamics world, attach the ColladaConverter and export a snapshot to .dae.
It supports collision geometry, rigidbodies and generic 6dof constraints. So you can use Bullet API to create COLLADA Physics content, without needing to digg into the COLLADA DOM etc.

I haven't played with this feature yet, my collegue wrote it. It would be nice to add 'export .dae' and 'import .dae' buttons in the Bullet demos.

It should help with debugging and reproducing problems, without having access to the full source code.

Thanks,
Erwin