0 votes
67 views
asked in Box2D by (2.6k points)
Hi All

   How to Crete basics Physics world in javascript and can you please provide the sample code.

1 Answer

0 votes
answered by (8.2k points)

Hi 

The b2World is a Box2d world, where objects exist and interact with each other. The gravity parameter is a vector which indicates the force magnitude and direction.

function createWorld(){

    //Gravity vector x, y - 10 m/s2 - thats earth!!

    var gravity = new b2Vec2(0, -10);

   world = new b2World( gravity , true );

    createGround(world);

     return world;

}  

Categories

...