[Notice of Holidays]
Please note that our staff will not be available from 2024/Dec/28 - 2025/Jan/5 JST.
The Live2D Creators Forum will remain open during the holidays.
Submissions that require a response will be answered after we reopen for business.
Please note that it will take longer than usual to respond to your request.
how i get drawing rectangle size after setMatrix function called
//....
live2DModel2->setMatrix(matrix);
//live2DModel2->GetVertixPostion ?? or live2DModel2->GetRectSize();
0 ·
Comments
thanks for using Live2D! Do you want to get the axis aligned margins of the whole model?
The current SDK currently doesn't provide an easy way to do this...
My first comments to this question show a way to do it - although not good, currently probably the best you can do. The functions called are basically the same in the c++ based SDKs but feel free to ask questions.
float right=0;
float top=live2DModel->getCanvasHeight();
float bottom=0;
for(int i=0; i
{
PartsData* part = (*parts)[i];
int pointCount = 0;
float* points = live2DModel->getTransformedPoints(live2DModel->getPartsDataIndex(part->getPartsDataID()),&pointCount);
for (int i = 0; i < pointCount; i++)
{
float x = points[DEF::VERTEX_OFFSET+i*DEF::VERTEX_STEP];
float y = points[DEF::VERTEX_OFFSET+i*DEF::VERTEX_STEP+1];
if(x < left)left=x; // Min x
if(x > right)right=x; // Max x
if(y < top)top=y; // Min y
if(y > bottom)bottom=y; // Max y
}
}
This Size is bigger than window size..
So it must offer, pixel compact scalability and hitting test for pixel coordinate