mirror of
https://github.com/photonstorm/phaser
synced 2024-11-10 15:14:47 +00:00
Matter.Factory.fromVertices
can now take a vertices path string as its vertexSets
argument, as well as an array of vertices.
This commit is contained in:
parent
78d15b0b0f
commit
09318530a4
2 changed files with 12 additions and 5 deletions
|
@ -73,6 +73,7 @@ The following changes took place in the Pointer class:
|
|||
* The `TimeStep` will no longer set its `frame` property to zero in the `resetDelta` method. Instead, this property is incremented every step, no matter what, giving an accurate indication of exactly which frame something happened on internally.
|
||||
* The `TimeStep.step` method no longer uses the time value passed to the raf callback, as it's not actually the current point in time, but rather the time that the main thread began at. Which doesn't help if we're comparing it to event timestamps.
|
||||
* `TimeStep.now` is a new property that holds the exact `performance.now` value, as set at the start of the current game step.
|
||||
* `Matter.Factory.fromVertices` can now take a vertices path string as its `vertexSets` argument, as well as an array of vertices.
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ var MatterImage = require('./MatterImage');
|
|||
var MatterSprite = require('./MatterSprite');
|
||||
var MatterTileBody = require('./MatterTileBody');
|
||||
var PointerConstraint = require('./PointerConstraint');
|
||||
var Vertices = require('./lib/geometry/Vertices');
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
|
@ -162,16 +163,21 @@ var Factory = new Class({
|
|||
*
|
||||
* @param {number} x - The X coordinate of the center of the Body.
|
||||
* @param {number} y - The Y coordinate of the center of the Body.
|
||||
* @param {array} vertexSets - [description]
|
||||
* @param {object} options - [description]
|
||||
* @param {boolean} flagInternal - Flag internal edges (coincident part edges)
|
||||
* @param {boolean} removeCollinear - Whether Matter.js will discard collinear edges (to improve performance).
|
||||
* @param {number} minimumArea - During decomposition discard parts that have an area less than this
|
||||
* @param {(string|array)} vertexSets - [description]
|
||||
* @param {object} [options] - [description]
|
||||
* @param {boolean} [flagInternal=false] - Flag internal edges (coincident part edges)
|
||||
* @param {number} [removeCollinear=0.01] - Whether Matter.js will discard collinear edges (to improve performance).
|
||||
* @param {number} [minimumArea=10] - During decomposition discard parts that have an area less than this.
|
||||
*
|
||||
* @return {MatterJS.Body} A Matter JS Body.
|
||||
*/
|
||||
fromVertices: function (x, y, vertexSets, options, flagInternal, removeCollinear, minimumArea)
|
||||
{
|
||||
if (typeof vertexSets === 'string')
|
||||
{
|
||||
vertexSets = Vertices.fromPath(vertexSets);
|
||||
}
|
||||
|
||||
var body = Bodies.fromVertices(x, y, vertexSets, options, flagInternal, removeCollinear, minimumArea);
|
||||
|
||||
this.world.add(body);
|
||||
|
|
Loading…
Reference in a new issue