lib/Fixture.js
function Fixture(body, shape, def) {
  if (shape.shape) {
    def = shape;
    shape = shape.shape;

  } else if (typeof def === 'number') {
    def = {density : def};
  }

  def = options(def, FixtureDef);

  this.m_body = body;

  this.m_friction = def.friction;
  this.m_restitution = def.restitution;
  this.m_density = def.density;
  this.m_isSensor = def.isSensor;

  this.m_filterGroupIndex = def.filterGroupIndex;
  this.m_filterCategoryBits = def.filterCategoryBits;
  this.m_filterMaskBits = def.filterMaskBits;

  // TODO validate shape
  this.m_shape = shape; //.clone();

  this.m_next = null;

  this.m_proxies = [];
  this.m_proxyCount = 0;

  var childCount = this.m_shape.getChildCount();
  for (var i = 0; i < childCount; ++i) {
    this.m_proxies[i] = new FixtureProxy(this, i);
  }

  this.m_userData = def.userData;
}
function Fixture(body, shape, def) {
  if (shape.shape) {
    def = shape;
    shape = shape.shape;

  } else if (typeof def === 'number') {
    def = {density : def};
  }

  def = options(def, FixtureDef);

  this.m_body = body;

  this.m_friction = def.friction;
  this.m_restitution = def.restitution;
  this.m_density = def.density;
  this.m_isSensor = def.isSensor;

  this.m_filterGroupIndex = def.filterGroupIndex;
  this.m_filterCategoryBits = def.filterCategoryBits;
  this.m_filterMaskBits = def.filterMaskBits;

  // TODO validate shape
  this.m_shape = shape; //.clone();

  this.m_next = null;

  this.m_proxies = [];
  this.m_proxyCount = 0;

  var childCount = this.m_shape.getChildCount();
  for (var i = 0; i < childCount; ++i) {
    this.m_proxies[i] = new FixtureProxy(this, i);
  }

  this.m_userData = def.userData;
}
function Fixture ( body , shape , def ) { if ( shape . shape ) { def = shape ; shape = shape . shape ; } else if ( typeof def === 'number' ) { def = { density : def } ; } def = options ( def , FixtureDef ) ; this . m_body = body ; this . m_friction = def . friction ; this . m_restitution = def . restitution ; this . m_density = def . density ; this . m_isSensor = def . isSensor ; this . m_filterGroupIndex = def . filterGroupIndex ; this . m_filterCategoryBits = def . filterCategoryBits ; this . m_filterMaskBits = def . filterMaskBits ; // TODO validate shape this . m_shape = shape ; //.clone(); this . m_next = null ; this . m_proxies = [ ] ; this . m_proxyCount = 0 ; var childCount = this . m_shape . getChildCount ( ) ; for ( var i = 0 ; i < childCount ; ++ i ) { this . m_proxies [ i ] = new FixtureProxy ( this , i ) ; } this . m_userData = def . userData ; }
A fixture is used to attach a shape to a body for collision detection. A
fixture inherits its transform from its parent. Fixtures hold additional
non-geometric data such as friction, collision filters, etc. Fixtures are
created via Body.createFixture.

@param {Body} body
@param {Shape|FixtureDef} shape Shape of fixture definition.
@param {FixtureDef|number} def Fixture definition or number.
A fixture is used to attach a shape to a body for collision detection . A fixture inherits its transform from its parent . Fixtures hold additional non - geometric data such as friction collision filters etc . Fixtures are created via Body . createFixture .