Merge pull request #3541 from josephjaniga/staticbody-offset

[bugfix] StaticBody.setOffset fix for issue #3465
This commit is contained in:
Richard Davey 2018-04-11 10:20:55 +01:00 committed by GitHub
commit bca3df1064
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -443,8 +443,14 @@ var StaticBody = new Class({
this.world.staticTree.remove(this);
this.position.x -= this.offset.x;
this.position.y -= this.offset.y;
this.offset.set(x, y);
this.position.x += this.offset.x;
this.position.y += this.offset.y;
this.updateCenter();
this.world.staticTree.insert(this);