topical media & game development

talk show tell print

#javascript-physics-demos-pendulum.js / js



  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);
  
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.