Fahri,
Thanks for the quick reply:
Here are a couple links discussing it:
(HelloWorld for Box2D re-written to use it):
http://code.google.com/p/box2d/source/browse/trunk/Box2D/Examples/HelloWorld/HelloWorld.cpp
Another example: (in Objective-C)
http://www.cocos2d-iphone.org/forum/topic/1288
Basically shapes just hold geometry data, Fixtures hold some of the
physics info (friction, mass,etc), fixtures contain a shape, and then
bodies have fixtures attached to them (b2Body->CreateFixture())
Check the API.chm file in the Box2D SVN, it has the updated classes
(b2PolygonShape for example), unfortunately they have not updated the
manual yet and I don't think b2Fixture is in there yet. The test cases
have been moved over to the new format and that is the best source of
this info (and the forums).
Here is quick and dirty example:
b2PolygonShape partition0;
b2Vec2 p0vertices[6];
p0vertices[0] = b2Vec2(-3.606342f, 0.639774f);
p0vertices[1] = b2Vec2(-3.737414f, 0.394014f);
p0vertices[2] = b2Vec2(-3.671878f, -0.146658f);
p0vertices[3] = b2Vec2(-2.967366f, -1.703138f);
p0vertices[4] = b2Vec2(-1.214278f, -1.703138f);
p0vertices[5] = b2Vec2(-1.214278f, -1.309922f);
partition0.Set(p0vertices, 6);
b2FixtureDef truckFixtureDef0;
truckFixtureDef0.shape = &partition0;
truckFixtureDef0.density = 10.0f;
b2BodyDef bodyDef;
b2Body* carBody = world->CreateBody(&bodyDef);
carBody->CreateFixture(&truckFixtureDef0);
-------------
Check out the b2Fixture.h file in the SVN (under the dynamics folder):
/// A fixture definition is used to create a fixture. This class
defines an
/// abstract fixture definition. You can reuse fixture definitions
safely.
struct b2FixtureDef
{
/// The constructor sets the default fixture definition values.
b2FixtureDef()
{
shape = NULL;
userData = NULL;
friction = 0.2f;
restitution = 0.0f;
density = 0.0f;
filter.categoryBits = 0x0001;
filter.maskBits = 0xFFFF;
filter.groupIndex = 0;
isSensor = false;
}
Does that make sense?
Rod