mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-01 07:42:38 +08:00
auto pull transform when node rebind to body or body added to world. (#3706)
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user