lib/shape/ChainShape.js
function ChainShape(vertices, loop) {
  if (!(this instanceof ChainShape)) {
    return new ChainShape(vertices, loop);
  }

  ChainShape._super.call(this);

  this.m_type = ChainShape.TYPE;
  this.m_radius = Settings.polygonRadius;
  this.m_vertices = [];
  this.m_count = 0;
  this.m_prevVertex = null;
  this.m_nextVertex = null;
  this.m_hasPrevVertex = false;
  this.m_hasNextVertex = false;

  this.m_isLoop = loop;

  if (vertices && vertices.length) {
    if (loop) {
      this._createLoop(vertices);
    } else {
      this._createChain(vertices);
    }
  }
}
function ChainShape(vertices, loop) {
  if (!(this instanceof ChainShape)) {
    return new ChainShape(vertices, loop);
  }

  ChainShape._super.call(this);

  this.m_type = ChainShape.TYPE;
  this.m_radius = Settings.polygonRadius;
  this.m_vertices = [];
  this.m_count = 0;
  this.m_prevVertex = null;
  this.m_nextVertex = null;
  this.m_hasPrevVertex = false;
  this.m_hasNextVertex = false;

  this.m_isLoop = loop;

  if (vertices && vertices.length) {
    if (loop) {
      this._createLoop(vertices);
    } else {
      this._createChain(vertices);
    }
  }
}
function ChainShape ( vertices , loop ) { if ( ! ( this instanceof ChainShape ) ) { return new ChainShape ( vertices , loop ) ; } ChainShape . _super . call ( this ) ; this . m_type = ChainShape . TYPE ; this . m_radius = Settings . polygonRadius ; this . m_vertices = [ ] ; this . m_count = 0 ; this . m_prevVertex = null ; this . m_nextVertex = null ; this . m_hasPrevVertex = false ; this . m_hasNextVertex = false ; this . m_isLoop = loop ; if ( vertices && vertices . length ) { if ( loop ) { this . _createLoop ( vertices ) ; } else { this . _createChain ( vertices ) ; } } }
A chain shape is a free form sequence of line segments. The chain has
two-sided collision, so you can use inside and outside collision. Therefore,
you may use any winding order. Connectivity information is used to create
smooth collisions.

WARNING: The chain will not collide properly if there are self-intersections.
A chain shape is a free form sequence of line segments . The chain has two - sided collision so you can use inside and outside collision . Therefore you may use any winding order . Connectivity information is used to create smooth collisions .