You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* @param {string} key - The key of the Physics Data file as stored in Game.Cache.
14518
14554
* @param {string} object - The key of the object within the Physics data file that you wish to load the shape data from.
14519
-
* @param {object} options - An object containing the build options. Note that this isn't used if the data file contains multiple shapes.
14520
-
* @param {boolean} [options.optimalDecomp=false] - Set to true if you need optimal decomposition. Warning: very slow for polygons with more than 10 vertices.
14521
-
* @param {boolean} [options.skipSimpleCheck=false] - Set to true if you already know that the path is not intersecting itself.
14522
-
* @param {boolean|number} [options.removeCollinearPoints=false] - Set to a number (angle threshold value) to remove collinear points, or false to keep all points.
// Move all vertices so its center of mass is in the local center of the convex
14559
-
for(varj=0;j!==c.vertices.length;j++)
14560
-
{
14561
-
varv=c.vertices[j];
14562
-
p2.vec2.sub(v,v,c.centerOfMass);
14563
-
}
14564
-
14565
-
p2.vec2.scale(cm,c.centerOfMass,1);
14566
-
14567
-
cm[0]-=this.world.pxmi(this.sprite.width/2);
14568
-
cm[1]-=this.world.pxmi(this.sprite.height/2);
14569
-
14570
-
c.updateTriangles();
14571
-
c.updateCenterOfMass();
14572
-
c.updateBoundingRadius();
14573
-
14574
-
this.data.addShape(c,cm);
14578
+
varv=c.vertices[j];
14579
+
p2.vec2.sub(v,v,c.centerOfMass);
14575
14580
}
14576
14581
14577
-
this.data.aabbNeedsUpdate=true;
14578
-
this.shapeChanged();
14582
+
p2.vec2.scale(cm,c.centerOfMass,1);
14579
14583
14580
-
returntrue;
14584
+
cm[0]-=this.world.pxmi(this.sprite.width/2);
14585
+
cm[1]-=this.world.pxmi(this.sprite.height/2);
14586
+
14587
+
c.updateTriangles();
14588
+
c.updateCenterOfMass();
14589
+
c.updateBoundingRadius();
14581
14590
14591
+
this.data.addShape(c,cm);
14582
14592
}
14583
14593
14584
-
returnfalse;
14594
+
this.data.aabbNeedsUpdate=true;
14595
+
this.shapeChanged();
14596
+
14597
+
returntrue;
14585
14598
14586
14599
},
14587
14600
14588
14601
/**
14602
+
* DEPRECATED: This method will soon be removed from the API. Please avoid using.
14589
14603
* Reads the physics data from a physics data file stored in the Game.Cache.
14590
-
* It will add the shape data to this Body, as well as set the density (mass), friction and bounce (restitution) values.
14604
+
* It will add the shape data to this Body, as well as set the density (mass).
14591
14605
*
14592
-
* @method Phaser.Physics.P2.Body#loadPolygon
14606
+
* @method Phaser.Physics.P2.Body#loadData
14593
14607
* @param {string} key - The key of the Physics Data file as stored in Game.Cache.
14594
14608
* @param {string} object - The key of the object within the Physics data file that you wish to load the shape data from.
14595
-
* @param {object} options - An object containing the build options:
14596
-
* @param {boolean} [options.optimalDecomp=false] - Set to true if you need optimal decomposition. Warning: very slow for polygons with more than 10 vertices.
14597
-
* @param {boolean} [options.skipSimpleCheck=false] - Set to true if you already know that the path is not intersecting itself.
14598
-
* @param {boolean|number} [options.removeCollinearPoints=false] - Set to a number (angle threshold value) to remove collinear points, or false to keep all points.
0 commit comments