bullet 2.77: where has serialization gone to?

User avatar
Dragonlord
Posts: 198
Joined: Mon Sep 04, 2006 5:31 pm
Location: Switzerland

bullet 2.77: where has serialization gone to?

Post by Dragonlord »

In 2.75 I could use the COLLADA stuff in the BulletExtras directory to create a snapshot if required. In 2.77 this is gone and I can not find any trace of a serialization support. How is one supposed to take a snapshot with 2.77 ?
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: bullet 2.77: where has serialization gone to?

Post by Erwin Coumans »

Serialization is now build into the physics engine, see http://bulletphysics.org/mediawiki-1.5. ... ialization

You can make a snapshot using

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);
Then you can load a snapshot using the btBulletWorldImporter, see Bullet/Demos/SerializeDemo.

Thanks,
Erwin

By the way, you can still use COLLADA Physics if needed, this work has been moved to the http://dynamica.googlecode.com repository.
User avatar
Dragonlord
Posts: 198
Joined: Mon Sep 04, 2006 5:31 pm
Location: Switzerland

Re: bullet 2.77: where has serialization gone to?

Post by Dragonlord »

*bookmarked*.... nice, thanks. Then I can eventually kick out this extra code to build Bullet (window command line length problem). No more needed if I don't need tons of additional files for a snapshot :D