Box2dWeb chain shapes?

Hi!

Is it possible to use chain shapes with Box2DWeb?

I can't seem to figure out the correct syntax for that. Lets say I have coordinates 1,1,2,2,3,3 which should create a chain with 3 points (right?).

Then I have this:

Code: Select all

  bodyDef.type = b2Body.b2_staticBody;
  bodyDef.position.x = 4;
  bodyDef.position.y = 4;
  fixDef.shape = new b2PolygonShape;
  fixDef.shape.SetAsEdge(1,1,2,2,3,3); //3 point edge creation is obviously not working with SetAsEdge
  world.CreateBody(bodyDef).CreateFixture(fixDef);


How should I modify my code to draw a chain shape with three points? Is that even possible with Box2dWeb?
Last I checked, box2dweb does not support chain shapes. You can make a sequence of individual edges which will work the same in many cases.

Original thread: https://box2d.org/forum/viewtopic.php?t=9490