mirror of
https://github.com/photonstorm/phaser
synced 2024-11-24 21:53:59 +00:00
added getter for center of mass
This commit is contained in:
parent
4719694f33
commit
bc4186061c
1 changed files with 9 additions and 0 deletions
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
var Body = require('../lib/body/Body');
|
||||
var Vector2 = require('../../../math/Vector2');
|
||||
|
||||
/**
|
||||
* [description]
|
||||
|
@ -46,6 +47,14 @@ var Mass = {
|
|||
Body.setDensity(this.body, value);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
centerOfMass: {
|
||||
|
||||
get: function ()
|
||||
{
|
||||
return new Vector2(this.body.render.sprite.xOffset * this.width, this.body.render.sprite.yOffset * this.height);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue