I've extended our SpineboyExample
to show how the bounding box world coordinates can be used.
private function onUpdate() : void {
var slot:Slot = skeleton.skeleton.findSlot("head-bb");
var bb:BoundingBoxAttachment = skeleton.skeleton.getAttachmentForSlotIndex(slot.data.index, "head") as BoundingBoxAttachment;
var worldVertices:Vector.<Number> = new Vector.<Number>(bb.worldVerticesLength);
bb.computeWorldVertices(slot, 0, bb.worldVerticesLength, worldVertices, 0, 2);
for (var i:int = 0; i < worldVertices.length; i+=2) {
worldVertices[i] = worldVertices[i] * skeleton.scale + skeleton.x;
worldVertices[i + 1] = worldVertices[i + 1] * skeleton.scale + skeleton.y;
}
shape.setVertices(worldVertices);
}
The world vertices are relative to skeleton.x/y and do not take into account the DisplayObject scale. As you can see above, it's quite easy to factor that into the world vertices.