I'm currently trying to save and read collisionshape data in/from a file. To do this I tried to serialize the data like Erwin describes here.
The saving process seems to work well, but when I want to recreate the saved collisionshape with btBulletWorldImporter, it tells me that there aren't any collisionshapes. I stepped into the loading methods with the debugger - it seems that there is no parsing. Then I tried first to create a btBulletFile with my data from the file but this time I got an assertion.
Wümpftlbrümpftl wrote:Too bad... my world is splitted into several pages, so this could become quite tricky
But thank you for the quick answer
It shouldn't be hard to import just some collision shapes. The code is already in the btBulletWorldImporter.
On Windows, you can inspect the contents of a .bullet file using the File Inspector. Use File/inspect file.
Can you attach a (zipped) .bullet file, so we can see if there are actual collision shapes in there?
Thanks,
Erwin
I split the collisionshape data from the rest of my file (by droping the last but one line of my saving code) and tried to load this as bullet file with the FileInspector which returned a "Failed to allocate memory!" error.
Here is the file as you suggested
All 0a seems to be preceded by 0d, did you apply some dos/unix line-feed conversion to that binary file btSerializer.cpp or the .bullet file?
Please revert to an unmodified btSerializer.cpp
Thanks,
Erwin
Some questions:
1)Does serializeSingleShape work for btHeightfieldTerrainShape?
2)How to convert from btHeightfieldTerrainShape to btBvhTriangleMeshShape?
NOTES:
I am having trouble getting btHeightfieldTerrainShape to serialize, I have successfully serialized many other shapes including btBvhTriangleMeshShape. So if I could convert from btHeightfieldTerrainShape to btBvhTriangleMeshShape, or some other object that I can convert to , serialize out, load, then convert back.