June 2015
Beginner
354 pages
8h 23m
English
Carry out the following steps to create a car with the box and wheels:
createCarAt, which takes the coordinates as arguments. Then, move the body and the wheel creation code in this function. Afterwards, add the following highlighted joint creation code. At last, return the car body:function createCarAt(x, y) { var bodyDef = new b2BodyDef; var fixDef = new b2FixtureDef; // car body bodyDef.type = b2Body.b2_dynamicBody; bodyDef.position.x = 50/pxPerMeter; bodyDef.position.y = 210/pxPerMeter; fixDef.shape = new b2PolygonShape(); fixDef.density = 1.0; fixDef.friction ...Read now
Unlock full access