Loading a .bullet file, creating objects

Physics APIs, Physics file formats, Maya, Max, XSI, Cinema 4D, Lightwave, Blender, thinkingParticles™ and other simulation tools, exporters and importers
Post Reply
jrk
Posts: 17
Joined: Tue Aug 18, 2009 2:48 pm

Loading a .bullet file, creating objects

Post by jrk »

I'm really excited about using blender to create my bullet world :D and I think I'm close but I seem to be missing something.

I got the custom build of blender that exports .bullet files from here:
http://code.google.com/p/bullet-physics ... loads/list

I extracted the .bullet file from the example (the example is a house being knocked down with a big bullet)

then I imported it into my code:

Code: Select all

fileLoader = new btBulletWorldImporter(dynamicsWorld);
fileLoader->loadFile("testFile.bullet");
int body_count = fileLoader->getNumRigidBodies();
unfortunately getNumRigidBodies() returns 0. Why is that?

I then found the file inspector:
http://code.google.com/p/gamekit/downlo ... akechanges

I loaded the bullet file mentioned above and the .bullet file included with the inspector and found neither had rigid Bodies.
According the the "Explorere" tab it did have btRigidBodyFloatData which had m_collisionObjectData
But, the m_collisionObjectData m_name member was blank.

So, I don't understand the process. Do I load the serialized file then create rigidBodies from the "btRigidBodyFloatData"?
If so, how do I get a list or array of those things through which to iterate?
Also, if all the names are blank, how do I know what is what?
Kanttori
Posts: 38
Joined: Thu Jul 08, 2010 12:52 am

Re: Loading a .bullet file, creating objects

Post by Kanttori »

I bet you're trying to export a "Triangle Mesh" collision type, it's the one I'm having problems with too... you can switch to a convex hull or something else and it should work.

I'm looking at File Inspector's output and it seems like triangle meshes aren't really exported at all; just a generic btCollisionShapeData appears when I switch from a convex hull to a triangle mesh. It's either how blender handles the triangle meshes or they just don't get exported correctly by bullet. I'll have a look around the code at some point though I'm not sure if I could fix (or even find) the problem.
Kanttori
Posts: 38
Joined: Thu Jul 08, 2010 12:52 am

Re: Loading a .bullet file, creating objects

Post by Kanttori »

The problem is that Blender (2.49b at least) is using btScaledBvhTriangleMeshShape internally for "instances" of the mesh and that class isn't serialized yet. I made a patch where the instances use the non-scaled shared btBvhTriangleMeshShape directly, but then I ran into an issue of bullet 2.77 segfaulting in processTriangles() when the mesh-object collided in simulation. There are no problems though when I use bullet-svn-r2243 with my code and this may be because there have been changes done since 2.77 in the mesh-code in worldimporter and elsewhere.

The (very temporary) patch, needs to be reversed when btScaledBvhTrianbleMeshShape is serialized.
no_btscaledbvhtrianglemeshshape.zip
(771 Bytes) Downloaded 555 times
EnlightenedOne
Posts: 37
Joined: Wed Sep 08, 2010 2:57 pm

Re: Loading a .bullet file, creating objects

Post by EnlightenedOne »

is this problem still prevalent? I am using 2.77 and about to try getting data out of blender for my physics simulation. I am basically at the stage of getting blender to export a .bullet mesh (with major difficulty down to the precompiled patched blender program not working) trying to make a new patch-blender version now any tips would be greatly appreciated as I dont want to waste a day getting blender working :(

Thanks

Enlightened One
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Loading a .bullet file, creating objects

Post by Erwin Coumans »

Please report an issue about btScaledBvhTrianbleMeshShape serialization and attach the patch in the tracker here: http://code.google.com/p/bullet/issues/list

Then we will provide an updated Blender 2.49b precompiled binary with .bullet export.

Can you reply here if you submitted the issue?
THanks,
Erwin
EnlightenedOne
Posts: 37
Joined: Wed Sep 08, 2010 2:57 pm

Re: Loading a .bullet file, creating objects

Post by EnlightenedOne »

I appear to have hit the same problem. The Bullet Physics Editor can load in the mesh file yet the serializer demo does not recognise it. It is what I was planning to use for my terrain so perhaps I better rollback bullet versions and address my stark inability to compile patches for blender (unless your feeling generous enough to upload it as a zip file somewhere Kanttori :mrgreen: ). Is this issue limited only to Blenders exporter?

I will watch the issue and wait, I do not want to badger Erwin again after he got me loading in meshes!

I am looking into a quick fix working out from the convertCollisionShape function; I only care about loading mesh data in rather than saving it again and a convex hull is not going to cut it. Well maybe it could but I would have to be more desperate/less stubborn to change from my original plan. I will keep you posted on any useful hack in loading in blender triangle mesh data without a .patch, but don't hold your breathe as this SDK will take a while to master!
Post Reply