mirror of
https://github.com/liabru/matter-js.git
synced 2024-11-27 09:50:52 -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) {
|
||||
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)
|
||||
};
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue