SoftBody serialize problem

lemonriver
Posts: 23
Joined: Thu Dec 30, 2010 4:04 am
Location: Hangzhou China

SoftBody serialize problem

Post by lemonriver »

My serialize code:

Code: Select all

	   int maxSerializeBufferSize = 1024*1024*10;
		btDefaultSerializer* ds = new btDefaultSerializer(maxSerializeBufferSize);

		getSoftDynamicsWorld()->serialize(ds);

		FILE* pf = fopen("my.bullet", "wb");
		fwrite(ds->getBufferPointer(), ds->getCurrentBufferSize(), 1, pf);
		fclose(pf);
		delete ds;
		printf("World Serialized!\n");
My deserialize code:

Code: Select all

		MySoftBulletWorldImporter* importer = new MySoftBulletWorldImporter(getSoftDynamicsWorld());
		bool res = importer->loadFile("my.bullet");
		delete importer;
I can not load the file correctly. console shows "unknow chunk........"
I can load the .bullet file created by SerializeDemo. SerializeDemo can not load "my.bullet" which was created by my program.
lemonriver
Posts: 23
Joined: Thu Dec 30, 2010 4:04 am
Location: Hangzhou China

Re: SoftBody serialize problem

Post by lemonriver »

when you create a cloth with N-distance-neighbour links (n>2), it become very time consuming.
I try to create it once offline. Then load it from .bullet file every time. I can not serialize softbody
corretly. :(