0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2024-11-30 10:20:52 -05:00

added ids to constraints

This commit is contained in:
liabru 2014-03-20 00:42:52 +00:00
parent e4445bc791
commit abe379840d

View file

@ -17,7 +17,8 @@ var Constraint = {};
(function() {
var _minLength = 0.000001;
var _minLength = 0.000001,
_nextId = 0;
/**
* Description
@ -51,6 +52,7 @@ var Constraint = {};
constraint.render = Common.extend(render, constraint.render);
// option defaults
constraint.id = constraint.id || Constraint.nextId();
constraint.stiffness = constraint.stiffness || 1;
constraint.angularStiffness = constraint.angularStiffness || 0;
constraint.angleA = constraint.bodyA ? constraint.bodyA.angle : constraint.angleA;
@ -221,4 +223,13 @@ var Constraint = {};
};
/**
* Returns the next unique constraintId
* @method nextId
* @return {Number} Unique constraintId
*/
Constraint.nextId = function() {
return _nextId++;
};
})();