Game Development Reference
In-Depth Information
fixtureDef.restitution=0.4;
fixtureDef.friction=0.5;
var theIdol:b2Body=world.CreateBody(bodyDef);
theIdol.CreateFixture(fixtureDef);
var bW:Number=5/worldScale;
var bH:Number=20/worldScale;
var boxPos:b2Vec2=new b2Vec2(0,10/worldScale);
var boxAngle:Number=-Math.PI/4;
polygonShape.SetAsOrientedBox(bW,bH,boxPos,boxAngle);
fixtureDef.shape=polygonShape;
theIdol.CreateFixture(fixtureDef);
boxAngle=Math.PI/4;
polygonShape.SetAsOrientedBox(bW,bH,boxPos,boxAngle);
fixtureDef.shape=polygonShape;
theIdol.CreateFixture(fixtureDef);
var vertices:Vector.<b2Vec2>=new Vector.<b2Vec2>();
vertices.push(new b2Vec2(-15/worldScale,
-25/worldScale));
vertices.push(new b2Vec2(0,-40/worldScale));
vertices.push(new b2Vec2(15/worldScale,
-25/worldScale));
vertices.push(new b2Vec2(0,-10/worldScale));
polygonShape.SetAsVector(vertices,4);
fixtureDef.shape=polygonShape;
theIdol.CreateFixture(fixtureDef);
}
6.
Test the movie and you'll finally see your complete idol on the top of the totem:
 
Search WWH ::




Custom Search