@galacean/engine-core 1.1.0-beta.6 → 1.1.0-beta.8

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.
@@ -554,6 +554,7 @@ function _instanceof(left, right) {
554
554
  for(var i = 0; i < length; i++){
555
555
  CloneManager.cloneProperty(sourceProperty, targetPropertyA, i, cloneMode);
556
556
  }
557
+ break;
557
558
  default:
558
559
  var _target, _k;
559
560
  var targetOProperty = (_target = target)[_k = k] || (_target[_k] = new sourceProperty.constructor());
@@ -2835,14 +2836,14 @@ exports.DependentMode = void 0;
2835
2836
  }
2836
2837
  return end;
2837
2838
  };
2838
- _proto.forEach = function forEach(callbackFn) {
2839
+ _proto.forEach = function forEach(callbackFn, swapFn) {
2839
2840
  this._startLoop();
2840
2841
  var elements = this._elements;
2841
2842
  for(var i = 0; i < this.length; i++){
2842
2843
  var element = elements[i];
2843
2844
  element && callbackFn(element);
2844
2845
  }
2845
- this._endLoop();
2846
+ this._endLoop(swapFn);
2846
2847
  };
2847
2848
  _proto.forEachAndClean = function forEachAndClean(callbackFn) {
2848
2849
  this._startLoop();
@@ -2859,16 +2860,24 @@ exports.DependentMode = void 0;
2859
2860
  _proto._startLoop = function _startLoop() {
2860
2861
  this._isLooping = true;
2861
2862
  };
2862
- _proto._endLoop = function _endLoop() {
2863
+ _proto._endLoop = function _endLoop(swapFn) {
2863
2864
  this._isLooping = false;
2864
2865
  if (this._blankCount) {
2866
+ var from = 0;
2867
+ var to = this.length - 1;
2865
2868
  var elements = this._elements;
2866
- for(var i = 0, j = 0, n = this.length; i < n; i++){
2867
- var element = elements[i];
2868
- if (element) {
2869
- elements[j++] = element;
2870
- }
2871
- }
2869
+ partition: do {
2870
+ while(elements[from])if (++from >= to) {
2871
+ break partition;
2872
+ }
2873
+ while(!elements[to])if (from >= --to) {
2874
+ break partition;
2875
+ }
2876
+ var swapElement = elements[to];
2877
+ swapFn(swapElement, from);
2878
+ elements[from++] = swapElement;
2879
+ elements[to--] = null;
2880
+ }while (from < to);
2872
2881
  this.length -= this._blankCount;
2873
2882
  this._blankCount = 0;
2874
2883
  }
@@ -13285,11 +13294,15 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
13285
13294
  if (this._currentEnteredEntity) {
13286
13295
  this._currentEnteredEntity._scripts.forEach(function(element) {
13287
13296
  element.onPointerExit(_this);
13297
+ }, function(element, index) {
13298
+ element._entityScriptsIndex = index;
13288
13299
  });
13289
13300
  }
13290
13301
  if (rayCastEntity) {
13291
13302
  rayCastEntity._scripts.forEach(function(element) {
13292
13303
  element.onPointerEnter(_this);
13304
+ }, function(element, index) {
13305
+ element._entityScriptsIndex = index;
13293
13306
  });
13294
13307
  }
13295
13308
  this._currentEnteredEntity = rayCastEntity;
@@ -13302,6 +13315,8 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
13302
13315
  if (rayCastEntity) {
13303
13316
  rayCastEntity._scripts.forEach(function(element) {
13304
13317
  element.onPointerDown(_this);
13318
+ }, function(element, index) {
13319
+ element._entityScriptsIndex = index;
13305
13320
  });
13306
13321
  }
13307
13322
  this._currentPressedEntity = rayCastEntity;
@@ -13313,6 +13328,8 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
13313
13328
  if (this._currentPressedEntity) {
13314
13329
  this._currentPressedEntity._scripts.forEach(function(element) {
13315
13330
  element.onPointerDrag(_this);
13331
+ }, function(element, index) {
13332
+ element._entityScriptsIndex = index;
13316
13333
  });
13317
13334
  }
13318
13335
  };
@@ -13326,6 +13343,8 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
13326
13343
  pressedEntity._scripts.forEach(function(element) {
13327
13344
  sameTarget && element.onPointerClick(_this);
13328
13345
  element.onPointerUp(_this);
13346
+ }, function(element, index) {
13347
+ element._entityScriptsIndex = index;
13329
13348
  });
13330
13349
  this._currentPressedEntity = null;
13331
13350
  }
@@ -13899,11 +13918,24 @@ exports.Collider = /*#__PURE__*/ function(Component1) {
13899
13918
  };
13900
13919
  /**
13901
13920
  * @internal
13921
+ */ _proto._cloneTo = function _cloneTo(target) {
13922
+ var shapes = target._shapes;
13923
+ for(var i = 0, n = shapes.length; i < n; i++){
13924
+ target._addPhysicsShape(shapes[i]);
13925
+ }
13926
+ };
13927
+ /**
13928
+ * @internal
13902
13929
  */ _proto._onDestroy = function _onDestroy() {
13903
13930
  Component1.prototype._onDestroy.call(this);
13904
13931
  this.clearShapes();
13905
13932
  this._nativeCollider.destroy();
13906
13933
  };
13934
+ _proto._addPhysicsShape = function _addPhysicsShape(shape) {
13935
+ shape._collider = this;
13936
+ this._nativeCollider.addShape(shape._nativeShape);
13937
+ this._phasedActiveInScene && this.scene.physics._addColliderShape(shape);
13938
+ };
13907
13939
  _create_class(Collider, [
13908
13940
  {
13909
13941
  key: "shapes",
@@ -13919,6 +13951,15 @@ exports.Collider = /*#__PURE__*/ function(Component1) {
13919
13951
  __decorate([
13920
13952
  ignoreClone
13921
13953
  ], exports.Collider.prototype, "_index", void 0);
13954
+ __decorate([
13955
+ ignoreClone
13956
+ ], exports.Collider.prototype, "_nativeCollider", void 0);
13957
+ __decorate([
13958
+ ignoreClone
13959
+ ], exports.Collider.prototype, "_updateFlag", void 0);
13960
+ __decorate([
13961
+ deepClone
13962
+ ], exports.Collider.prototype, "_shapes", void 0);
13922
13963
  exports.Collider = __decorate([
13923
13964
  dependentComponents(Transform, exports.DependentMode.CheckOnly)
13924
13965
  ], exports.Collider);
@@ -13943,11 +13984,15 @@ var Collision = function Collision() {
13943
13984
  var collision = PhysicsScene._collision;
13944
13985
  collision.shape = shape2;
13945
13986
  element.onCollisionEnter(collision);
13987
+ }, function(element, index) {
13988
+ element._entityScriptsIndex = index;
13946
13989
  });
13947
13990
  shape2.collider.entity._scripts.forEach(function(element) {
13948
13991
  var collision = PhysicsScene._collision;
13949
13992
  collision.shape = shape1;
13950
13993
  element.onCollisionEnter(collision);
13994
+ }, function(element, index) {
13995
+ element._entityScriptsIndex = index;
13951
13996
  });
13952
13997
  };
13953
13998
  this._onContactExit = function(obj1, obj2) {
@@ -13958,11 +14003,15 @@ var Collision = function Collision() {
13958
14003
  var collision = PhysicsScene._collision;
13959
14004
  collision.shape = shape2;
13960
14005
  element.onCollisionExit(collision);
14006
+ }, function(element, index) {
14007
+ element._entityScriptsIndex = index;
13961
14008
  });
13962
14009
  shape2.collider.entity._scripts.forEach(function(element) {
13963
14010
  var collision = PhysicsScene._collision;
13964
14011
  collision.shape = shape1;
13965
14012
  element.onCollisionExit(collision);
14013
+ }, function(element, index) {
14014
+ element._entityScriptsIndex = index;
13966
14015
  });
13967
14016
  };
13968
14017
  this._onContactStay = function(obj1, obj2) {
@@ -13973,11 +14022,15 @@ var Collision = function Collision() {
13973
14022
  var collision = PhysicsScene._collision;
13974
14023
  collision.shape = shape2;
13975
14024
  element.onCollisionStay(collision);
14025
+ }, function(element, index) {
14026
+ element._entityScriptsIndex = index;
13976
14027
  });
13977
14028
  shape2.collider.entity._scripts.forEach(function(element) {
13978
14029
  var collision = PhysicsScene._collision;
13979
14030
  collision.shape = shape1;
13980
14031
  element.onCollisionStay(collision);
14032
+ }, function(element, index) {
14033
+ element._entityScriptsIndex = index;
13981
14034
  });
13982
14035
  };
13983
14036
  this._onTriggerEnter = function(obj1, obj2) {
@@ -13986,9 +14039,13 @@ var Collision = function Collision() {
13986
14039
  var shape2 = physicalObjectsMap[obj2];
13987
14040
  shape1.collider.entity._scripts.forEach(function(element) {
13988
14041
  element.onTriggerEnter(shape2);
14042
+ }, function(element, index) {
14043
+ element._entityScriptsIndex = index;
13989
14044
  });
13990
14045
  shape2.collider.entity._scripts.forEach(function(element) {
13991
14046
  element.onTriggerEnter(shape1);
14047
+ }, function(element, index) {
14048
+ element._entityScriptsIndex = index;
13992
14049
  });
13993
14050
  };
13994
14051
  this._onTriggerExit = function(obj1, obj2) {
@@ -13997,9 +14054,13 @@ var Collision = function Collision() {
13997
14054
  var shape2 = physicalObjectsMap[obj2];
13998
14055
  shape1.collider.entity._scripts.forEach(function(element) {
13999
14056
  element.onTriggerExit(shape2);
14057
+ }, function(element, index) {
14058
+ element._entityScriptsIndex = index;
14000
14059
  });
14001
14060
  shape2.collider.entity._scripts.forEach(function(element) {
14002
14061
  element.onTriggerExit(shape1);
14062
+ }, function(element, index) {
14063
+ element._entityScriptsIndex = index;
14003
14064
  });
14004
14065
  };
14005
14066
  this._onTriggerStay = function(obj1, obj2) {
@@ -14008,9 +14069,13 @@ var Collision = function Collision() {
14008
14069
  var shape2 = physicalObjectsMap[obj2];
14009
14070
  shape1.collider.entity._scripts.forEach(function(element) {
14010
14071
  element.onTriggerStay(shape2);
14072
+ }, function(element, index) {
14073
+ element._entityScriptsIndex = index;
14011
14074
  });
14012
14075
  shape2.collider.entity._scripts.forEach(function(element) {
14013
14076
  element.onTriggerStay(shape1);
14077
+ }, function(element, index) {
14078
+ element._entityScriptsIndex = index;
14014
14079
  });
14015
14080
  };
14016
14081
  this._scene = scene;
@@ -14043,6 +14108,9 @@ var Collision = function Collision() {
14043
14108
  }
14044
14109
  var onRaycast = function(obj) {
14045
14110
  var shape = _this._scene.engine._physicalObjectsMap[obj];
14111
+ if (!shape) {
14112
+ return false;
14113
+ }
14046
14114
  return shape.collider.entity.layer & layerMask && shape.isSceneQuery;
14047
14115
  };
14048
14116
  if (hitResult != undefined) {
@@ -14267,7 +14335,6 @@ var Collision = function Collision() {
14267
14335
  */ _proto._onLateUpdate = function _onLateUpdate() {
14268
14336
  var position = this.entity.transform.worldPosition;
14269
14337
  this._nativeCollider.getWorldPosition(position);
14270
- this.entity.transform.worldPosition = position;
14271
14338
  this._updateFlag.flag = false;
14272
14339
  };
14273
14340
  /**
@@ -14424,6 +14491,25 @@ var Collision = function Collision() {
14424
14491
  this._nativeCollider.getWorldTransform(worldPosition, worldRotationQuaternion);
14425
14492
  this._updateFlag.flag = false;
14426
14493
  };
14494
+ /**
14495
+ * @internal
14496
+ */ _proto._cloneTo = function _cloneTo(target) {
14497
+ Collider1.prototype._cloneTo.call(this, target);
14498
+ target.linearDamping = this.linearDamping;
14499
+ target.angularDamping = this.angularDamping;
14500
+ target.linearVelocity = this.linearVelocity;
14501
+ target.angularVelocity = this.angularVelocity;
14502
+ target.mass = this.mass;
14503
+ target.centerOfMass = this.centerOfMass;
14504
+ target.inertiaTensor = this.inertiaTensor;
14505
+ target.maxAngularVelocity = this.maxAngularVelocity;
14506
+ target.maxDepenetrationVelocity = this.maxDepenetrationVelocity;
14507
+ target.sleepThreshold = this.sleepThreshold;
14508
+ target.solverIterations = this.solverIterations;
14509
+ target.isKinematic = this.isKinematic;
14510
+ target.constraints = this.constraints;
14511
+ target.collisionDetectionMode = this.collisionDetectionMode;
14512
+ };
14427
14513
  _proto._setLinearVelocity = function _setLinearVelocity() {
14428
14514
  this._nativeCollider.setLinearVelocity(this._linearVelocity);
14429
14515
  };
@@ -14632,6 +14718,48 @@ var Collision = function Collision() {
14632
14718
  ]);
14633
14719
  return DynamicCollider;
14634
14720
  }(exports.Collider);
14721
+ __decorate([
14722
+ ignoreClone
14723
+ ], DynamicCollider.prototype, "_linearDamping", void 0);
14724
+ __decorate([
14725
+ ignoreClone
14726
+ ], DynamicCollider.prototype, "_angularDamping", void 0);
14727
+ __decorate([
14728
+ ignoreClone
14729
+ ], DynamicCollider.prototype, "_linearVelocity", void 0);
14730
+ __decorate([
14731
+ ignoreClone
14732
+ ], DynamicCollider.prototype, "_angularVelocity", void 0);
14733
+ __decorate([
14734
+ ignoreClone
14735
+ ], DynamicCollider.prototype, "_mass", void 0);
14736
+ __decorate([
14737
+ ignoreClone
14738
+ ], DynamicCollider.prototype, "_centerOfMass", void 0);
14739
+ __decorate([
14740
+ ignoreClone
14741
+ ], DynamicCollider.prototype, "_inertiaTensor", void 0);
14742
+ __decorate([
14743
+ ignoreClone
14744
+ ], DynamicCollider.prototype, "_maxAngularVelocity", void 0);
14745
+ __decorate([
14746
+ ignoreClone
14747
+ ], DynamicCollider.prototype, "_maxDepenetrationVelocity", void 0);
14748
+ __decorate([
14749
+ ignoreClone
14750
+ ], DynamicCollider.prototype, "_solverIterations", void 0);
14751
+ __decorate([
14752
+ ignoreClone
14753
+ ], DynamicCollider.prototype, "_isKinematic", void 0);
14754
+ __decorate([
14755
+ ignoreClone
14756
+ ], DynamicCollider.prototype, "_constraints", void 0);
14757
+ __decorate([
14758
+ ignoreClone
14759
+ ], DynamicCollider.prototype, "_collisionDetectionMode", void 0);
14760
+ __decorate([
14761
+ ignoreClone
14762
+ ], DynamicCollider.prototype, "_sleepThreshold", void 0);
14635
14763
  exports.CollisionDetectionMode = void 0;
14636
14764
  (function(CollisionDetectionMode) {
14637
14765
  CollisionDetectionMode[CollisionDetectionMode["Discrete"] = 0] = "Discrete";
@@ -14684,7 +14812,8 @@ exports.DynamicColliderConstraints = void 0;
14684
14812
  /**
14685
14813
  * @internal
14686
14814
  */ _proto._destroy = function _destroy() {
14687
- this._nativeMaterial.destroy();
14815
+ !this._destroyed && this._nativeMaterial.destroy();
14816
+ this._destroyed = true;
14688
14817
  };
14689
14818
  _create_class(PhysicsMaterial, [
14690
14819
  {
@@ -14799,24 +14928,37 @@ exports.Joint = /*#__PURE__*/ function(Component1) {
14799
14928
  function Joint(entity) {
14800
14929
  var _this;
14801
14930
  _this = Component1.call(this, entity) || this;
14802
- _this._connectedCollider = new JointCollider();
14803
- _this._collider = new JointCollider();
14931
+ _this._colliderInfo = new JointColliderInfo();
14932
+ _this._connectedColliderInfo = new JointColliderInfo();
14804
14933
  _this._force = 0;
14805
14934
  _this._torque = 0;
14806
- _this._connectedCollider.localPosition = new miniprogram.Vector3();
14935
+ _this._connectedColliderInfo.localPosition = new miniprogram.Vector3();
14807
14936
  return _this;
14808
14937
  }
14938
+ var _proto = Joint.prototype;
14939
+ /**
14940
+ * @internal
14941
+ */ _proto._cloneTo = function _cloneTo(target) {
14942
+ target.connectedCollider = this.connectedCollider;
14943
+ target.connectedAnchor = this.connectedAnchor;
14944
+ target.connectedMassScale = this.connectedMassScale;
14945
+ target.connectedInertiaScale = this.connectedInertiaScale;
14946
+ target.massScale = this.massScale;
14947
+ target.inertiaScale = this.inertiaScale;
14948
+ target.breakForce = this.breakForce;
14949
+ target.breakTorque = this.breakTorque;
14950
+ };
14809
14951
  _create_class(Joint, [
14810
14952
  {
14811
14953
  key: "connectedCollider",
14812
14954
  get: /**
14813
14955
  * The connected collider.
14814
14956
  */ function get() {
14815
- return this._connectedCollider.collider;
14957
+ return this._connectedColliderInfo.collider;
14816
14958
  },
14817
14959
  set: function set(value) {
14818
- if (this._connectedCollider.collider !== value) {
14819
- this._connectedCollider.collider = value;
14960
+ if (this._connectedColliderInfo.collider !== value) {
14961
+ this._connectedColliderInfo.collider = value;
14820
14962
  this._nativeJoint.setConnectedCollider(value._nativeCollider);
14821
14963
  }
14822
14964
  }
@@ -14827,10 +14969,10 @@ exports.Joint = /*#__PURE__*/ function(Component1) {
14827
14969
  * The connected anchor position.
14828
14970
  * @remarks If connectedCollider is set, this anchor is relative offset, or the anchor is world position.
14829
14971
  */ function get() {
14830
- return this._connectedCollider.localPosition;
14972
+ return this._connectedColliderInfo.localPosition;
14831
14973
  },
14832
14974
  set: function set(value) {
14833
- var connectedAnchor = this._connectedCollider.localPosition;
14975
+ var connectedAnchor = this._connectedColliderInfo.localPosition;
14834
14976
  if (value !== connectedAnchor) {
14835
14977
  connectedAnchor.copyFrom(value);
14836
14978
  }
@@ -14842,11 +14984,11 @@ exports.Joint = /*#__PURE__*/ function(Component1) {
14842
14984
  get: /**
14843
14985
  * The scale to apply to the inverse mass of collider 0 for resolving this constraint.
14844
14986
  */ function get() {
14845
- return this._connectedCollider.massScale;
14987
+ return this._connectedColliderInfo.massScale;
14846
14988
  },
14847
14989
  set: function set(value) {
14848
- if (value !== this._connectedCollider.massScale) {
14849
- this._connectedCollider.massScale = value;
14990
+ if (value !== this._connectedColliderInfo.massScale) {
14991
+ this._connectedColliderInfo.massScale = value;
14850
14992
  this._nativeJoint.setConnectedMassScale(value);
14851
14993
  }
14852
14994
  }
@@ -14856,11 +14998,11 @@ exports.Joint = /*#__PURE__*/ function(Component1) {
14856
14998
  get: /**
14857
14999
  * The scale to apply to the inverse inertia of collider0 for resolving this constraint.
14858
15000
  */ function get() {
14859
- return this._connectedCollider.inertiaScale;
15001
+ return this._connectedColliderInfo.inertiaScale;
14860
15002
  },
14861
15003
  set: function set(value) {
14862
- if (value !== this._connectedCollider.inertiaScale) {
14863
- this._connectedCollider.inertiaScale = value;
15004
+ if (value !== this._connectedColliderInfo.inertiaScale) {
15005
+ this._connectedColliderInfo.inertiaScale = value;
14864
15006
  this._nativeJoint.setConnectedInertiaScale(value);
14865
15007
  }
14866
15008
  }
@@ -14870,11 +15012,11 @@ exports.Joint = /*#__PURE__*/ function(Component1) {
14870
15012
  get: /**
14871
15013
  * The scale to apply to the inverse mass of collider 1 for resolving this constraint.
14872
15014
  */ function get() {
14873
- return this._collider.massScale;
15015
+ return this._colliderInfo.massScale;
14874
15016
  },
14875
15017
  set: function set(value) {
14876
- if (value !== this._collider.massScale) {
14877
- this._collider.massScale = value;
15018
+ if (value !== this._colliderInfo.massScale) {
15019
+ this._colliderInfo.massScale = value;
14878
15020
  this._nativeJoint.setMassScale(value);
14879
15021
  }
14880
15022
  }
@@ -14884,11 +15026,11 @@ exports.Joint = /*#__PURE__*/ function(Component1) {
14884
15026
  get: /**
14885
15027
  * The scale to apply to the inverse inertia of collider1 for resolving this constraint.
14886
15028
  */ function get() {
14887
- return this._collider.inertiaScale;
15029
+ return this._colliderInfo.inertiaScale;
14888
15030
  },
14889
15031
  set: function set(value) {
14890
- if (value !== this._collider.inertiaScale) {
14891
- this._collider.inertiaScale = value;
15032
+ if (value !== this._colliderInfo.inertiaScale) {
15033
+ this._colliderInfo.inertiaScale = value;
14892
15034
  this._nativeJoint.setInertiaScale(value);
14893
15035
  }
14894
15036
  }
@@ -14924,12 +15066,27 @@ exports.Joint = /*#__PURE__*/ function(Component1) {
14924
15066
  ]);
14925
15067
  return Joint;
14926
15068
  }(Component);
15069
+ __decorate([
15070
+ ignoreClone
15071
+ ], exports.Joint.prototype, "_colliderInfo", void 0);
15072
+ __decorate([
15073
+ ignoreClone
15074
+ ], exports.Joint.prototype, "_connectedColliderInfo", void 0);
15075
+ __decorate([
15076
+ ignoreClone
15077
+ ], exports.Joint.prototype, "_nativeJoint", void 0);
15078
+ __decorate([
15079
+ ignoreClone
15080
+ ], exports.Joint.prototype, "_force", void 0);
15081
+ __decorate([
15082
+ ignoreClone
15083
+ ], exports.Joint.prototype, "_torque", void 0);
14927
15084
  exports.Joint = __decorate([
14928
15085
  dependentComponents(exports.Collider, exports.DependentMode.CheckOnly)
14929
15086
  ], exports.Joint);
14930
15087
  /**
14931
15088
  * @internal
14932
- */ var JointCollider = function JointCollider() {
15089
+ */ var JointColliderInfo = function JointColliderInfo() {
14933
15090
  this.collider = null;
14934
15091
  this.massScale = 0;
14935
15092
  this.inertiaScale = 0;
@@ -14946,7 +15103,7 @@ exports.Joint = __decorate([
14946
15103
  /**
14947
15104
  * @internal
14948
15105
  */ _proto._onAwake = function _onAwake() {
14949
- var collider = this._collider;
15106
+ var collider = this._colliderInfo;
14950
15107
  collider.collider = this.entity.getComponent(exports.Collider);
14951
15108
  this._nativeJoint = PhysicsScene._nativePhysics.createFixedJoint(collider.collider._nativeCollider);
14952
15109
  };
@@ -14980,11 +15137,22 @@ exports.Joint = __decorate([
14980
15137
  /**
14981
15138
  * @internal
14982
15139
  */ _proto._onAwake = function _onAwake() {
14983
- var collider = this._collider;
15140
+ var collider = this._colliderInfo;
14984
15141
  collider.localPosition = new miniprogram.Vector3();
14985
15142
  collider.collider = this.entity.getComponent(exports.Collider);
14986
15143
  this._nativeJoint = PhysicsScene._nativePhysics.createHingeJoint(collider.collider._nativeCollider);
14987
15144
  };
15145
+ /**
15146
+ * @internal
15147
+ */ _proto._cloneTo = function _cloneTo(target) {
15148
+ target.axis = this.axis;
15149
+ target.swingOffset = this.swingOffset;
15150
+ target.useLimits = this.useLimits;
15151
+ target.useMotor = this.useMotor;
15152
+ target.useSpring = this.useSpring;
15153
+ target.motor = this.motor;
15154
+ target.limits = this.limits;
15155
+ };
14988
15156
  _create_class(HingeJoint, [
14989
15157
  {
14990
15158
  key: "axis",
@@ -15006,10 +15174,10 @@ exports.Joint = __decorate([
15006
15174
  get: /**
15007
15175
  * The swing offset.
15008
15176
  */ function get() {
15009
- return this._collider.localPosition;
15177
+ return this._colliderInfo.localPosition;
15010
15178
  },
15011
15179
  set: function set(value) {
15012
- var swingOffset = this._collider.localPosition;
15180
+ var swingOffset = this._colliderInfo.localPosition;
15013
15181
  if (value !== swingOffset) {
15014
15182
  swingOffset.copyFrom(value);
15015
15183
  }
@@ -15112,6 +15280,21 @@ exports.Joint = __decorate([
15112
15280
  ]);
15113
15281
  return HingeJoint;
15114
15282
  }(exports.Joint);
15283
+ __decorate([
15284
+ ignoreClone
15285
+ ], HingeJoint.prototype, "_axis", void 0);
15286
+ __decorate([
15287
+ ignoreClone
15288
+ ], HingeJoint.prototype, "_hingeFlags", void 0);
15289
+ __decorate([
15290
+ ignoreClone
15291
+ ], HingeJoint.prototype, "_useSpring", void 0);
15292
+ __decorate([
15293
+ ignoreClone
15294
+ ], HingeJoint.prototype, "_jointMonitor", void 0);
15295
+ __decorate([
15296
+ ignoreClone
15297
+ ], HingeJoint.prototype, "_limits", void 0);
15115
15298
 
15116
15299
  /**
15117
15300
  * A joint that maintains an upper or lower bound (or both) on the distance between two points on different objects.
@@ -15131,21 +15314,31 @@ exports.Joint = __decorate([
15131
15314
  /**
15132
15315
  * @internal
15133
15316
  */ _proto._onAwake = function _onAwake() {
15134
- var collider = this._collider;
15317
+ var collider = this._colliderInfo;
15135
15318
  collider.localPosition = new miniprogram.Vector3();
15136
15319
  collider.collider = this.entity.getComponent(exports.Collider);
15137
15320
  this._nativeJoint = PhysicsScene._nativePhysics.createSpringJoint(collider.collider._nativeCollider);
15138
15321
  };
15322
+ /**
15323
+ * @internal
15324
+ */ _proto._cloneTo = function _cloneTo(target) {
15325
+ target.swingOffset = this.swingOffset;
15326
+ target.minDistance = this.minDistance;
15327
+ target.maxDistance = this.maxDistance;
15328
+ target.tolerance = this.tolerance;
15329
+ target.stiffness = this.stiffness;
15330
+ target.damping = this.damping;
15331
+ };
15139
15332
  _create_class(SpringJoint, [
15140
15333
  {
15141
15334
  key: "swingOffset",
15142
15335
  get: /**
15143
15336
  * The swing offset.
15144
15337
  */ function get() {
15145
- return this._collider.localPosition;
15338
+ return this._colliderInfo.localPosition;
15146
15339
  },
15147
15340
  set: function set(value) {
15148
- var swingOffset = this._collider.localPosition;
15341
+ var swingOffset = this._colliderInfo.localPosition;
15149
15342
  if (value !== swingOffset) {
15150
15343
  swingOffset.copyFrom(value);
15151
15344
  }
@@ -15270,6 +15463,15 @@ exports.Joint = __decorate([
15270
15463
  var _proto = ColliderShape.prototype;
15271
15464
  /**
15272
15465
  * @internal
15466
+ */ _proto._cloneTo = function _cloneTo(target) {
15467
+ target.contactOffset = this.contactOffset;
15468
+ target.rotation = this.rotation;
15469
+ target.position = this.position;
15470
+ target.isTrigger = this.isTrigger;
15471
+ target.material = this.material;
15472
+ };
15473
+ /**
15474
+ * @internal
15273
15475
  */ _proto._destroy = function _destroy() {
15274
15476
  this._material._destroy();
15275
15477
  this._nativeShape.destroy();
@@ -15371,6 +15573,30 @@ exports.Joint = __decorate([
15371
15573
  (function() {
15372
15574
  ColliderShape._idGenerator = 0;
15373
15575
  })();
15576
+ __decorate([
15577
+ ignoreClone
15578
+ ], ColliderShape.prototype, "_collider", void 0);
15579
+ __decorate([
15580
+ ignoreClone
15581
+ ], ColliderShape.prototype, "_nativeShape", void 0);
15582
+ __decorate([
15583
+ ignoreClone
15584
+ ], ColliderShape.prototype, "_id", void 0);
15585
+ __decorate([
15586
+ ignoreClone
15587
+ ], ColliderShape.prototype, "_material", void 0);
15588
+ __decorate([
15589
+ ignoreClone
15590
+ ], ColliderShape.prototype, "_isTrigger", void 0);
15591
+ __decorate([
15592
+ ignoreClone
15593
+ ], ColliderShape.prototype, "_rotation", void 0);
15594
+ __decorate([
15595
+ ignoreClone
15596
+ ], ColliderShape.prototype, "_position", void 0);
15597
+ __decorate([
15598
+ ignoreClone
15599
+ ], ColliderShape.prototype, "_contactOffset", void 0);
15374
15600
 
15375
15601
  /**
15376
15602
  * Physical collider shape for box.
@@ -15387,6 +15613,12 @@ exports.Joint = __decorate([
15387
15613
  return _this;
15388
15614
  }
15389
15615
  var _proto = BoxColliderShape.prototype;
15616
+ /**
15617
+ * @internal
15618
+ */ _proto._cloneTo = function _cloneTo(target) {
15619
+ ColliderShape1.prototype._cloneTo.call(this, target);
15620
+ target.size = this.size;
15621
+ };
15390
15622
  _proto._setSize = function _setSize() {
15391
15623
  this._nativeShape.setSize(this._size);
15392
15624
  };
@@ -15407,6 +15639,9 @@ exports.Joint = __decorate([
15407
15639
  ]);
15408
15640
  return BoxColliderShape;
15409
15641
  }(ColliderShape);
15642
+ __decorate([
15643
+ ignoreClone
15644
+ ], BoxColliderShape.prototype, "_size", void 0);
15410
15645
 
15411
15646
  /**
15412
15647
  * Physical collider shape for sphere.
@@ -15419,6 +15654,11 @@ exports.Joint = __decorate([
15419
15654
  _this._nativeShape = PhysicsScene._nativePhysics.createSphereColliderShape(_this._id, _this._radius, _this._material._nativeMaterial);
15420
15655
  return _this;
15421
15656
  }
15657
+ var _proto = SphereColliderShape.prototype;
15658
+ _proto._cloneTo = function _cloneTo(target) {
15659
+ ColliderShape1.prototype._cloneTo.call(this, target);
15660
+ target.radius = this.radius;
15661
+ };
15422
15662
  _create_class(SphereColliderShape, [
15423
15663
  {
15424
15664
  key: "radius",
@@ -15437,6 +15677,9 @@ exports.Joint = __decorate([
15437
15677
  ]);
15438
15678
  return SphereColliderShape;
15439
15679
  }(ColliderShape);
15680
+ __decorate([
15681
+ ignoreClone
15682
+ ], SphereColliderShape.prototype, "_radius", void 0);
15440
15683
 
15441
15684
  /**
15442
15685
  * Physical collider shape plane.
@@ -15464,6 +15707,15 @@ exports.Joint = __decorate([
15464
15707
  _this._nativeShape = PhysicsScene._nativePhysics.createCapsuleColliderShape(_this._id, _this._radius, _this._height, _this._material._nativeMaterial);
15465
15708
  return _this;
15466
15709
  }
15710
+ var _proto = CapsuleColliderShape.prototype;
15711
+ /**
15712
+ * @internal
15713
+ */ _proto._cloneTo = function _cloneTo(target) {
15714
+ ColliderShape1.prototype._cloneTo.call(this, target);
15715
+ target.radius = this.radius;
15716
+ target.height = this.height;
15717
+ target.upAxis = this.upAxis;
15718
+ };
15467
15719
  _create_class(CapsuleColliderShape, [
15468
15720
  {
15469
15721
  key: "radius",
@@ -15510,6 +15762,15 @@ exports.Joint = __decorate([
15510
15762
  ]);
15511
15763
  return CapsuleColliderShape;
15512
15764
  }(ColliderShape);
15765
+ __decorate([
15766
+ ignoreClone
15767
+ ], CapsuleColliderShape.prototype, "_radius", void 0);
15768
+ __decorate([
15769
+ ignoreClone
15770
+ ], CapsuleColliderShape.prototype, "_height", void 0);
15771
+ __decorate([
15772
+ ignoreClone
15773
+ ], CapsuleColliderShape.prototype, "_upAxis", void 0);
15513
15774
 
15514
15775
  /**
15515
15776
  * Pointer Manager.
@@ -17074,13 +17335,12 @@ ShaderPool.init();
17074
17335
  /**
17075
17336
  * @internal
17076
17337
  */ _proto._resizeBackgroundTexture = function _resizeBackgroundTexture() {
17338
+ var _this = this, texture = _this._texture, mesh = _this._mesh;
17077
17339
  if (!this._texture) {
17078
17340
  return;
17079
17341
  }
17080
- var canvas = this._engine.canvas;
17081
- var width = canvas.width, height = canvas.height;
17082
- var _this = this, _backgroundTextureMesh = _this._mesh;
17083
- var positions = _backgroundTextureMesh.getPositions();
17342
+ var _this__engine_canvas = this._engine.canvas, width = _this__engine_canvas.width, height = _this__engine_canvas.height;
17343
+ var positions = mesh.getPositions();
17084
17344
  switch(this._textureFillMode){
17085
17345
  case exports.BackgroundTextureFillMode.Fill:
17086
17346
  positions[0].set(-1, -1, 1);
@@ -17089,22 +17349,22 @@ ShaderPool.init();
17089
17349
  positions[3].set(1, 1, 1);
17090
17350
  break;
17091
17351
  case exports.BackgroundTextureFillMode.AspectFitWidth:
17092
- var fitWidthScale = this._texture.height * width / this.texture.width / height;
17352
+ var fitWidthScale = texture.height * width / texture.width / height;
17093
17353
  positions[0].set(-1, -fitWidthScale, 1);
17094
17354
  positions[1].set(1, -fitWidthScale, 1);
17095
17355
  positions[2].set(-1, fitWidthScale, 1);
17096
17356
  positions[3].set(1, fitWidthScale, 1);
17097
17357
  break;
17098
17358
  case exports.BackgroundTextureFillMode.AspectFitHeight:
17099
- var fitHeightScale = this._texture.width * height / this.texture.height / width;
17359
+ var fitHeightScale = texture.width * height / texture.height / width;
17100
17360
  positions[0].set(-fitHeightScale, -1, 1);
17101
17361
  positions[1].set(fitHeightScale, -1, 1);
17102
17362
  positions[2].set(-fitHeightScale, 1, 1);
17103
17363
  positions[3].set(fitHeightScale, 1, 1);
17104
17364
  break;
17105
17365
  }
17106
- _backgroundTextureMesh.setPositions(positions);
17107
- _backgroundTextureMesh.uploadData(false);
17366
+ mesh.setPositions(positions);
17367
+ mesh.uploadData(false);
17108
17368
  };
17109
17369
  _proto._initMesh = function _initMesh(engine) {
17110
17370
  this._mesh = this._createPlane(engine);
@@ -17155,13 +17415,13 @@ ShaderPool.init();
17155
17415
  (_this__texture = this._texture) == null ? void 0 : _this__texture._addReferCount(-1);
17156
17416
  this._texture = value;
17157
17417
  this._material.shaderData.setTexture("material_BaseTexture", value);
17418
+ this._resizeBackgroundTexture();
17158
17419
  }
17159
17420
  }
17160
17421
  },
17161
17422
  {
17162
17423
  key: "textureFillMode",
17163
17424
  get: /**
17164
- * @internal
17165
17425
  * Background texture fill mode.
17166
17426
  * @remarks When `mode` is `BackgroundMode.Texture`, the property will take effects.
17167
17427
  * @defaultValue `BackgroundTextureFillMode.FitHeight`
@@ -17279,33 +17539,37 @@ ShaderPool.init();
17279
17539
  };
17280
17540
  _proto.callScriptOnUpdate = function callScriptOnUpdate(deltaTime) {
17281
17541
  this._onUpdateScripts.forEach(function(element) {
17282
- if (element._started) {
17283
- element.onUpdate(deltaTime);
17284
- }
17542
+ element._started && element.onUpdate(deltaTime);
17543
+ }, function(element, index) {
17544
+ element._onUpdateIndex = index;
17285
17545
  });
17286
17546
  };
17287
17547
  _proto.callScriptOnLateUpdate = function callScriptOnLateUpdate(deltaTime) {
17288
17548
  this._onLateUpdateScripts.forEach(function(element) {
17289
- if (element._started) {
17290
- element.onLateUpdate(deltaTime);
17291
- }
17549
+ element._started && element.onLateUpdate(deltaTime);
17550
+ }, function(element, index) {
17551
+ element._onLateUpdateIndex = index;
17292
17552
  });
17293
17553
  };
17294
17554
  _proto.callScriptOnPhysicsUpdate = function callScriptOnPhysicsUpdate() {
17295
17555
  this._onPhysicsUpdateScripts.forEach(function(element) {
17296
- if (element._started) {
17297
- element.onPhysicsUpdate();
17298
- }
17556
+ element._started && element.onPhysicsUpdate();
17557
+ }, function(element, index) {
17558
+ element._onPhysicsUpdateIndex = index;
17299
17559
  });
17300
17560
  };
17301
17561
  _proto.callAnimationUpdate = function callAnimationUpdate(deltaTime) {
17302
17562
  this._onUpdateAnimations.forEach(function(element) {
17303
17563
  element.engine.time.frameCount > element._playFrameCount && element.update(deltaTime);
17564
+ }, function(element, index) {
17565
+ element._onUpdateIndex = index;
17304
17566
  });
17305
17567
  };
17306
17568
  _proto.callRendererOnUpdate = function callRendererOnUpdate(deltaTime) {
17307
17569
  this._onUpdateRenderers.forEach(function(element) {
17308
17570
  element.update(deltaTime);
17571
+ }, function(element, index) {
17572
+ element._onUpdateIndex = index;
17309
17573
  });
17310
17574
  };
17311
17575
  _proto.handlingInvalidScripts = function handlingInvalidScripts() {
@@ -17323,11 +17587,15 @@ ShaderPool.init();
17323
17587
  _proto.callCameraOnBeginRender = function callCameraOnBeginRender(camera) {
17324
17588
  camera.entity._scripts.forEach(function(element) {
17325
17589
  element.onBeginRender(camera);
17590
+ }, function(element, index) {
17591
+ element._entityScriptsIndex = index;
17326
17592
  });
17327
17593
  };
17328
17594
  _proto.callCameraOnEndRender = function callCameraOnEndRender(camera) {
17329
17595
  camera.entity._scripts.forEach(function(element) {
17330
17596
  element.onEndRender(camera);
17597
+ }, function(element, index) {
17598
+ element._entityScriptsIndex = index;
17331
17599
  });
17332
17600
  };
17333
17601
  _proto.getActiveChangedTempList = function getActiveChangedTempList() {
@@ -24186,6 +24454,9 @@ var DirtyFlag;
24186
24454
  this.property = property;
24187
24455
  this.component = target.getComponent(type);
24188
24456
  this.cureType = cureType;
24457
+ var isBlendShape = _instanceof(this.component, SkinnedMeshRenderer);
24458
+ // @todo: Temp solution with blendShape
24459
+ this._isCopyMode = cureType._isCopyMode && !isBlendShape;
24189
24460
  var assemblerType = AnimationCurveOwner.getAssemblerType(type, property);
24190
24461
  this._assembler = new assemblerType();
24191
24462
  this._assembler.initialize(this);
@@ -24217,7 +24488,7 @@ var DirtyFlag;
24217
24488
  this._assembler.setTargetValue(this.defaultValue);
24218
24489
  };
24219
24490
  _proto.getEvaluateValue = function getEvaluateValue(out) {
24220
- if (this.cureType._isCopyMode) {
24491
+ if (this._isCopyMode) {
24221
24492
  this.cureType._setValue(this.baseEvaluateData.value, out);
24222
24493
  return out;
24223
24494
  } else {
@@ -24225,14 +24496,14 @@ var DirtyFlag;
24225
24496
  }
24226
24497
  };
24227
24498
  _proto.saveDefaultValue = function saveDefaultValue() {
24228
- if (this.cureType._isCopyMode) {
24499
+ if (this._isCopyMode) {
24229
24500
  this.cureType._setValue(this.referenceTargetValue, this.defaultValue);
24230
24501
  } else {
24231
24502
  this.defaultValue = this._assembler.getTargetValue();
24232
24503
  }
24233
24504
  };
24234
24505
  _proto.saveFixedPoseValue = function saveFixedPoseValue() {
24235
- if (this.cureType._isCopyMode) {
24506
+ if (this._isCopyMode) {
24236
24507
  this.cureType._setValue(this.referenceTargetValue, this.fixedPoseValue);
24237
24508
  } else {
24238
24509
  this.fixedPoseValue = this._assembler.getTargetValue();
@@ -24241,7 +24512,7 @@ var DirtyFlag;
24241
24512
  _proto.applyValue = function applyValue(value, weight, additive) {
24242
24513
  var cureType = this.cureType;
24243
24514
  if (additive) {
24244
- if (cureType._isCopyMode) {
24515
+ if (this._isCopyMode) {
24245
24516
  cureType._additiveValue(value, weight, this.referenceTargetValue);
24246
24517
  } else {
24247
24518
  var assembler = this._assembler;
@@ -24251,13 +24522,13 @@ var DirtyFlag;
24251
24522
  }
24252
24523
  } else {
24253
24524
  if (weight === 1.0) {
24254
- if (cureType._isCopyMode) {
24525
+ if (this._isCopyMode) {
24255
24526
  cureType._setValue(value, this.referenceTargetValue);
24256
24527
  } else {
24257
24528
  this._assembler.setTargetValue(value);
24258
24529
  }
24259
24530
  } else {
24260
- if (cureType._isCopyMode) {
24531
+ if (this._isCopyMode) {
24261
24532
  var targetValue = this.referenceTargetValue;
24262
24533
  cureType._lerpValue(targetValue, value, weight, targetValue);
24263
24534
  } else {
@@ -24269,7 +24540,7 @@ var DirtyFlag;
24269
24540
  }
24270
24541
  };
24271
24542
  _proto._lerpValue = function _lerpValue(srcValue, destValue, crossWeight) {
24272
- if (this.cureType._isCopyMode) {
24543
+ if (this._isCopyMode) {
24273
24544
  return this.cureType._lerpValue(srcValue, destValue, crossWeight, this.baseEvaluateData.value);
24274
24545
  } else {
24275
24546
  this.baseEvaluateData.value = this.cureType._lerpValue(srcValue, destValue, crossWeight);
@@ -29933,6 +30204,7 @@ exports.CharacterController = CharacterController;
29933
30204
  exports.CircleShape = CircleShape;
29934
30205
  exports.CloneManager = CloneManager;
29935
30206
  exports.ColliderShape = ColliderShape;
30207
+ exports.ColorOverLifetimeModule = ColorOverLifetimeModule;
29936
30208
  exports.Component = Component;
29937
30209
  exports.ConeShape = ConeShape;
29938
30210
  exports.ContentRestorer = ContentRestorer;
@@ -29941,12 +30213,15 @@ exports.CurveKey = CurveKey;
29941
30213
  exports.DepthState = DepthState;
29942
30214
  exports.DirectLight = DirectLight;
29943
30215
  exports.DynamicCollider = DynamicCollider;
30216
+ exports.EmissionModule = EmissionModule;
29944
30217
  exports.Engine = Engine;
29945
30218
  exports.EngineObject = EngineObject;
29946
30219
  exports.Entity = Entity;
29947
30220
  exports.EventDispatcher = EventDispatcher;
29948
30221
  exports.FixedJoint = FixedJoint;
29949
30222
  exports.Font = Font;
30223
+ exports.GradientAlphaKey = GradientAlphaKey;
30224
+ exports.GradientColorKey = GradientColorKey;
29950
30225
  exports.HemisphereShape = HemisphereShape;
29951
30226
  exports.HingeJoint = HingeJoint;
29952
30227
  exports.HitResult = HitResult;
@@ -29958,6 +30233,7 @@ exports.Keyframe = Keyframe;
29958
30233
  exports.Light = Light;
29959
30234
  exports.Loader = Loader;
29960
30235
  exports.Logger = Logger;
30236
+ exports.MainModule = MainModule;
29961
30237
  exports.Material = Material;
29962
30238
  exports.Mesh = Mesh;
29963
30239
  exports.MeshRenderer = MeshRenderer;
@@ -29966,8 +30242,10 @@ exports.PBRBaseMaterial = PBRBaseMaterial;
29966
30242
  exports.PBRMaterial = PBRMaterial;
29967
30243
  exports.PBRSpecularMaterial = PBRSpecularMaterial;
29968
30244
  exports.ParticleCompositeCurve = ParticleCompositeCurve;
30245
+ exports.ParticleCompositeGradient = ParticleCompositeGradient;
29969
30246
  exports.ParticleCurve = ParticleCurve;
29970
30247
  exports.ParticleGenerator = ParticleGenerator;
30248
+ exports.ParticleGradient = ParticleGradient;
29971
30249
  exports.ParticleMaterial = ParticleMaterial;
29972
30250
  exports.ParticleRenderer = ParticleRenderer;
29973
30251
  exports.PhysicsMaterial = PhysicsMaterial;
@@ -29986,6 +30264,7 @@ exports.RenderState = RenderState;
29986
30264
  exports.RenderTarget = RenderTarget;
29987
30265
  exports.RenderTargetBlendState = RenderTargetBlendState;
29988
30266
  exports.ResourceManager = ResourceManager;
30267
+ exports.RotationOverLifetimeModule = RotationOverLifetimeModule;
29989
30268
  exports.Scene = Scene;
29990
30269
  exports.SceneManager = SceneManager;
29991
30270
  exports.Script = Script;
@@ -29997,6 +30276,7 @@ exports.ShaderMacroCollection = ShaderMacroCollection;
29997
30276
  exports.ShaderPass = ShaderPass;
29998
30277
  exports.ShaderProperty = ShaderProperty;
29999
30278
  exports.ShaderTagKey = ShaderTagKey;
30279
+ exports.SizeOverLifetimeModule = SizeOverLifetimeModule;
30000
30280
  exports.Skin = Skin;
30001
30281
  exports.SkinnedMeshRenderer = SkinnedMeshRenderer;
30002
30282
  exports.Sky = Sky;
@@ -30022,12 +30302,14 @@ exports.Texture = Texture;
30022
30302
  exports.Texture2D = Texture2D;
30023
30303
  exports.Texture2DArray = Texture2DArray;
30024
30304
  exports.TextureCube = TextureCube;
30305
+ exports.TextureSheetAnimationModule = TextureSheetAnimationModule;
30025
30306
  exports.Time = Time;
30026
30307
  exports.TrailMaterial = TrailMaterial;
30027
30308
  exports.TrailRenderer = TrailRenderer;
30028
30309
  exports.Transform = Transform;
30029
30310
  exports.UnlitMaterial = UnlitMaterial;
30030
30311
  exports.Utils = Utils;
30312
+ exports.VelocityOverLifetimeModule = VelocityOverLifetimeModule;
30031
30313
  exports.VertexBufferBinding = VertexBufferBinding;
30032
30314
  exports.VertexElement = VertexElement;
30033
30315
  exports.assignmentClone = assignmentClone;