topical media & game development

talk show tell print

graphic-o3d-samples-box2d-3d-demos-pendulum.js / js



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


(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.