btMultimaterialTriangleMeshShape

Peter_B
Posts: 2
Joined: Fri May 25, 2012 2:34 am

btMultimaterialTriangleMeshShape

Post by Peter_B »

Hi guys,

I was wondering how do ppl serialize these. I'm working on integrating materials into my engine and I've discovered that btFileLoader is telling me "error: cannot create shape type" and when I look at the source there is no deserialize code for MULTIMATERIAL_TRIANGLE_MESH_PROXYTYPE, hence no rigidbodies are added to the work.

Any help would be greatly appreciated?
podfish
Posts: 6
Joined: Wed Oct 10, 2012 12:38 am

Re: btMultimaterialTriangleMeshShape

Post by podfish »

my questions too. Actually, I don't see much support for this shape in the libraries at all - there are odd omissions, like the way the "m_triangleMaterials" is ignored, or any sign that the "customMaterialCallback" flag is used anywhere.

It's also a bit heavy. I'm looking for a way to add face-flags to my collision objects, and at first this looked useful. All I really need is to use the per-triangle index directly, though. The actual materials aren't important. So instead of using the "getMaterialProperties" which looks up the face's index and then uses it to select a material, I'm just using "getMeshInterface" to extract the underlying btTriangleIndexVertexMaterialArray and using its "getLockedReadOnlyMaterialBase" method to find my flags. It'd be nice if this kind of functionality was wrapped into the shape itself.
I'd hoped to avoid customizing bullet too much, but these kind of issues lead me to believe that it really does need to be customized for each user's needs. Which is fine - I'm just trying to make sure I fully understand the philosophy behind the design of the library so I'm not making life more difficult in the long run by using it in unsupported or unintended ways.



If I find anything more about serialization, I'll post it here.