mirror of
https://github.com/wassname/phaser.git
synced 2026-08-20 12:40:12 +08:00
Velocity integration tidied up. Now moving to sync Body with Sprite center point.
This commit is contained in:
@@ -29,11 +29,6 @@ Phaser.Physics.Arcade = function (game) {
|
||||
*/
|
||||
this.gravity = new Phaser.Point();
|
||||
|
||||
/**
|
||||
* @property {Phaser.Rectangle} bounds - The bounds inside of which the physics world exists. Defaults to match the world bounds.
|
||||
*/
|
||||
// this.bounds = new Phaser.Rectangle(0, 0, game.world.width, game.world.height);
|
||||
|
||||
/**
|
||||
* @property {Phaser.QuadTree} quadTree - The world QuadTree.
|
||||
*/
|
||||
@@ -91,6 +86,12 @@ Phaser.Physics.Arcade = function (game) {
|
||||
*/
|
||||
this._dy = 0;
|
||||
|
||||
/**
|
||||
* @property {Phaser.Point} _p - Internal cache var.
|
||||
* @private
|
||||
*/
|
||||
this._p = new Phaser.Point(0, 0);
|
||||
|
||||
/**
|
||||
* @property {number} _gravityX - Internal cache var.
|
||||
* @private
|
||||
@@ -123,6 +124,12 @@ Phaser.Physics.Arcade.RECT = 0;
|
||||
*/
|
||||
Phaser.Physics.Arcade.CIRCLE = 1;
|
||||
|
||||
/**
|
||||
* @constant
|
||||
* @type {number}
|
||||
*/
|
||||
Phaser.Physics.Arcade.POLYGON = 2;
|
||||
|
||||
Phaser.Physics.Arcade.prototype = {
|
||||
|
||||
/**
|
||||
@@ -194,8 +201,9 @@ Phaser.Physics.Arcade.prototype = {
|
||||
// pos = pos + dt*(vel + temp/2)
|
||||
// vel = vel + temp
|
||||
|
||||
body.motionVelocity.x = (body.acceleration.x + this._gravityX) * this.game.time.physicsElapsed;
|
||||
body.motionVelocity.y = (body.acceleration.y + this._gravityY) * this.game.time.physicsElapsed;
|
||||
this._p.setTo((body.acceleration.x + this._gravityX) * this.game.time.physicsElapsed, (body.acceleration.y + this._gravityY) * this.game.time.physicsElapsed);
|
||||
|
||||
return this._p;
|
||||
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user