• Runtimes
  • RegionAttachment x/y offset - is there a Mesh equivalent?

I'm currently making use of the x and y offset values for a RegionAttachment, as part of a calculation to place some non-Spine sprites over the top of a Spine animation. These are the values I'm talking about:

spRegionAttachment *attachment = (spRegionAttachment*)slot->attachment;
float xAdd = attachment->x;
float yAdd = attachment->y;

This all works fine and when I incorporate those values, my positioning is correct. However, for parts of a Spine skeleton that are FFD using Meshes, there is no "x" and "y". So if the attachment type is spMeshAttachment, I'm wondering how I can obtain these same sort of bone offset values? Using my positioning without them has led to these types of attachments being out of place.

Related Discussions
...
5일 후

Sorry for missing this thread. Unfortunately I can't help out with it. Hopefully Nate will be able to reply soon, he's just overloaded with stuff at the moment after coming back from vacation.

A mesh has an x,y coordinate for each vertex. You could get the first vertex and position your sprite based on that. Or, the first mesh.hullLength vertices in mesh.vertices is the polygon hull for the mesh, so you could calculate the polygon's centroid and use that.

Thanks for your answer, I've used the mesh vertices to get the result I'm after.

In a related question, how about the rotation value found in RegionAttachment, is there a MeshAttachment equivalent for that?

No there isn't, a mesh is just made up of points in space that can move any direction. You could get two known points and calculate the angle between them.