# Class: FixtureList

## Phaser.Physics.P2. FixtureList

Collection for generated P2 fixtures

#### new FixtureList(list)

  Allow to access a list of created fixture (coming from Body#addPhaserPolygon) which itself parse the input from PhysicsEditor with the custom phaser exporter. You can access fixtures of a Body by a group index or even by providing a fixture Key. You can set the fixture key and also the group index for a fixture in PhysicsEditor. This gives you the power to create a complex body built of many fixtures and modify them during runtime (to remove parts, set masks, categories & sensor properties)

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `list` | Array | A list of fixtures (from Phaser.Physics.P2.Body#addPhaserPolygon)

  Source:
    - physics/p2/FixtureList.js, line 24

### Methods

#### flatten(array)

  A helper to flatten arrays. This is very useful as the fixtures are nested from time to time due to the way P2 creates and splits polygons.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `array` | array | The array to flatten. Notice: This will happen recursive not shallow.

  Source:
    - physics/p2/FixtureList.js, line 213

#### getFixtureByKey(key)

  Accessor to get either a single fixture by its key.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `key` | string | The key of the fixture.

  Source:
    - physics/p2/FixtureList.js, line 159

#### getFixtures(keys)

  Accessor to get either a list of specified fixtures by key or the whole fixture list

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `keys` | array | A list of fixture keys

  Source:
    - physics/p2/FixtureList.js, line 124

#### getGroup(groupID)

  Accessor to get a group of fixtures by its group index.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `groupID` | number | The group index.

  Source:
    - physics/p2/FixtureList.js, line 171

#### init()

  Source:
    - physics/p2/FixtureList.js, line 39

#### parse()

  Parser for the output of Phaser.Physics.P2.Body#addPhaserPolygon

  Source:
    - physics/p2/FixtureList.js, line 183

#### setCategory(bit, fixtureKey)

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `bit` | number | The bit to set as the collision group.
  `fixtureKey` | string | Only apply to the fixture with the given key.

  Source:
    - physics/p2/FixtureList.js, line 64

#### setMask(bit, fixtureKey)

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `bit` | number | The bit to set as the collision mask
  `fixtureKey` | string | Only apply to the fixture with the given key

  Source:
    - physics/p2/FixtureList.js, line 79

#### setMaterial(material, fixtureKey)

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `material` | Object | The contact material for a fixture
  `fixtureKey` | string | Only apply to the fixture with the given key

  Source:
    - physics/p2/FixtureList.js, line 109

#### setSensor(value, fixtureKey)

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `value` | boolean | sensor true or false
  `fixtureKey` | string | Only apply to the fixture with the given key

  Source:
    - physics/p2/FixtureList.js, line 94