I’ve been messing around with soft bodies physics using the code from this thread: Bullet’s SoftBody physics example , and have been able to get the jello mushroom working.
After doing this I started work on doing partial model soft body so that things like hair can be done. To achieve this, I found I need to be able to get the vertex weight values from weight groups, so that vertices can be marked as immobile, or affected by soft body physics.
I briefly thought about saving this data to separate weight files, but discarded the idea as it’s a recipe for easy desynchronization. As such, I decided that this data should be saved in the model.
Presently I’m appending the vertex weight data file with a block formatted like this:
'WGHT' - 4 byte identifier of the block
block size - UInt the number of bytes in the block (not including the identifier and block size)
vertex group count - UInt The number of vertex groups contained in this block.
vertex group list - A list of Vertex Groups, with the format detailed just below.
Vertex Groups:
vertex group name - C string name of the group.
index size - UInt Number of bytes in an index (2 or 4).
vertex count - UInt
vertex weight list - A list of Vertex Weights, with format detailed just below.
Vertex Weights:
vertex index - UShort or UInt The index of the vert
weight - float A float in the range of 0.0 to 1.0 with the weight of the vertex.
So far it’s working fine, but I’m not sure if this is the best way to add this feature into the Urho3D model file. Should the block be formatted differently? Should the data actually go else where in the file? Or are separate files a better option?