auto pull transform when node rebind to body or body added to world. (#3706)

This commit is contained in:
Leslie Leigh
2019-01-07 14:20:19 +08:00
committed by pandamicro
parent f10fbdf265
commit 4fa9f07f33
+3
View File
@@ -52,6 +52,7 @@ export class PhysicsBody {
public bind(node: Node) {
this._node = node;
this.pullTransform();
}
public destroy() {
@@ -59,6 +60,8 @@ export class PhysicsBody {
}
public _onAdded() {
this.pullTransform();
this._onWorldBeforeStepListener = this._onWorldBeforeStep.bind(this);
this._cannonBody.world.addEventListener('beforeStep', this._onWorldBeforeStepListener);