blob: 730d0392e5ae284ea1d00462e50c36ae5be32238 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
// This file comes from Box2D-JS, Copyright (c) 2008 ANDO Yasushi.
// The original version is available at http://box2d-js.sourceforge.net/ under the
// zlib/libpng license (see License.txt).
// This version has been modified to make it work with O3D.
demos.pendulum = {};
demos.pendulum.initWorld = function(world) {
var i;
var ground = world.GetGroundBody();
var jointDef = new b2RevoluteJointDef();
var L = 150;
for (i = 0; i < 4; i++) {
jointDef.anchorPoint.Set(250 + 40 * i, 200 - L);
jointDef.body1 = ground;
jointDef.body2 = createBall(world, 250 + 40 * i, 200);
world.CreateJoint(jointDef);
}
jointDef.anchorPoint.Set(250 - 40, 200 - L);
jointDef.body1 = ground;
jointDef.body2 = createBall(world, 250 - 40 - L, 200 - L);
world.CreateJoint(jointDef);
}
demos.InitWorlds.push(demos.pendulum.initWorld);
|