Skip to content

Commit 87fbf51

Browse files
committed
added constraint to Demo.compound
1 parent 6679b9c commit 87fbf51

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

demo/js/Demo.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@
137137

138138
size = 150;
139139
x = 400;
140+
y = 300;
140141

141142
var partC = Bodies.circle(x, y, 30),
142143
partD = Bodies.circle(x + size, y, 30),
@@ -147,7 +148,13 @@
147148
parts: [partC, partD, partE, partF]
148149
});
149150

150-
World.add(_world, [compoundBodyA, compoundBodyB]);
151+
var constraint = Constraint.create({
152+
pointA: { x: 400, y: 100 },
153+
bodyB: compoundBodyB,
154+
pointB: { x: 0, y: -50 }
155+
});
156+
157+
World.add(_world, [compoundBodyA, compoundBodyB, constraint]);
151158

152159
var renderOptions = _engine.render.options;
153160
renderOptions.showAxes = true;

0 commit comments

Comments
 (0)