how i get drawing rectangle size after setMatrix function called

//....
live2DModel2->setMatrix(matrix);

//live2DModel2->GetVertixPostion ?? or live2DModel2->GetRectSize();

Comments

  • Hi,


    thanks for using Live2D! Do you want to get the axis aligned margins of the whole model?
  • i want get axis aligned whole pixel size to drawing model
  • @curianlord
    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.
  • edited March 2016
    This is my test program screenshot
  • edited March 2016
    float left=live2DModel->getCanvasWidth();
    float right=0;
    float top=live2DModel->getCanvasHeight();
    float bottom=0;

    for(int i=0; isize(); ++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
    }
    }
  • My Test Program Window Size is 1024 * 768 but the calculated value is left = 744.523987, right = 1652.80640, top 199.542847, bottom = 2840.10376...
    This Size is bigger than window size..
  • I want using it Game UI.
    So it must offer, pixel compact scalability and hitting test for pixel coordinate
  • any solution for it ???
  • @curianlord
    So it must offer, pixel compact scalability and hitting test for pixel coordinate
    Do you mean that you need the coordinates in screen space?
  • If yes, the coordinates you get from that function are in Live2D's model space, so you would have to convert them back or the UI coordinates forth. Do you set the projection matrix, etc. by yourself?
Sign In or Register to comment.