Sorry for the delayed response.
The units can be interpreted however you like at runtime, but are typically pixels. 0,0 is the bone's origin. 10,0 is 10 units along the bone's local X axis, which points in the direction of the bone. 10,0 is 10 units along the bone's local Y axis, which points perpendicular to the bone's local X axis.
If you want to move an attachment relative to the bone, you can just adjust its position using the above understanding. Eg, position it at 0,0 and you'll see the attachment center is at the bone origin. Position it at 100,0 and you'll see it move 100 along the direction the bone points.
If you want to move an attachment in world space, you'll need to convert from world coordinates to the bone's local coordinates. This can be done using Bone worldToLocal
. Eg, if you want to move 100 units to the right in world coordinates:
offset = bone.worldToLocal(bone.worldX + 100, bone.worldY + 0)
attachment.x += offset.x
attachment.y += offset.y
worldToLocal(bone.worldX, bone.worldY)
will give you 0,0 because the bone's world position is 0,0 in the bone's local coordinate system. If we add our 100,0 offset to the world position, worldToLocal
will give the offset transformed to the bone's local coordinates. Now you can adjust the attachment by that much and it will move 100,0 in world coordinates.