hello again!
i create two static boxes representing some kind of wall. there's no gravity in my world:
when i create a dynamic body with a circle-shape and throw it against these "walls" the ball moves along these borders. i guess that's because of wall's density of 0 (ball has 1.0f).
my problem is that i want the ball to bounce of the wall and keep the wall-objects static (since they are logically static since they won't move the whole game) - how can i do that?
in pictures:
what i have: http://img248.imageshack.us/my.php?imag ... aveju4.png
what i want: http://img511.imageshack.us/my.php?imag ... antxc7.png
i guess that the solution to this problem may be pretty easy, so any help greatly appreciated! 🙂
i create two static boxes representing some kind of wall. there's no gravity in my world:
Quote:
b2Vec2 gravity(0.0f, 0.0f);
bool doSleep = true;
m_world = new b2World(worldAABB, gravity, doSleep);
b2BoxDef groundBoxDef;
groundBoxDef.extents.Set(800.0f / 2, 20.0f / 2);
groundBoxDef.density = 0.0f;
b2BodyDef groundBodyDef;
groundBodyDef.position.Set(400.0f, 590.0f);
groundBodyDef.rotation = b2_pi / 4;
groundBodyDef.AddShape(&groundBoxDef);
m_world->CreateBody(&groundBodyDef);
groundBodyDef.rotation = -b2_pi / 4;
groundBodyDef.position.Set(400.0f, 10.0f);
groundBodyDef.AddShape(&groundBoxDef);
m_world->CreateBody(&groundBodyDef);
bool doSleep = true;
m_world = new b2World(worldAABB, gravity, doSleep);
b2BoxDef groundBoxDef;
groundBoxDef.extents.Set(800.0f / 2, 20.0f / 2);
groundBoxDef.density = 0.0f;
b2BodyDef groundBodyDef;
groundBodyDef.position.Set(400.0f, 590.0f);
groundBodyDef.rotation = b2_pi / 4;
groundBodyDef.AddShape(&groundBoxDef);
m_world->CreateBody(&groundBodyDef);
groundBodyDef.rotation = -b2_pi / 4;
groundBodyDef.position.Set(400.0f, 10.0f);
groundBodyDef.AddShape(&groundBoxDef);
m_world->CreateBody(&groundBodyDef);
when i create a dynamic body with a circle-shape and throw it against these "walls" the ball moves along these borders. i guess that's because of wall's density of 0 (ball has 1.0f).
my problem is that i want the ball to bounce of the wall and keep the wall-objects static (since they are logically static since they won't move the whole game) - how can i do that?
in pictures:
what i have: http://img248.imageshack.us/my.php?imag ... aveju4.png
what i want: http://img511.imageshack.us/my.php?imag ... antxc7.png
i guess that the solution to this problem may be pretty easy, so any help greatly appreciated! 🙂