Check out the Raptor example, e.g. the mesh "raptor_arm_back" is a weighted, deformed mesh (many more in raptor) spine-runtimes/examples/raptor at master. Alternatively I'd suggest to setup a simple Spine project with one unweighted mesh and a weighted mesh, each with one or two triangles, then export to JSON. That will make writting your Spine+Physics engine much easier.
I did just that, one mesh attachment consisting of 2 triangles without weights, and another mesh attachment consisting of 2 triangles weighted to a single bone. Here's the resulting JSON:
"skins": {
"default": {
"Screen Shot 2017-03-23 at 10.37.37 AM2": {
"Screen Shot 2017-03-23 at 10.37.37 AM": {
"type": "mesh",
"uvs": [ 1, 1, 0, 1, 0, 0, 1, 0 ],
"triangles": [ 1, 2, 3, 1, 3, 0 ],
"vertices": [ -108.05, -161.57, -110.32, 160.04, 108.05, 161.57, 110.32, -160.04 ],
"hull": 4,
"edges": [ 0, 2, 2, 4, 4, 6, 0, 6 ],
"width": 595,
"height": 404
}
},
"Screen Shot 2017-03-23 at 10.37.37 AM3": {
"Screen Shot 2017-03-23 at 10.37.37 AM": {
"type": "mesh",
"uvs": [ 1, 1, 0, 1, 0, 0, 1, 0 ],
"triangles": [ 1, 2, 3, 1, 3, 0 ],
"vertices": [ 1, 2, 177.1, -120.25, 1, 1, 2, -177.1, -120.25, 1, 1, 2, -177.1, 120.25, 1, 1, 2, 177.1, 120.25, 1 ],
"hull": 4,
"edges": [ 0, 2, 2, 4, 4, 6, 0, 6 ],
"width": 595,
"height": 404
}
}
}
},
For the unweighted mesh, the vertices
property is pretty trivial. It's simple a list of vertices, each vertex encoded as an x/y coordinate.
For the weighted mesh, the vertices
property works like this:
"vertices": [ 1, <- number of bones influencing this vertex
2, <- index of first bone influencing that vertex
177.1, -120.25, <- x/Y coordinate of this vertex
1, <- weight of first bone influencing
1, 2, -177.1, -120.25, 1,
1, 2, -177.1, 120.25, 1, 1, 2, 177.1, 120.25, 1 ],
So the format per vertex in a weighted mesh is:
Number of bones influencing this vertex (let's call this number #bones
)
List of #bones
bone indices influencing this vertex
Vertex x/y coordinate
List of #bones
bone weights