Possible problem with deserialization of triangle meshes
Posted: Sat Sep 04, 2010 12:10 pm
Hello,
I was having problems with btBulletWorldImporter and importing triangle mesh shapes from .bullet files. I was using pretty much the same code that Erwin posted in this thread. However, anytime I entered a narrow phase collision with such a mesh, bullet would crash.
After some investigation, it seems like the world importer never copies the actual triangle data into the triangle mesh. The triangle data is just type-casted from the data chunk in the btBulletFile. However, btBulletWorldImporter deletes the bullet file after parsing in btBulletWorldImporter::loadFile, also invalidating the triangle, and more importantly, the index data.
So I switched to using btBulletWorldImporter::loadFileFromMemory, kept the bullet file around and it now works just as expected.
Is this indeed a problem or did I just misunderstand the code?
Regards,
Marius
I was having problems with btBulletWorldImporter and importing triangle mesh shapes from .bullet files. I was using pretty much the same code that Erwin posted in this thread. However, anytime I entered a narrow phase collision with such a mesh, bullet would crash.
After some investigation, it seems like the world importer never copies the actual triangle data into the triangle mesh. The triangle data is just type-casted from the data chunk in the btBulletFile. However, btBulletWorldImporter deletes the bullet file after parsing in btBulletWorldImporter::loadFile, also invalidating the triangle, and more importantly, the index data.
So I switched to using btBulletWorldImporter::loadFileFromMemory, kept the bullet file around and it now works just as expected.
Is this indeed a problem or did I just misunderstand the code?
Regards,
Marius