mirror of
https://github.com/liabru/matter-js.git
synced 2025-02-07 19:06:26 -05:00
added constraint to Demo.compound
This commit is contained in:
parent
6679b9c6c5
commit
87fbf51c82
1 changed files with 8 additions and 1 deletions
|
@ -137,6 +137,7 @@
|
||||||
|
|
||||||
size = 150;
|
size = 150;
|
||||||
x = 400;
|
x = 400;
|
||||||
|
y = 300;
|
||||||
|
|
||||||
var partC = Bodies.circle(x, y, 30),
|
var partC = Bodies.circle(x, y, 30),
|
||||||
partD = Bodies.circle(x + size, y, 30),
|
partD = Bodies.circle(x + size, y, 30),
|
||||||
|
@ -147,7 +148,13 @@
|
||||||
parts: [partC, partD, partE, partF]
|
parts: [partC, partD, partE, partF]
|
||||||
});
|
});
|
||||||
|
|
||||||
World.add(_world, [compoundBodyA, compoundBodyB]);
|
var constraint = Constraint.create({
|
||||||
|
pointA: { x: 400, y: 100 },
|
||||||
|
bodyB: compoundBodyB,
|
||||||
|
pointB: { x: 0, y: -50 }
|
||||||
|
});
|
||||||
|
|
||||||
|
World.add(_world, [compoundBodyA, compoundBodyB, constraint]);
|
||||||
|
|
||||||
var renderOptions = _engine.render.options;
|
var renderOptions = _engine.render.options;
|
||||||
renderOptions.showAxes = true;
|
renderOptions.showAxes = true;
|
||||||
|
|
Loading…
Add table
Reference in a new issue