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:
parent
9393ecb5b2
commit
e41446493c
1 changed files with 8 additions and 4 deletions
|
@ -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)
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue