mirror of
https://github.com/photonstorm/phaser
synced 2024-11-23 05:03:37 +00:00
Merged new pointAWorld and pointBWorld functions
This commit is contained in:
parent
257c00228b
commit
dc127081eb
1 changed files with 26 additions and 0 deletions
|
@ -304,6 +304,32 @@ var Common = require('../core/Common');
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the world-space position of `constraint.pointA`, accounting for `constraint.bodyA`.
|
||||
* @method pointAWorld
|
||||
* @param {constraint} constraint
|
||||
* @returns {vector} the world-space position
|
||||
*/
|
||||
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
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the world-space position of `constraint.pointB`, accounting for `constraint.bodyB`.
|
||||
* @method pointBWorld
|
||||
* @param {constraint} constraint
|
||||
* @returns {vector} the world-space position
|
||||
*/
|
||||
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
|
||||
};
|
||||
};
|
||||
|
||||
/*
|
||||
*
|
||||
* Properties Documentation
|
||||
|
|
Loading…
Reference in a new issue