Hi, when I began to program game character I used rectangle as its physical view, and hero's skin had the same y-coordinate as this rectangle.

Now I decided to make physical representation of the character as compound object - rectangle(body) and circle(legs) in the lower part of the hero. This caused mistake - hero's legs are now deep in ground in the main movieclip.

How can fix the problem?
Code:
bodyDef = new b2BodyDef();
bodyDef.position.x = (x)/physScale;
bodyDef.position.y = (y)/physScale;
bodyDef.type = b2Body.b2_dynamicBody;
bodyDef.fixedRotation = true;
bodyDef.linearDamping = 0.1;
var boxDef:b2PolygonShape = new b2PolygonShape();
boxDef.SetAsOrientedBox(GetRealWH(23), GetRealWH(40),new b2Vec2(0,0/30),0);
fixtureDef = new b2FixtureDef();
fixtureDef.shape = boxDef;
fixtureDef.friction = 0.5;
fixtureDef.density = 0.6;
fixtureDef.restitution = 0;
bodyDef.userData = new PlayerBox();
bodyDef.userData.name = "Player";
player = m_world.CreateBody(bodyDef);
player.SetBullet(true);
player.CreateFixture(fixtureDef);
bodyDef.position.x = (x)/physScale;
bodyDef.position.y = (y)/physScale;
bodyDef.type = b2Body.b2_dynamicBody;
bodyDef.fixedRotation = true;
bodyDef.linearDamping = 0.1;
var boxDef:b2PolygonShape = new b2PolygonShape();
boxDef.SetAsOrientedBox(GetRealWH(23), GetRealWH(40),new b2Vec2(0,0/30),0);
fixtureDef = new b2FixtureDef();
fixtureDef.shape = boxDef;
fixtureDef.friction = 0.5;
fixtureDef.density = 0.6;
fixtureDef.restitution = 0;
bodyDef.userData = new PlayerBox();
bodyDef.userData.name = "Player";
player = m_world.CreateBody(bodyDef);
player.SetBullet(true);
player.CreateFixture(fixtureDef);
Now I decided to make physical representation of the character as compound object - rectangle(body) and circle(legs) in the lower part of the hero. This caused mistake - hero's legs are now deep in ground in the main movieclip.
Code:
var boxDef:b2PolygonShape = new b2PolygonShape();
boxDef.SetAsOrientedBox(GetRealWH(23), GetRealWH(17),new b2Vec2(0,-23/30),0);
fixtureDef = new b2FixtureDef();
fixtureDef.shape = boxDef;
fixtureDef.friction = 0.5;
fixtureDef.density = 0.6;
fixtureDef.restitution = 0;
bodyDef.userData = new PlayerBox();
bodyDef.userData.name = "Player";
player = m_world.CreateBody(bodyDef);
player.SetBullet(true);
player.CreateFixture(fixtureDef);
circleDef = new b2CircleShape(GetRealWH(23));
var circleFixture:b2FixtureDef = new b2FixtureDef();
circleFixture.friction = 0.5;
circleFixture.density = 0.1;
circleFixture.shape = circleDef;
player.CreateFixture(circleFixture);
boxDef.SetAsOrientedBox(GetRealWH(23), GetRealWH(17),new b2Vec2(0,-23/30),0);
fixtureDef = new b2FixtureDef();
fixtureDef.shape = boxDef;
fixtureDef.friction = 0.5;
fixtureDef.density = 0.6;
fixtureDef.restitution = 0;
bodyDef.userData = new PlayerBox();
bodyDef.userData.name = "Player";
player = m_world.CreateBody(bodyDef);
player.SetBullet(true);
player.CreateFixture(fixtureDef);
circleDef = new b2CircleShape(GetRealWH(23));
var circleFixture:b2FixtureDef = new b2FixtureDef();
circleFixture.friction = 0.5;
circleFixture.density = 0.1;
circleFixture.shape = circleDef;
player.CreateFixture(circleFixture);
How can fix the problem?