Re: Serializing Multiple Bullet Objects
Posted: Mon Sep 13, 2010 2:03 am
The serialization support multiple objects and multiple constaints. It is not clear what is going wrong. Serializing using unique names for bodies/shapes should work fine.
It is recommended that you don't use the serializeSingleObject but use the btDynamicsWorld::serialize instead:
See also http://bulletphysics.org/mediawiki-1.5. ... ialization
Note that while running most of the (unmodified) Bullet demos, you can press '=' key to serialize to a .bullet file, named "test.bullet". It will serialize all objects and constraints in the dynamics world. Some collision shapes are not supported yet (btHeightfieldTerrainShape for example).
Thanks,
Erwin
It is recommended that you don't use the serializeSingleObject but use the btDynamicsWorld::serialize instead:
Code: Select all
//create a large enough buffer. There is no method to pre-calculate the buffer size yet.
int maxSerializeBufferSize = 1024*1024*5;
btDefaultSerializer* serializer = new btDefaultSerializer(maxSerializeBufferSize);
dynamicsWorld->serialize(serializer);
FILE* file = fopen("testFile.bullet","wb");
fwrite(serializer->getBufferPointer(),serializer->getCurrentBufferSize(),1, file);
fclose(file);
Note that while running most of the (unmodified) Bullet demos, you can press '=' key to serialize to a .bullet file, named "test.bullet". It will serialize all objects and constraints in the dynamics world. Some collision shapes are not supported yet (btHeightfieldTerrainShape for example).
Thanks,
Erwin