Skip to content

Commit

Permalink
feat: update code
Browse files Browse the repository at this point in the history
  • Loading branch information
cptbtptpbcptdtptp committed Dec 11, 2024
1 parent 08a1b5c commit a0339f2
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions packages/core/src/Entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,17 +110,6 @@ export class Entity extends EngineObject {
return this._transform;
}

/**
* @internal
*/
set transform(value: Transform) {
const pre = this._transform;
if (value !== pre) {
pre && value?._copyFrom(pre);
this._transform = value;
}
}

/**
* Whether to activate locally.
*/
Expand Down Expand Up @@ -245,7 +234,7 @@ export class Entity extends EngineObject {
component._setActive(true, ActiveChangeFlag.All);
if (component instanceof Transform) {
const preTransform = this._transform;
this.transform = component;
this._setTransform(component);
preTransform?.destroy();
}
return component;
Expand Down Expand Up @@ -785,6 +774,14 @@ export class Entity extends EngineObject {
}
}

private _setTransform(value: Transform) {
const pre = this._transform;
if (value !== pre) {
pre && value?._copyFrom(pre);
this._transform = value;
}
}

//--------------------------------------------------------------deprecated----------------------------------------------------------------
private _invModelMatrix: Matrix = new Matrix();
private _inverseWorldMatFlag: BoolUpdateFlag;
Expand Down

0 comments on commit a0339f2

Please sign in to comment.