What I'm doing wrong?
Here's code (for Delphi) of brick adding:
and of world:
Already solved, problems with meter units...
Here's code (for Delphi) of brick adding:
Code: Select all
BrickDef[i]:=Tb2BodyDef.Create;
BrickDef[i].bodyType:=b2_dynamicBody;
BrickDef[i].allowSleep:=true;
BrickDef[i].linearDamping:=0.0;
BrickDef[i].angularDamping:=0.0;
SetValue(BrickDef[i].position,random(500)+250,-20.0);
Brick[i]:=world.CreateBody(BrickDef[i]);
BrickShapeDef[i]:=Tb2PolygonShape.Create;
BrickShapeDef[i].SetAsBox(16.0,8.0);
fd:=Tb2FixtureDef.Create;
fd.shape:=BrickShapeDef[i];
fd.restitution:=0.0;//упругость
fd.density:=2.0;//плотность
fd.friction:=0.4;//трение
Brick[i].CreateFixture(fd);
and of world:
Code: Select all
SetValue(gravity,0,10);
world:=Tb2World.Create(gravity,false);
Already solved, problems with meter units...