World.createDistanceConstraint signature changed to include new local anchors (thanks @rhmoller #1169)

This commit is contained in:
Richard Davey 2014-09-04 22:22:10 +01:00
parent a98fbc0c62
commit 55400ce988
2 changed files with 5 additions and 2 deletions

View file

@ -186,6 +186,7 @@ Version 2.1.0 - "Cairhien" - -in development-
### p2.js 0.6.0 Changes and New Features
* DistanceConstraint signature changed to take the new localAnchors.
* World.createDistanceConstraint signature changed to include new local anchors (thanks @rhmoller #1169)
* RevoluteConstraint signature changed to include worldPivot.
* P2.Body now uses the new Body.type value instead of Body.motionState, however as P2.Body already have a property called `type` we have left the `motionState` getter/setter in for now.
* World.enableBodySleeping has been removed and replaced with World.sleepMode.

View file

@ -815,10 +815,12 @@ Phaser.Physics.P2.prototype = {
* @param {Phaser.Sprite|Phaser.Physics.P2.Body|p2.Body} bodyA - First connected body.
* @param {Phaser.Sprite|Phaser.Physics.P2.Body|p2.Body} bodyB - Second connected body.
* @param {number} distance - The distance to keep between the bodies.
* @param {Array} [localAnchorA] - The anchor point for bodyA, defined locally in bodyA frame. Defaults to [0,0].
* @param {Array} [localAnchorB] - The anchor point for bodyB, defined locally in bodyB frame. Defaults to [0,0].
* @param {number} [maxForce] - The maximum force that should be applied to constrain the bodies.
* @return {Phaser.Physics.P2.DistanceConstraint} The constraint
*/
createDistanceConstraint: function (bodyA, bodyB, distance, maxForce) {
createDistanceConstraint: function (bodyA, bodyB, distance, localAnchorA, localAnchorB, maxForce) {
bodyA = this.getBody(bodyA);
bodyB = this.getBody(bodyB);
@ -829,7 +831,7 @@ Phaser.Physics.P2.prototype = {
}
else
{
return this.addConstraint(new Phaser.Physics.P2.DistanceConstraint(this, bodyA, bodyB, distance, maxForce));
return this.addConstraint(new Phaser.Physics.P2.DistanceConstraint(this, bodyA, bodyB, distance, localAnchorA, localAnchorB, maxForce));
}
},