I want to create a compound shape with two circles. But I cannot to set a relative position of the top circle. This line does not do anything:
playerTopShape.Set(new b2Vec2(0, 20 / ppm), 20 / ppm);
Result:
A minimum example that demonstrate this problem in pure WebGL 1.0 + glMatrix:
playerBody = world.CreateBody({
type: b2BodyType.b2_dynamicBody,
position: { x: 0.1 / ppm, y: 120 / ppm },
angle: 0
});
playerBody.SetFixedRotation(true);
const playerBottomShape = new b2CircleShape(20 / ppm);
const playerBottomFixture = playerBody.CreateFixture({
shape: playerBottomShape,
density: 1
});
playerBottomFixture.SetRestitution(0);
playerBottomFixture.SetFriction(2);
const playerTopShape = new b2CircleShape();
playerTopShape.Set(new b2Vec2(0, 20 / ppm), 20 / ppm);
const playerTopFixture = playerBody.CreateFixture({
shape: playerTopShape,
density: 1
});
playerTopFixture.SetRestitution(0);
playerTopFixture.SetFriction(0);
I want to create a compound shape with two circles. But I cannot to set a relative position of the top circle. This line does not do anything:
Result:
A minimum example that demonstrate this problem in pure WebGL 1.0 + glMatrix: