From e41446493cfd4aa411b772e8bcf3348a4fed3594 Mon Sep 17 00:00:00 2001 From: liabru Date: Tue, 21 Dec 2021 20:09:01 +0000 Subject: [PATCH] handle null constraint points in Constraint.pointAWorld and Constraint.pointBWorld --- src/constraint/Constraint.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/constraint/Constraint.js b/src/constraint/Constraint.js index bb40fa5..cebdbc5 100644 --- a/src/constraint/Constraint.js +++ b/src/constraint/Constraint.js @@ -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) }; }; @@ -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) }; };