Page 1 of 1

Finding images attached to a specific body

Posted: Wed Nov 13, 2013 7:16 am
by vkreal
In b2dJson any way to do get image attached to b2Body? something like json.getImageByB2Body(b2Body* body)

Re: rube b2dJson

Posted: Wed Nov 13, 2013 7:38 am
by iforce2d
You could loop over all images to find those with a matching body:

Code: Select all

    std::vector<b2dJsonImage*> allImages;
    json.getAllImages( allImages );

    for (int i = 0; i < allImages.size(); i++) {
        if ( allImages[i]->m_body == theBody )
            // do something with allImages[i]
    }