# Box2D Forums

 It is currently Fri May 24, 2013 7:22 am

 All times are UTC - 8 hours [ DST ]

 Page 1 of 1 [ 2 posts ]
 Print view Previous topic | Next topic
Author Message
 Post subject: shape vertices?Posted: Mon Apr 09, 2012 6:56 am

Joined: Sun Apr 08, 2012 2:24 am
Posts: 3
According to here I could get the shape vertices
viewtopic.php?f=8&t=4302

Looks like this is removed from latest version of box2d.
Do I have to use ComputeAABB now if I want to know the size of my shape? (if it's a polygonshape and not a circle)

Top

 Post subject: Re: shape vertices?Posted: Mon Apr 09, 2012 7:34 am

Joined: Sun Apr 08, 2012 2:24 am
Posts: 3
Figured it out... This is how you do it:
Code:
for (b2Body* curBody = _world->GetBodyList(); curBody;curBody = curBody->GetNext())
{
b2Vec2 position = curBody->GetPosition();
for (b2Fixture* curFixture = curBody->GetFixtureList(); curFixture;curFixture  = curFixture->GetNext())
{
b2Shape* shape = curFixture->GetShape();
if (shape->m_type == b2Shape::Type::e_circle )
{
// draw circle
}
else if (shape->m_type == b2Shape::Type::e_polygon)
{
//b2Vec2 boxExtents = shape->m_vertices[0];
b2AABB aabb;
shape->ComputeAABB(&aabb, curBody->GetTransform(), 0);

// draw rectangle from the aabb
}
}

i++;
}

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 2 posts ]

 All times are UTC - 8 hours [ DST ]

#### Who is online

Users browsing this forum: No registered users and 1 guest

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum

 Search for: