Is there a way to have some custom geometry that you created procedurally, have weights assigned to it of a pre-existing skeleton?
A large problem with doing this here is a bone is just a matrix. You could back into the head tail locations, and maybe the accessors for that. You would have to check.
Yes, you could probably do it, by iterating through each vertex and finding the 4 short distance away from each bone. Then get the total distance of those, and divide the distance of each bone by the total to get a normalized weight.
Blender has automatic weighting. If you made such a tool, it would probably good to export the mesh, so you would not have to do it every time.
One tricky part is vertex location. Vertices are relative to the mesh origin, not absolute coordinates.
Found what I needed!
The mesh must also have additional vertices data:
* *Matrices weights* : 4 floats to weight bones matrices
( `mesh.setVerticesData(BABYLON.VertexBuffer.MatricesWeightsKind, matricesWeights, false)` )
* *Matrices indices* : 4 floats to index bones matrices
( `mesh.setVerticesData(BABYLON.VertexBuffer.MatricesIndicesKind, floatIndices, false)` )
Will this data be included in a merge mesh operation?
Also what is the value I should use for MatricesIndicesKind, when there is no influence? -1, null, 0?
https://playground.babylonjs.com/#BCU1XR#1351
Yeeehaw nvm figured it out!
I think if you would have asked ‘how’ instead of ‘if’ you would have gotten the answer you wanedt instead of a summary of ‘building the world from atoms’.
Welp help me figure out why the atoms on my local are going crazy!
Local:
Playground:
Scriptural and asset wise these are using the same things, but I get different results… kinda nutty.
actually I think this is unrelated. and is because of a secondary animation curves we have going on the bones.
I might have to just re think some stuff, but this is still the solution.
Hey buddy! I was thinking about adding all of that into the engine for the skeleton viewer
What do you think?
PM me if you want to chat more