@C11 wrote:
Hi guys.
spine BoundingBox How to read in cocos2d - x?
i try to use getBoundingBox()
But that's not I want
I try to override getBoundingBox()Rect SkeletonRenderer::getBoundingBox() const {
float minX = FLT_MAX, minY = FLT_MAX, maxX = FLT_MIN, maxY = FLT_MIN;
float scaleX = getScaleX(), scaleY = getScaleY();
for (int i = 0; i < _skeleton->slotsCount; ++i) {
spSlot* slot = _skeleton->slots[i];
if (!slot->attachment) continue;
int verticesCount;
if (slot->attachment->type == SP_ATTACHMENT_BOUNDING_BOX)
{
spBoundingBoxAttachment* spa = (spBoundingBoxAttachment*)slot->attachment;
spBoundingBoxAttachment_computeWorldVertices(spa, slot->bone, _worldVertices);
verticesCount = spa->verticesCount;
}
for (int ii = 0; ii < verticesCount; ii += 2) {
float x = _worldVertices[ii] * scaleX, y = _worldVertices[ii + 1] * scaleY;
minX = min(minX, x);
minY = min(minY, y);
maxX = max(maxX, x);
maxY = max(maxY, y);
}
}
Vec2 position = getPosition();
return Rect(position.x + minX, position.y + minY, maxX - minX, maxY - minY);
}But have no effect .Not any change. I dont konw what's happen
I'm sorry my English .Thank you...
Posts: 1
Participants: 1