Body.setVelocity was cause the speed property to be set to NaN if you didn't provide a y argument.

This commit is contained in:
Richard Davey 2019-03-22 13:16:37 +00:00
parent bef0b163a2
commit cf504ac9c2
2 changed files with 5 additions and 6 deletions

View file

@ -35,6 +35,7 @@ Notes:
* The `Body.delta` values are now able to be read and acted upon during a Scene update, due to the new game step flow. This means you can now call `this.physics.collide` during a Scene `update` and it will work properly again. Fix #4370 (thanks @NokFrt)
* `ArcadePhysics.furthest` now iterates the bodies Set, rather than the RTree, which keeps it working even if the RTree has been disabled.
* `ArcadePhysics.closest` now iterates the bodies Set, rather than the RTree, which keeps it working even if the RTree has been disabled.
* `Body.setVelocity` was cause the `speed` property to be set to `NaN` if you didn't provide a `y` argument.
### Facebook Instant Games Plugin

View file

@ -1054,11 +1054,6 @@ var Body = new Class({
{
this.world.updateMotion(this, delta);
// if (!this.sleeping && this.gameObject.name === 'vu1')
// {
// console.log(this.world._frame, 'UP Y', velocity.y, position.y, this.prev.y, this.blockers.length);
// }
if (this.collideWorldBounds && !this.worldBlocked.none)
{
this.checkWorldRebound();
@ -1273,7 +1268,7 @@ var Body = new Class({
this.sleeping = true;
console.log(this.gameObject.name, 'put to sleep on frame', this.world._frame, 'force?', forceY, 'at', this.y);
this.velocity.set(0);
this.prevVelocity.set(0);
this.speed = 0;
@ -2084,6 +2079,9 @@ var Body = new Class({
{
this.velocity.set(x, y);
x = this.velocity.x;
y = this.velocity.y;
this.speed = Math.sqrt(x * x + y * y);
return this;