I'm started to learn jbox2d, and now i'm stuck.
I created world, 2 bodies (static and dynamic). But dynamic body don't fall.
But tankArmor Body don't fall. I also tried to apply force and velocity to body, but it not helped.
I know that i missed something, I hope you could point to my mistake.
PS: i'm using version 2.0.1 (august 2008), should I use version from SVN instead?
I created world, 2 bodies (static and dynamic). But dynamic body don't fall.
Code: Select all
////// INITIALIZATION
Vec2 v2min,v2max, v2gravity;
AABB aabbWorld;
World world;
BodyDef bdGroundOne;
Body bodyGroundOne, tankArmor,;
//init world
v2gravity = new Vec2(0.0f, -10.0f);
aabbWorld = new AABB();
aabbWorld.lowerBound = new Vec2(-1000.0f, -1000.0f);
aabbWorld.upperBound = new Vec2(1000.0f, 1000.0f);
world = new World(aabbWorld, v2gravity, false);
//init ground
bdGroundOne = new BodyDef();
bdGroundOne.position = new Vec2(100.0f, 400.0f);
bodyGroundOne = world.createBody(bdGroundOne);
PolygonDef g1shapeDef = new PolygonDef();
g1shapeDef.setAsBox(400, 20);
bodyGroundOne.createShape(g1shapeDef);
//body
BodyDef bdTank = new BodyDef();
bdTank.position.set(300.0f, 200.0f);
tankArmor = world.createBody(bdTank);
PolygonDef pdTank = new PolygonDef();
pdTank.setAsBox(50, 10);
pdTank.density = 1.0f;
pdTank.friction = 0.3f;
pdTank.restitution = 0.1f;
bodyGroundOne.createShape(pdTank);
tankArmor.m_mass = 10.0f;
///// then every 1/60 second i call
world.step(1.0f/60.0f, 10);
But tankArmor Body don't fall. I also tried to apply force and velocity to body, but it not helped.
I know that i missed something, I hope you could point to my mistake.
PS: i'm using version 2.0.1 (august 2008), should I use version from SVN instead?