Skip to content

Commit

Permalink
additionally save fixtures by key
Browse files Browse the repository at this point in the history
  • Loading branch information
georgiee committed Apr 10, 2014
1 parent 289b5b2 commit 1213cae
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/physics/p2/Body.js
Original file line number Diff line number Diff line change
Expand Up @@ -1113,8 +1113,15 @@ Phaser.Physics.P2.Body.prototype = {
{
var fixtureData = data[i];
var shapesOfFixture = this.addFixture(fixtureData);
createdFixtures[fixtureData.filter.group] = createdFixtures[fixtureData.filter.group] || [];
createdFixtures[fixtureData.filter.group].push(shapesOfFixture);

//always add to a group
createdFixtures[fixtureData.filter.group] = createdFixtures[fixtureData.filter.group] || []
createdFixtures[fixtureData.filter.group] = createdFixtures[fixtureData.filter.group].concat(shapesOfFixture)

//if (unique) fixture key is provided
if(fixtureData.fixtureKey){
createdFixtures[fixtureData.fixtureKey] = shapesOfFixture
}
}

this.data.aabbNeedsUpdate = true;
Expand Down

0 comments on commit 1213cae

Please sign in to comment.