0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2024-11-23 09:26:51 -05:00

handle null constraint points in Constraint.pointAWorld and Constraint.pointBWorld

This commit is contained in:
liabru 2021-12-21 20:09:01 +00:00
parent 9393ecb5b2
commit e41446493c

View file

@ -308,8 +308,10 @@ var Common = require('../core/Common');
*/ */
Constraint.pointAWorld = function(constraint) { Constraint.pointAWorld = function(constraint) {
return { return {
x: (constraint.bodyA ? constraint.bodyA.position.x : 0) + constraint.pointA.x, x: (constraint.bodyA ? constraint.bodyA.position.x : 0)
y: (constraint.bodyA ? constraint.bodyA.position.y : 0) + constraint.pointA.y + (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) { Constraint.pointBWorld = function(constraint) {
return { return {
x: (constraint.bodyB ? constraint.bodyB.position.x : 0) + constraint.pointB.x, x: (constraint.bodyB ? constraint.bodyB.position.x : 0)
y: (constraint.bodyB ? constraint.bodyB.position.y : 0) + constraint.pointB.y + (constraint.pointB ? constraint.pointB.x : 0),
y: (constraint.bodyB ? constraint.bodyB.position.y : 0)
+ (constraint.pointB ? constraint.pointB.y : 0)
}; };
}; };