Skip to content

Commit

Permalink
handle null constraint points in Constraint.pointAWorld and Constrain…
Browse files Browse the repository at this point in the history
…t.pointBWorld
  • Loading branch information
liabru committed Dec 21, 2021
1 parent 9393ecb commit e414464
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/constraint/Constraint.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,10 @@ var Common = require('../core/Common');
*/
Constraint.pointAWorld = function(constraint) {
return {
x: (constraint.bodyA ? constraint.bodyA.position.x : 0) + constraint.pointA.x,
y: (constraint.bodyA ? constraint.bodyA.position.y : 0) + constraint.pointA.y
x: (constraint.bodyA ? constraint.bodyA.position.x : 0)
+ (constraint.pointA ? constraint.pointA.x : 0),
y: (constraint.bodyA ? constraint.bodyA.position.y : 0)
+ (constraint.pointA ? constraint.pointA.y : 0)
};
};

Expand All @@ -321,8 +323,10 @@ var Common = require('../core/Common');
*/
Constraint.pointBWorld = function(constraint) {
return {
x: (constraint.bodyB ? constraint.bodyB.position.x : 0) + constraint.pointB.x,
y: (constraint.bodyB ? constraint.bodyB.position.y : 0) + constraint.pointB.y
x: (constraint.bodyB ? constraint.bodyB.position.x : 0)
+ (constraint.pointB ? constraint.pointB.x : 0),
y: (constraint.bodyB ? constraint.bodyB.position.y : 0)
+ (constraint.pointB ? constraint.pointB.y : 0)
};
};

Expand Down

0 comments on commit e414464

Please sign in to comment.