forked from flyover/box2d.ts
-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
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:
- Playground: https://plnkr.co/edit/QB29hXNup1X7iQLK
- GitHub repo: https://github.com/8Observer8/complex-shape-box2dcore-webgl-js
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);Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels