I am using box2d 2.1.2 with cocos2d 0.99.4
everything is light in my world, there is no feeling of dropping a stone or a box !! everything slowly falls at the same speed
b2Vec2 gravity; gravity.Set(0.0f, -10.0f); bool doSleep = true; world = new b2World(gravity, doSleep);
and my objects:
b2BodyDef *TBodyDef = new b2BodyDef; TBodyDef->position.Set(100, 200); b2Body *TBody = world->CreateBody(TBodyDef); TBody->SetType(b2_dynamicBody); TBody->SetAwake(true); b2CircleShape TCircleShape; TCircleShape.m_radius = 20; b2FixtureDef TFixtureDef; TFixtureDef.shape = &TCircleShape; TFixtureDef.friction = 0.1; TFixtureDef.density = 0.1; TFixtureDef.restitution = 1; TFixtureDef.filter.categoryBits = COLLISION_BIT_GP; TFixtureDef.filter.maskBits = COLLISION_BIT_TERRAIN; TBody->CreateFixture(&TFixtureDef); b2BodyDef *TBodyDef1 = new b2BodyDef; TBodyDef1->position.Set(200, 200); b2Body *TBody1 = world->CreateBody(TBodyDef1); TBody1->SetType(b2_dynamicBody); TBody1->SetAwake(true); b2CircleShape TCircleShape1; TCircleShape1.m_radius = 20; b2FixtureDef TFixtureDef1; TFixtureDef1.shape = &TCircleShape; TFixtureDef1.friction = 0.1; TFixtureDef1.density = 0.5; TFixtureDef1.restitution = 1; TFixtureDef1.filter.categoryBits = COLLISION_BIT_GP; TFixtureDef1.filter.maskBits = COLLISION_BIT_TERRAIN; TBody1->CreateFixture(&TFixtureDef1);
and my step:
int32 velocityIterations = 8; int32 positionIterations = 3; world->Step(dt, velocityIterations, positionIterations);
Density
nothing changes about the speed of fall. what is missing is to make it as fluid as this: link text
thank you for your help
source share