- 7 December 2012
- iPhone Development
- 0 Comments
If you ever need to change the size of a b2PolygonShape, use the following code snippet:
for (b2Fixture *fixture = playerBody->GetFixtureList(); fixture != NULL; fixture = fixture->GetNext())
{
b2PolygonShape* shape = (b2PolygonShape*)fixture->GetShape();
int iFixtureSizeW1 = 200;
int iFixtureSizeY1 = 200;
b2Filter objectFilter = fixture->GetFilterData(); // Object's filter data
shape->m_vertices[0].Set(-iFixtureSizeW1, -iFixtureSizeY1);
shape->m_vertices[1].Set( iFixtureSizeW1, -iFixtureSizeY1);
shape->m_vertices[2].Set( iFixtureSizeW1, iFixtureSizeY1);
shape->m_vertices[3].Set(-iFixtureSizeW1, iFixtureSizeY1);
}


