Skip to content

Commit 277afa1

Browse files
committed
method docs
1 parent af847de commit 277afa1

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

src/physics/p2/Body.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,7 +1095,14 @@ Phaser.Physics.P2.Body.prototype = {
10951095

10961096
},
10971097

1098-
loadPhaserPolygon: function (key, object, options) {
1098+
/**
1099+
* Reads the shape data from a physics data file stored in the Game.Cache and adds it as a polygon to this Body.
1100+
* The shape data format is based on the custom phaser export in PhysicsEditor
1101+
* @method Phaser.Physics.P2.Body#loadPhaserPolygon
1102+
* @param {string} key - The key of the Physics Data file as stored in Game.Cache.
1103+
* @param {string} object - The key of the object within the Physics data file that you wish to load the shape data from.
1104+
*/
1105+
loadPhaserPolygon: function (key, object) {
10991106
var data = this.game.cache.getPhysicsData(key, object);
11001107
//cycle through the fixtures
11011108
for (var i = 0; i < data.length; i++)
@@ -1123,7 +1130,7 @@ Phaser.Physics.P2.Body.prototype = {
11231130
console.log('addPolygonFixture', fixtureData)
11241131

11251132
if (fixtureData.circle){
1126-
//a circle has unfortunately no position in p2
1133+
//a circle has unfortunately no position in p2. pretty useless.
11271134
var shape = new p2.Circle(this.world.pxm(fixtureData.circle.radius))
11281135
shape.collisionGroup = fixtureData.filter.categoryBits
11291136
shape.collisionMask = fixtureData.filter.maskBits
@@ -1211,7 +1218,6 @@ Phaser.Physics.P2.Body.prototype = {
12111218
for (var i = 0; i < data.length; i++)
12121219
{
12131220
var vertices = [];
1214-
console.log(data[i].filter.categoryBits)
12151221
for (var s = 0; s < data[i].shape.length; s += 2)
12161222
{
12171223
vertices.push([ this.world.pxmi(data[i].shape[s]), this.world.pxmi(data[i].shape[s + 1]) ]);

0 commit comments

Comments
 (0)