Body ground;
{
CircleShape circleShape = new CircleShape();
circleShape.m_radius = 1;
Shape shape = circleShape;
BodyDef bodyDef = new BodyDef();
bodyDef.type = BodyType.DYNAMIC;
bodyDef.position.set(-5, 0);
bodyDef.allowSleep = false;
pendulum = getWorld().createBody(bodyDef);
pendulum.createFixture(shape, 1);
}
{
PolygonShape shape = new PolygonShape();
shape.setAsBox(1, 1);
BodyDef bodyDef = new BodyDef();
bodyDef.type = BodyType.DYNAMIC;
bodyDef.position.set(0, 2);
bodyDef.allowSleep = false;
base = getWorld().createBody(bodyDef);
base.createFixture(shape, 1);
}
{
PolygonShape shape = new PolygonShape();
shape.setAsBox(3, 1);
BodyDef bodyDef = new BodyDef();
bodyDef.type = BodyType.STATIC;
ground = getWorld().createBody(bodyDef);
ground.createFixture(shape, 0);