additionally save fixtures by key

This commit is contained in:
Georgios Kaleadis 2014-04-10 21:28:14 +02:00
parent 289b5b2532
commit 1213cae0a4

View file

@ -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;