@galacean/engine-core 1.0.0-beta.19 → 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.
@@ -376,33 +376,28 @@ function _inherits(subClass, superClass) {
376
376
  return Color;
377
377
  }();
378
378
 
379
- /******************************************************************************
380
- Copyright (c) Microsoft Corporation.
381
-
382
- Permission to use, copy, modify, and/or distribute this software for any
383
- purpose with or without fee is hereby granted.
384
-
385
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
386
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
387
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
388
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
389
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
390
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
391
- PERFORMANCE OF THIS SOFTWARE.
392
- ***************************************************************************** */
393
-
394
- function __decorate(decorators, target, key, desc) {
395
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
396
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
397
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
398
- return c > 3 && r && Object.defineProperty(target, key, r), r;
379
+ /******************************************************************************
380
+ Copyright (c) Microsoft Corporation.
381
+
382
+ Permission to use, copy, modify, and/or distribute this software for any
383
+ purpose with or without fee is hereby granted.
384
+
385
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
386
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
387
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
388
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
389
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
390
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
391
+ PERFORMANCE OF THIS SOFTWARE.
392
+ ***************************************************************************** */
393
+
394
+ function __decorate(decorators, target, key, desc) {
395
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
396
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
397
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
398
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
399
399
  }
400
400
 
401
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
402
- var e = new Error(message);
403
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
404
- };
405
-
406
401
  function _instanceof(left, right) {
407
402
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
408
403
  return !!right[Symbol.hasInstance](left);
@@ -5666,6 +5661,7 @@ var Collision = function Collision() {
5666
5661
  var _this = this;
5667
5662
  /** @internal */ this._initialized = false;
5668
5663
  this._restTime = 0;
5664
+ this._fixedTimeStep = 1 / 60;
5669
5665
  this._colliders = new DisorderedArray();
5670
5666
  this._gravity = new miniprogram.Vector3(0, -9.81, 0);
5671
5667
  this._physicalObjectsMap = {};
@@ -5777,7 +5773,6 @@ var Collision = function Collision() {
5777
5773
  script1._waitHandlingInValid || script1.onTriggerStay(shape1);
5778
5774
  }
5779
5775
  };
5780
- /** The fixed time step in seconds at which physics are performed. */ this.fixedTimeStep = 1 / 60;
5781
5776
  this._engine = engine;
5782
5777
  this._setGravity = this._setGravity.bind(this);
5783
5778
  //@ts-ignore
@@ -5837,7 +5832,7 @@ var Collision = function Collision() {
5837
5832
  * Call on every frame to update pose of objects.
5838
5833
  * @internal
5839
5834
  */ _proto._update = function _update(deltaTime) {
5840
- var _this = this, fixedTimeStep = _this.fixedTimeStep, nativePhysicsManager = _this._nativePhysicsManager;
5835
+ var _this = this, fixedTimeStep = _this._fixedTimeStep, nativePhysicsManager = _this._nativePhysicsManager;
5841
5836
  var componentsManager = this._engine._componentsManager;
5842
5837
  var simulateTime = this._restTime + deltaTime;
5843
5838
  var step = Math.floor(simulateTime / fixedTimeStep);
@@ -5945,6 +5940,15 @@ var Collision = function Collision() {
5945
5940
  gravity.copyFrom(value);
5946
5941
  }
5947
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
+ }
5948
5952
  }
5949
5953
  ]);
5950
5954
  return PhysicsManager;
@@ -9537,6 +9541,7 @@ __decorate([
9537
9541
  CloneManager.deepCloneObject(this.renderStates, target.renderStates);
9538
9542
  };
9539
9543
  _proto._addReferCount = function _addReferCount(value) {
9544
+ if (this._destroyed) return;
9540
9545
  ReferResource.prototype._addReferCount.call(this, value);
9541
9546
  this.shaderData._addReferCount(value);
9542
9547
  };
package/dist/module.js CHANGED
@@ -371,33 +371,28 @@ function _inherits(subClass, superClass) {
371
371
  return Color;
372
372
  }();
373
373
 
374
- /******************************************************************************
375
- Copyright (c) Microsoft Corporation.
376
-
377
- Permission to use, copy, modify, and/or distribute this software for any
378
- purpose with or without fee is hereby granted.
379
-
380
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
381
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
382
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
383
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
384
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
385
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
386
- PERFORMANCE OF THIS SOFTWARE.
387
- ***************************************************************************** */
388
-
389
- function __decorate(decorators, target, key, desc) {
390
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
391
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
392
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
393
- return c > 3 && r && Object.defineProperty(target, key, r), r;
374
+ /******************************************************************************
375
+ Copyright (c) Microsoft Corporation.
376
+
377
+ Permission to use, copy, modify, and/or distribute this software for any
378
+ purpose with or without fee is hereby granted.
379
+
380
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
381
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
382
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
383
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
384
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
385
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
386
+ PERFORMANCE OF THIS SOFTWARE.
387
+ ***************************************************************************** */
388
+
389
+ function __decorate(decorators, target, key, desc) {
390
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
391
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
392
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
393
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
394
394
  }
395
395
 
396
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
397
- var e = new Error(message);
398
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
399
- };
400
-
401
396
  function _instanceof(left, right) {
402
397
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
403
398
  return !!right[Symbol.hasInstance](left);
@@ -5661,6 +5656,7 @@ var Collision = function Collision() {
5661
5656
  var _this = this;
5662
5657
  /** @internal */ this._initialized = false;
5663
5658
  this._restTime = 0;
5659
+ this._fixedTimeStep = 1 / 60;
5664
5660
  this._colliders = new DisorderedArray();
5665
5661
  this._gravity = new Vector3(0, -9.81, 0);
5666
5662
  this._physicalObjectsMap = {};
@@ -5772,7 +5768,6 @@ var Collision = function Collision() {
5772
5768
  script1._waitHandlingInValid || script1.onTriggerStay(shape1);
5773
5769
  }
5774
5770
  };
5775
- /** The fixed time step in seconds at which physics are performed. */ this.fixedTimeStep = 1 / 60;
5776
5771
  this._engine = engine;
5777
5772
  this._setGravity = this._setGravity.bind(this);
5778
5773
  //@ts-ignore
@@ -5832,7 +5827,7 @@ var Collision = function Collision() {
5832
5827
  * Call on every frame to update pose of objects.
5833
5828
  * @internal
5834
5829
  */ _proto._update = function _update(deltaTime) {
5835
- var _this = this, fixedTimeStep = _this.fixedTimeStep, nativePhysicsManager = _this._nativePhysicsManager;
5830
+ var _this = this, fixedTimeStep = _this._fixedTimeStep, nativePhysicsManager = _this._nativePhysicsManager;
5836
5831
  var componentsManager = this._engine._componentsManager;
5837
5832
  var simulateTime = this._restTime + deltaTime;
5838
5833
  var step = Math.floor(simulateTime / fixedTimeStep);
@@ -5940,6 +5935,15 @@ var Collision = function Collision() {
5940
5935
  gravity.copyFrom(value);
5941
5936
  }
5942
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
+ }
5943
5947
  }
5944
5948
  ]);
5945
5949
  return PhysicsManager;
@@ -9532,6 +9536,7 @@ __decorate([
9532
9536
  CloneManager.deepCloneObject(this.renderStates, target.renderStates);
9533
9537
  };
9534
9538
  _proto._addReferCount = function _addReferCount(value) {
9539
+ if (this._destroyed) return;
9535
9540
  ReferResource.prototype._addReferCount.call(this, value);
9536
9541
  this.shaderData._addReferCount(value);
9537
9542
  };