@galacean/engine-core 1.0.0-beta.18 → 1.0.0-beta.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3955,6 +3955,23 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
3955
3955
  scale.z < 0 && (isInvert = !isInvert);
3956
3956
  return isInvert;
3957
3957
  };
3958
+ _proto._onDestroy = function _onDestroy() {
3959
+ Component.prototype._onDestroy.call(this);
3960
+ //@ts-ignore
3961
+ this._worldPosition._onValueChanged = null;
3962
+ //@ts-ignore
3963
+ this._rotation._onValueChanged = null;
3964
+ //@ts-ignore
3965
+ this._worldRotation._onValueChanged = null;
3966
+ //@ts-ignore
3967
+ this._rotationQuaternion._onValueChanged = null;
3968
+ //@ts-ignore
3969
+ this._worldRotationQuaternion._onValueChanged = null;
3970
+ //@ts-ignore
3971
+ this._position._onValueChanged = null;
3972
+ //@ts-ignore
3973
+ this._scale._onValueChanged = null;
3974
+ };
3958
3975
  /**
3959
3976
  * Get worldMatrix: Will trigger the worldMatrix update of itself and all parent entities.
3960
3977
  * Get worldPosition: Will trigger the worldMatrix, local position update of itself and the worldMatrix update of all parent entities.
@@ -4648,6 +4665,7 @@ var ComponentCloner = /*#__PURE__*/ function() {
4648
4665
  return component;
4649
4666
  }
4650
4667
  }
4668
+ return null;
4651
4669
  };
4652
4670
  /**
4653
4671
  * Get components which match the type.
@@ -5643,6 +5661,7 @@ var Collision = function Collision() {
5643
5661
  var _this = this;
5644
5662
  /** @internal */ this._initialized = false;
5645
5663
  this._restTime = 0;
5664
+ this._fixedTimeStep = 1 / 60;
5646
5665
  this._colliders = new DisorderedArray();
5647
5666
  this._gravity = new miniprogram.Vector3(0, -9.81, 0);
5648
5667
  this._physicalObjectsMap = {};
@@ -5754,7 +5773,6 @@ var Collision = function Collision() {
5754
5773
  script1._waitHandlingInValid || script1.onTriggerStay(shape1);
5755
5774
  }
5756
5775
  };
5757
- /** The fixed time step in seconds at which physics are performed. */ this.fixedTimeStep = 1 / 60;
5758
5776
  this._engine = engine;
5759
5777
  this._setGravity = this._setGravity.bind(this);
5760
5778
  //@ts-ignore
@@ -5814,7 +5832,7 @@ var Collision = function Collision() {
5814
5832
  * Call on every frame to update pose of objects.
5815
5833
  * @internal
5816
5834
  */ _proto._update = function _update(deltaTime) {
5817
- var _this = this, fixedTimeStep = _this.fixedTimeStep, nativePhysicsManager = _this._nativePhysicsManager;
5835
+ var _this = this, fixedTimeStep = _this._fixedTimeStep, nativePhysicsManager = _this._nativePhysicsManager;
5818
5836
  var componentsManager = this._engine._componentsManager;
5819
5837
  var simulateTime = this._restTime + deltaTime;
5820
5838
  var step = Math.floor(simulateTime / fixedTimeStep);
@@ -5922,6 +5940,15 @@ var Collision = function Collision() {
5922
5940
  gravity.copyFrom(value);
5923
5941
  }
5924
5942
  }
5943
+ },
5944
+ {
5945
+ key: "fixedTimeStep",
5946
+ get: /** The fixed time step in seconds at which physics are performed. */ function get() {
5947
+ return this._fixedTimeStep;
5948
+ },
5949
+ set: function set(value) {
5950
+ this._fixedTimeStep = Math.max(value, miniprogram.MathUtil.zeroTolerance);
5951
+ }
5925
5952
  }
5926
5953
  ]);
5927
5954
  return PhysicsManager;
@@ -9514,6 +9541,7 @@ __decorate([
9514
9541
  CloneManager.deepCloneObject(this.renderStates, target.renderStates);
9515
9542
  };
9516
9543
  _proto._addReferCount = function _addReferCount(value) {
9544
+ if (this._destroyed) return;
9517
9545
  ReferResource.prototype._addReferCount.call(this, value);
9518
9546
  this.shaderData._addReferCount(value);
9519
9547
  };
package/dist/module.js CHANGED
@@ -3950,6 +3950,23 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
3950
3950
  scale.z < 0 && (isInvert = !isInvert);
3951
3951
  return isInvert;
3952
3952
  };
3953
+ _proto._onDestroy = function _onDestroy() {
3954
+ Component.prototype._onDestroy.call(this);
3955
+ //@ts-ignore
3956
+ this._worldPosition._onValueChanged = null;
3957
+ //@ts-ignore
3958
+ this._rotation._onValueChanged = null;
3959
+ //@ts-ignore
3960
+ this._worldRotation._onValueChanged = null;
3961
+ //@ts-ignore
3962
+ this._rotationQuaternion._onValueChanged = null;
3963
+ //@ts-ignore
3964
+ this._worldRotationQuaternion._onValueChanged = null;
3965
+ //@ts-ignore
3966
+ this._position._onValueChanged = null;
3967
+ //@ts-ignore
3968
+ this._scale._onValueChanged = null;
3969
+ };
3953
3970
  /**
3954
3971
  * Get worldMatrix: Will trigger the worldMatrix update of itself and all parent entities.
3955
3972
  * Get worldPosition: Will trigger the worldMatrix, local position update of itself and the worldMatrix update of all parent entities.
@@ -4643,6 +4660,7 @@ var ComponentCloner = /*#__PURE__*/ function() {
4643
4660
  return component;
4644
4661
  }
4645
4662
  }
4663
+ return null;
4646
4664
  };
4647
4665
  /**
4648
4666
  * Get components which match the type.
@@ -5638,6 +5656,7 @@ var Collision = function Collision() {
5638
5656
  var _this = this;
5639
5657
  /** @internal */ this._initialized = false;
5640
5658
  this._restTime = 0;
5659
+ this._fixedTimeStep = 1 / 60;
5641
5660
  this._colliders = new DisorderedArray();
5642
5661
  this._gravity = new Vector3(0, -9.81, 0);
5643
5662
  this._physicalObjectsMap = {};
@@ -5749,7 +5768,6 @@ var Collision = function Collision() {
5749
5768
  script1._waitHandlingInValid || script1.onTriggerStay(shape1);
5750
5769
  }
5751
5770
  };
5752
- /** The fixed time step in seconds at which physics are performed. */ this.fixedTimeStep = 1 / 60;
5753
5771
  this._engine = engine;
5754
5772
  this._setGravity = this._setGravity.bind(this);
5755
5773
  //@ts-ignore
@@ -5809,7 +5827,7 @@ var Collision = function Collision() {
5809
5827
  * Call on every frame to update pose of objects.
5810
5828
  * @internal
5811
5829
  */ _proto._update = function _update(deltaTime) {
5812
- var _this = this, fixedTimeStep = _this.fixedTimeStep, nativePhysicsManager = _this._nativePhysicsManager;
5830
+ var _this = this, fixedTimeStep = _this._fixedTimeStep, nativePhysicsManager = _this._nativePhysicsManager;
5813
5831
  var componentsManager = this._engine._componentsManager;
5814
5832
  var simulateTime = this._restTime + deltaTime;
5815
5833
  var step = Math.floor(simulateTime / fixedTimeStep);
@@ -5917,6 +5935,15 @@ var Collision = function Collision() {
5917
5935
  gravity.copyFrom(value);
5918
5936
  }
5919
5937
  }
5938
+ },
5939
+ {
5940
+ key: "fixedTimeStep",
5941
+ get: /** The fixed time step in seconds at which physics are performed. */ function get() {
5942
+ return this._fixedTimeStep;
5943
+ },
5944
+ set: function set(value) {
5945
+ this._fixedTimeStep = Math.max(value, MathUtil$1.zeroTolerance);
5946
+ }
5920
5947
  }
5921
5948
  ]);
5922
5949
  return PhysicsManager;
@@ -9509,6 +9536,7 @@ __decorate([
9509
9536
  CloneManager.deepCloneObject(this.renderStates, target.renderStates);
9510
9537
  };
9511
9538
  _proto._addReferCount = function _addReferCount(value) {
9539
+ if (this._destroyed) return;
9512
9540
  ReferResource.prototype._addReferCount.call(this, value);
9513
9541
  this.shaderData._addReferCount(value);
9514
9542
  };