@galacean/engine-core 1.1.0-beta.7 → 1.1.0-beta.9

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.
package/dist/module.js CHANGED
@@ -549,6 +549,7 @@ function _instanceof(left, right) {
549
549
  for(var i = 0; i < length; i++){
550
550
  CloneManager.cloneProperty(sourceProperty, targetPropertyA, i, cloneMode);
551
551
  }
552
+ break;
552
553
  default:
553
554
  var _target, _k;
554
555
  var targetOProperty = (_target = target)[_k = k] || (_target[_k] = new sourceProperty.constructor());
@@ -2830,14 +2831,14 @@ var DependentMode;
2830
2831
  }
2831
2832
  return end;
2832
2833
  };
2833
- _proto.forEach = function forEach(callbackFn) {
2834
+ _proto.forEach = function forEach(callbackFn, swapFn) {
2834
2835
  this._startLoop();
2835
2836
  var elements = this._elements;
2836
2837
  for(var i = 0; i < this.length; i++){
2837
2838
  var element = elements[i];
2838
2839
  element && callbackFn(element);
2839
2840
  }
2840
- this._endLoop();
2841
+ this._endLoop(swapFn);
2841
2842
  };
2842
2843
  _proto.forEachAndClean = function forEachAndClean(callbackFn) {
2843
2844
  this._startLoop();
@@ -2854,16 +2855,24 @@ var DependentMode;
2854
2855
  _proto._startLoop = function _startLoop() {
2855
2856
  this._isLooping = true;
2856
2857
  };
2857
- _proto._endLoop = function _endLoop() {
2858
+ _proto._endLoop = function _endLoop(swapFn) {
2858
2859
  this._isLooping = false;
2859
2860
  if (this._blankCount) {
2861
+ var from = 0;
2862
+ var to = this.length - 1;
2860
2863
  var elements = this._elements;
2861
- for(var i = 0, j = 0, n = this.length; i < n; i++){
2862
- var element = elements[i];
2863
- if (element) {
2864
- elements[j++] = element;
2865
- }
2866
- }
2864
+ partition: do {
2865
+ while(elements[from])if (++from >= to) {
2866
+ break partition;
2867
+ }
2868
+ while(!elements[to])if (from >= --to) {
2869
+ break partition;
2870
+ }
2871
+ var swapElement = elements[to];
2872
+ swapFn(swapElement, from);
2873
+ elements[from++] = swapElement;
2874
+ elements[to--] = null;
2875
+ }while (from < to);
2867
2876
  this.length -= this._blankCount;
2868
2877
  this._blankCount = 0;
2869
2878
  }
@@ -13280,11 +13289,15 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
13280
13289
  if (this._currentEnteredEntity) {
13281
13290
  this._currentEnteredEntity._scripts.forEach(function(element) {
13282
13291
  element.onPointerExit(_this);
13292
+ }, function(element, index) {
13293
+ element._entityScriptsIndex = index;
13283
13294
  });
13284
13295
  }
13285
13296
  if (rayCastEntity) {
13286
13297
  rayCastEntity._scripts.forEach(function(element) {
13287
13298
  element.onPointerEnter(_this);
13299
+ }, function(element, index) {
13300
+ element._entityScriptsIndex = index;
13288
13301
  });
13289
13302
  }
13290
13303
  this._currentEnteredEntity = rayCastEntity;
@@ -13297,6 +13310,8 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
13297
13310
  if (rayCastEntity) {
13298
13311
  rayCastEntity._scripts.forEach(function(element) {
13299
13312
  element.onPointerDown(_this);
13313
+ }, function(element, index) {
13314
+ element._entityScriptsIndex = index;
13300
13315
  });
13301
13316
  }
13302
13317
  this._currentPressedEntity = rayCastEntity;
@@ -13308,6 +13323,8 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
13308
13323
  if (this._currentPressedEntity) {
13309
13324
  this._currentPressedEntity._scripts.forEach(function(element) {
13310
13325
  element.onPointerDrag(_this);
13326
+ }, function(element, index) {
13327
+ element._entityScriptsIndex = index;
13311
13328
  });
13312
13329
  }
13313
13330
  };
@@ -13321,6 +13338,8 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
13321
13338
  pressedEntity._scripts.forEach(function(element) {
13322
13339
  sameTarget && element.onPointerClick(_this);
13323
13340
  element.onPointerUp(_this);
13341
+ }, function(element, index) {
13342
+ element._entityScriptsIndex = index;
13324
13343
  });
13325
13344
  this._currentPressedEntity = null;
13326
13345
  }
@@ -13894,11 +13913,24 @@ var Collider = /*#__PURE__*/ function(Component1) {
13894
13913
  };
13895
13914
  /**
13896
13915
  * @internal
13916
+ */ _proto._cloneTo = function _cloneTo(target) {
13917
+ var shapes = target._shapes;
13918
+ for(var i = 0, n = shapes.length; i < n; i++){
13919
+ target._addPhysicsShape(shapes[i]);
13920
+ }
13921
+ };
13922
+ /**
13923
+ * @internal
13897
13924
  */ _proto._onDestroy = function _onDestroy() {
13898
13925
  Component1.prototype._onDestroy.call(this);
13899
13926
  this.clearShapes();
13900
13927
  this._nativeCollider.destroy();
13901
13928
  };
13929
+ _proto._addPhysicsShape = function _addPhysicsShape(shape) {
13930
+ shape._collider = this;
13931
+ this._nativeCollider.addShape(shape._nativeShape);
13932
+ this._phasedActiveInScene && this.scene.physics._addColliderShape(shape);
13933
+ };
13902
13934
  _create_class(Collider, [
13903
13935
  {
13904
13936
  key: "shapes",
@@ -13914,6 +13946,15 @@ var Collider = /*#__PURE__*/ function(Component1) {
13914
13946
  __decorate([
13915
13947
  ignoreClone
13916
13948
  ], Collider.prototype, "_index", void 0);
13949
+ __decorate([
13950
+ ignoreClone
13951
+ ], Collider.prototype, "_nativeCollider", void 0);
13952
+ __decorate([
13953
+ ignoreClone
13954
+ ], Collider.prototype, "_updateFlag", void 0);
13955
+ __decorate([
13956
+ deepClone
13957
+ ], Collider.prototype, "_shapes", void 0);
13917
13958
  Collider = __decorate([
13918
13959
  dependentComponents(Transform, DependentMode.CheckOnly)
13919
13960
  ], Collider);
@@ -13938,11 +13979,15 @@ var Collision = function Collision() {
13938
13979
  var collision = PhysicsScene._collision;
13939
13980
  collision.shape = shape2;
13940
13981
  element.onCollisionEnter(collision);
13982
+ }, function(element, index) {
13983
+ element._entityScriptsIndex = index;
13941
13984
  });
13942
13985
  shape2.collider.entity._scripts.forEach(function(element) {
13943
13986
  var collision = PhysicsScene._collision;
13944
13987
  collision.shape = shape1;
13945
13988
  element.onCollisionEnter(collision);
13989
+ }, function(element, index) {
13990
+ element._entityScriptsIndex = index;
13946
13991
  });
13947
13992
  };
13948
13993
  this._onContactExit = function(obj1, obj2) {
@@ -13953,11 +13998,15 @@ var Collision = function Collision() {
13953
13998
  var collision = PhysicsScene._collision;
13954
13999
  collision.shape = shape2;
13955
14000
  element.onCollisionExit(collision);
14001
+ }, function(element, index) {
14002
+ element._entityScriptsIndex = index;
13956
14003
  });
13957
14004
  shape2.collider.entity._scripts.forEach(function(element) {
13958
14005
  var collision = PhysicsScene._collision;
13959
14006
  collision.shape = shape1;
13960
14007
  element.onCollisionExit(collision);
14008
+ }, function(element, index) {
14009
+ element._entityScriptsIndex = index;
13961
14010
  });
13962
14011
  };
13963
14012
  this._onContactStay = function(obj1, obj2) {
@@ -13968,11 +14017,15 @@ var Collision = function Collision() {
13968
14017
  var collision = PhysicsScene._collision;
13969
14018
  collision.shape = shape2;
13970
14019
  element.onCollisionStay(collision);
14020
+ }, function(element, index) {
14021
+ element._entityScriptsIndex = index;
13971
14022
  });
13972
14023
  shape2.collider.entity._scripts.forEach(function(element) {
13973
14024
  var collision = PhysicsScene._collision;
13974
14025
  collision.shape = shape1;
13975
14026
  element.onCollisionStay(collision);
14027
+ }, function(element, index) {
14028
+ element._entityScriptsIndex = index;
13976
14029
  });
13977
14030
  };
13978
14031
  this._onTriggerEnter = function(obj1, obj2) {
@@ -13981,9 +14034,13 @@ var Collision = function Collision() {
13981
14034
  var shape2 = physicalObjectsMap[obj2];
13982
14035
  shape1.collider.entity._scripts.forEach(function(element) {
13983
14036
  element.onTriggerEnter(shape2);
14037
+ }, function(element, index) {
14038
+ element._entityScriptsIndex = index;
13984
14039
  });
13985
14040
  shape2.collider.entity._scripts.forEach(function(element) {
13986
14041
  element.onTriggerEnter(shape1);
14042
+ }, function(element, index) {
14043
+ element._entityScriptsIndex = index;
13987
14044
  });
13988
14045
  };
13989
14046
  this._onTriggerExit = function(obj1, obj2) {
@@ -13992,9 +14049,13 @@ var Collision = function Collision() {
13992
14049
  var shape2 = physicalObjectsMap[obj2];
13993
14050
  shape1.collider.entity._scripts.forEach(function(element) {
13994
14051
  element.onTriggerExit(shape2);
14052
+ }, function(element, index) {
14053
+ element._entityScriptsIndex = index;
13995
14054
  });
13996
14055
  shape2.collider.entity._scripts.forEach(function(element) {
13997
14056
  element.onTriggerExit(shape1);
14057
+ }, function(element, index) {
14058
+ element._entityScriptsIndex = index;
13998
14059
  });
13999
14060
  };
14000
14061
  this._onTriggerStay = function(obj1, obj2) {
@@ -14003,9 +14064,13 @@ var Collision = function Collision() {
14003
14064
  var shape2 = physicalObjectsMap[obj2];
14004
14065
  shape1.collider.entity._scripts.forEach(function(element) {
14005
14066
  element.onTriggerStay(shape2);
14067
+ }, function(element, index) {
14068
+ element._entityScriptsIndex = index;
14006
14069
  });
14007
14070
  shape2.collider.entity._scripts.forEach(function(element) {
14008
14071
  element.onTriggerStay(shape1);
14072
+ }, function(element, index) {
14073
+ element._entityScriptsIndex = index;
14009
14074
  });
14010
14075
  };
14011
14076
  this._scene = scene;
@@ -14038,6 +14103,9 @@ var Collision = function Collision() {
14038
14103
  }
14039
14104
  var onRaycast = function(obj) {
14040
14105
  var shape = _this._scene.engine._physicalObjectsMap[obj];
14106
+ if (!shape) {
14107
+ return false;
14108
+ }
14041
14109
  return shape.collider.entity.layer & layerMask && shape.isSceneQuery;
14042
14110
  };
14043
14111
  if (hitResult != undefined) {
@@ -14262,7 +14330,6 @@ var Collision = function Collision() {
14262
14330
  */ _proto._onLateUpdate = function _onLateUpdate() {
14263
14331
  var position = this.entity.transform.worldPosition;
14264
14332
  this._nativeCollider.getWorldPosition(position);
14265
- this.entity.transform.worldPosition = position;
14266
14333
  this._updateFlag.flag = false;
14267
14334
  };
14268
14335
  /**
@@ -14419,6 +14486,25 @@ var Collision = function Collision() {
14419
14486
  this._nativeCollider.getWorldTransform(worldPosition, worldRotationQuaternion);
14420
14487
  this._updateFlag.flag = false;
14421
14488
  };
14489
+ /**
14490
+ * @internal
14491
+ */ _proto._cloneTo = function _cloneTo(target) {
14492
+ Collider1.prototype._cloneTo.call(this, target);
14493
+ target.linearDamping = this.linearDamping;
14494
+ target.angularDamping = this.angularDamping;
14495
+ target.linearVelocity = this.linearVelocity;
14496
+ target.angularVelocity = this.angularVelocity;
14497
+ target.mass = this.mass;
14498
+ target.centerOfMass = this.centerOfMass;
14499
+ target.inertiaTensor = this.inertiaTensor;
14500
+ target.maxAngularVelocity = this.maxAngularVelocity;
14501
+ target.maxDepenetrationVelocity = this.maxDepenetrationVelocity;
14502
+ target.sleepThreshold = this.sleepThreshold;
14503
+ target.solverIterations = this.solverIterations;
14504
+ target.isKinematic = this.isKinematic;
14505
+ target.constraints = this.constraints;
14506
+ target.collisionDetectionMode = this.collisionDetectionMode;
14507
+ };
14422
14508
  _proto._setLinearVelocity = function _setLinearVelocity() {
14423
14509
  this._nativeCollider.setLinearVelocity(this._linearVelocity);
14424
14510
  };
@@ -14627,6 +14713,48 @@ var Collision = function Collision() {
14627
14713
  ]);
14628
14714
  return DynamicCollider;
14629
14715
  }(Collider);
14716
+ __decorate([
14717
+ ignoreClone
14718
+ ], DynamicCollider.prototype, "_linearDamping", void 0);
14719
+ __decorate([
14720
+ ignoreClone
14721
+ ], DynamicCollider.prototype, "_angularDamping", void 0);
14722
+ __decorate([
14723
+ ignoreClone
14724
+ ], DynamicCollider.prototype, "_linearVelocity", void 0);
14725
+ __decorate([
14726
+ ignoreClone
14727
+ ], DynamicCollider.prototype, "_angularVelocity", void 0);
14728
+ __decorate([
14729
+ ignoreClone
14730
+ ], DynamicCollider.prototype, "_mass", void 0);
14731
+ __decorate([
14732
+ ignoreClone
14733
+ ], DynamicCollider.prototype, "_centerOfMass", void 0);
14734
+ __decorate([
14735
+ ignoreClone
14736
+ ], DynamicCollider.prototype, "_inertiaTensor", void 0);
14737
+ __decorate([
14738
+ ignoreClone
14739
+ ], DynamicCollider.prototype, "_maxAngularVelocity", void 0);
14740
+ __decorate([
14741
+ ignoreClone
14742
+ ], DynamicCollider.prototype, "_maxDepenetrationVelocity", void 0);
14743
+ __decorate([
14744
+ ignoreClone
14745
+ ], DynamicCollider.prototype, "_solverIterations", void 0);
14746
+ __decorate([
14747
+ ignoreClone
14748
+ ], DynamicCollider.prototype, "_isKinematic", void 0);
14749
+ __decorate([
14750
+ ignoreClone
14751
+ ], DynamicCollider.prototype, "_constraints", void 0);
14752
+ __decorate([
14753
+ ignoreClone
14754
+ ], DynamicCollider.prototype, "_collisionDetectionMode", void 0);
14755
+ __decorate([
14756
+ ignoreClone
14757
+ ], DynamicCollider.prototype, "_sleepThreshold", void 0);
14630
14758
  var CollisionDetectionMode;
14631
14759
  (function(CollisionDetectionMode) {
14632
14760
  CollisionDetectionMode[CollisionDetectionMode["Discrete"] = 0] = "Discrete";
@@ -14679,7 +14807,8 @@ var DynamicColliderConstraints;
14679
14807
  /**
14680
14808
  * @internal
14681
14809
  */ _proto._destroy = function _destroy() {
14682
- this._nativeMaterial.destroy();
14810
+ !this._destroyed && this._nativeMaterial.destroy();
14811
+ this._destroyed = true;
14683
14812
  };
14684
14813
  _create_class(PhysicsMaterial, [
14685
14814
  {
@@ -14794,24 +14923,37 @@ var Joint = /*#__PURE__*/ function(Component1) {
14794
14923
  function Joint(entity) {
14795
14924
  var _this;
14796
14925
  _this = Component1.call(this, entity) || this;
14797
- _this._connectedCollider = new JointCollider();
14798
- _this._collider = new JointCollider();
14926
+ _this._colliderInfo = new JointColliderInfo();
14927
+ _this._connectedColliderInfo = new JointColliderInfo();
14799
14928
  _this._force = 0;
14800
14929
  _this._torque = 0;
14801
- _this._connectedCollider.localPosition = new Vector3();
14930
+ _this._connectedColliderInfo.localPosition = new Vector3();
14802
14931
  return _this;
14803
14932
  }
14933
+ var _proto = Joint.prototype;
14934
+ /**
14935
+ * @internal
14936
+ */ _proto._cloneTo = function _cloneTo(target) {
14937
+ target.connectedCollider = this.connectedCollider;
14938
+ target.connectedAnchor = this.connectedAnchor;
14939
+ target.connectedMassScale = this.connectedMassScale;
14940
+ target.connectedInertiaScale = this.connectedInertiaScale;
14941
+ target.massScale = this.massScale;
14942
+ target.inertiaScale = this.inertiaScale;
14943
+ target.breakForce = this.breakForce;
14944
+ target.breakTorque = this.breakTorque;
14945
+ };
14804
14946
  _create_class(Joint, [
14805
14947
  {
14806
14948
  key: "connectedCollider",
14807
14949
  get: /**
14808
14950
  * The connected collider.
14809
14951
  */ function get() {
14810
- return this._connectedCollider.collider;
14952
+ return this._connectedColliderInfo.collider;
14811
14953
  },
14812
14954
  set: function set(value) {
14813
- if (this._connectedCollider.collider !== value) {
14814
- this._connectedCollider.collider = value;
14955
+ if (this._connectedColliderInfo.collider !== value) {
14956
+ this._connectedColliderInfo.collider = value;
14815
14957
  this._nativeJoint.setConnectedCollider(value._nativeCollider);
14816
14958
  }
14817
14959
  }
@@ -14822,10 +14964,10 @@ var Joint = /*#__PURE__*/ function(Component1) {
14822
14964
  * The connected anchor position.
14823
14965
  * @remarks If connectedCollider is set, this anchor is relative offset, or the anchor is world position.
14824
14966
  */ function get() {
14825
- return this._connectedCollider.localPosition;
14967
+ return this._connectedColliderInfo.localPosition;
14826
14968
  },
14827
14969
  set: function set(value) {
14828
- var connectedAnchor = this._connectedCollider.localPosition;
14970
+ var connectedAnchor = this._connectedColliderInfo.localPosition;
14829
14971
  if (value !== connectedAnchor) {
14830
14972
  connectedAnchor.copyFrom(value);
14831
14973
  }
@@ -14837,11 +14979,11 @@ var Joint = /*#__PURE__*/ function(Component1) {
14837
14979
  get: /**
14838
14980
  * The scale to apply to the inverse mass of collider 0 for resolving this constraint.
14839
14981
  */ function get() {
14840
- return this._connectedCollider.massScale;
14982
+ return this._connectedColliderInfo.massScale;
14841
14983
  },
14842
14984
  set: function set(value) {
14843
- if (value !== this._connectedCollider.massScale) {
14844
- this._connectedCollider.massScale = value;
14985
+ if (value !== this._connectedColliderInfo.massScale) {
14986
+ this._connectedColliderInfo.massScale = value;
14845
14987
  this._nativeJoint.setConnectedMassScale(value);
14846
14988
  }
14847
14989
  }
@@ -14851,11 +14993,11 @@ var Joint = /*#__PURE__*/ function(Component1) {
14851
14993
  get: /**
14852
14994
  * The scale to apply to the inverse inertia of collider0 for resolving this constraint.
14853
14995
  */ function get() {
14854
- return this._connectedCollider.inertiaScale;
14996
+ return this._connectedColliderInfo.inertiaScale;
14855
14997
  },
14856
14998
  set: function set(value) {
14857
- if (value !== this._connectedCollider.inertiaScale) {
14858
- this._connectedCollider.inertiaScale = value;
14999
+ if (value !== this._connectedColliderInfo.inertiaScale) {
15000
+ this._connectedColliderInfo.inertiaScale = value;
14859
15001
  this._nativeJoint.setConnectedInertiaScale(value);
14860
15002
  }
14861
15003
  }
@@ -14865,11 +15007,11 @@ var Joint = /*#__PURE__*/ function(Component1) {
14865
15007
  get: /**
14866
15008
  * The scale to apply to the inverse mass of collider 1 for resolving this constraint.
14867
15009
  */ function get() {
14868
- return this._collider.massScale;
15010
+ return this._colliderInfo.massScale;
14869
15011
  },
14870
15012
  set: function set(value) {
14871
- if (value !== this._collider.massScale) {
14872
- this._collider.massScale = value;
15013
+ if (value !== this._colliderInfo.massScale) {
15014
+ this._colliderInfo.massScale = value;
14873
15015
  this._nativeJoint.setMassScale(value);
14874
15016
  }
14875
15017
  }
@@ -14879,11 +15021,11 @@ var Joint = /*#__PURE__*/ function(Component1) {
14879
15021
  get: /**
14880
15022
  * The scale to apply to the inverse inertia of collider1 for resolving this constraint.
14881
15023
  */ function get() {
14882
- return this._collider.inertiaScale;
15024
+ return this._colliderInfo.inertiaScale;
14883
15025
  },
14884
15026
  set: function set(value) {
14885
- if (value !== this._collider.inertiaScale) {
14886
- this._collider.inertiaScale = value;
15027
+ if (value !== this._colliderInfo.inertiaScale) {
15028
+ this._colliderInfo.inertiaScale = value;
14887
15029
  this._nativeJoint.setInertiaScale(value);
14888
15030
  }
14889
15031
  }
@@ -14919,12 +15061,27 @@ var Joint = /*#__PURE__*/ function(Component1) {
14919
15061
  ]);
14920
15062
  return Joint;
14921
15063
  }(Component);
15064
+ __decorate([
15065
+ ignoreClone
15066
+ ], Joint.prototype, "_colliderInfo", void 0);
15067
+ __decorate([
15068
+ ignoreClone
15069
+ ], Joint.prototype, "_connectedColliderInfo", void 0);
15070
+ __decorate([
15071
+ ignoreClone
15072
+ ], Joint.prototype, "_nativeJoint", void 0);
15073
+ __decorate([
15074
+ ignoreClone
15075
+ ], Joint.prototype, "_force", void 0);
15076
+ __decorate([
15077
+ ignoreClone
15078
+ ], Joint.prototype, "_torque", void 0);
14922
15079
  Joint = __decorate([
14923
15080
  dependentComponents(Collider, DependentMode.CheckOnly)
14924
15081
  ], Joint);
14925
15082
  /**
14926
15083
  * @internal
14927
- */ var JointCollider = function JointCollider() {
15084
+ */ var JointColliderInfo = function JointColliderInfo() {
14928
15085
  this.collider = null;
14929
15086
  this.massScale = 0;
14930
15087
  this.inertiaScale = 0;
@@ -14941,7 +15098,7 @@ Joint = __decorate([
14941
15098
  /**
14942
15099
  * @internal
14943
15100
  */ _proto._onAwake = function _onAwake() {
14944
- var collider = this._collider;
15101
+ var collider = this._colliderInfo;
14945
15102
  collider.collider = this.entity.getComponent(Collider);
14946
15103
  this._nativeJoint = PhysicsScene._nativePhysics.createFixedJoint(collider.collider._nativeCollider);
14947
15104
  };
@@ -14975,11 +15132,22 @@ Joint = __decorate([
14975
15132
  /**
14976
15133
  * @internal
14977
15134
  */ _proto._onAwake = function _onAwake() {
14978
- var collider = this._collider;
15135
+ var collider = this._colliderInfo;
14979
15136
  collider.localPosition = new Vector3();
14980
15137
  collider.collider = this.entity.getComponent(Collider);
14981
15138
  this._nativeJoint = PhysicsScene._nativePhysics.createHingeJoint(collider.collider._nativeCollider);
14982
15139
  };
15140
+ /**
15141
+ * @internal
15142
+ */ _proto._cloneTo = function _cloneTo(target) {
15143
+ target.axis = this.axis;
15144
+ target.swingOffset = this.swingOffset;
15145
+ target.useLimits = this.useLimits;
15146
+ target.useMotor = this.useMotor;
15147
+ target.useSpring = this.useSpring;
15148
+ target.motor = this.motor;
15149
+ target.limits = this.limits;
15150
+ };
14983
15151
  _create_class(HingeJoint, [
14984
15152
  {
14985
15153
  key: "axis",
@@ -15001,10 +15169,10 @@ Joint = __decorate([
15001
15169
  get: /**
15002
15170
  * The swing offset.
15003
15171
  */ function get() {
15004
- return this._collider.localPosition;
15172
+ return this._colliderInfo.localPosition;
15005
15173
  },
15006
15174
  set: function set(value) {
15007
- var swingOffset = this._collider.localPosition;
15175
+ var swingOffset = this._colliderInfo.localPosition;
15008
15176
  if (value !== swingOffset) {
15009
15177
  swingOffset.copyFrom(value);
15010
15178
  }
@@ -15107,6 +15275,21 @@ Joint = __decorate([
15107
15275
  ]);
15108
15276
  return HingeJoint;
15109
15277
  }(Joint);
15278
+ __decorate([
15279
+ ignoreClone
15280
+ ], HingeJoint.prototype, "_axis", void 0);
15281
+ __decorate([
15282
+ ignoreClone
15283
+ ], HingeJoint.prototype, "_hingeFlags", void 0);
15284
+ __decorate([
15285
+ ignoreClone
15286
+ ], HingeJoint.prototype, "_useSpring", void 0);
15287
+ __decorate([
15288
+ ignoreClone
15289
+ ], HingeJoint.prototype, "_jointMonitor", void 0);
15290
+ __decorate([
15291
+ ignoreClone
15292
+ ], HingeJoint.prototype, "_limits", void 0);
15110
15293
 
15111
15294
  /**
15112
15295
  * A joint that maintains an upper or lower bound (or both) on the distance between two points on different objects.
@@ -15126,21 +15309,31 @@ Joint = __decorate([
15126
15309
  /**
15127
15310
  * @internal
15128
15311
  */ _proto._onAwake = function _onAwake() {
15129
- var collider = this._collider;
15312
+ var collider = this._colliderInfo;
15130
15313
  collider.localPosition = new Vector3();
15131
15314
  collider.collider = this.entity.getComponent(Collider);
15132
15315
  this._nativeJoint = PhysicsScene._nativePhysics.createSpringJoint(collider.collider._nativeCollider);
15133
15316
  };
15317
+ /**
15318
+ * @internal
15319
+ */ _proto._cloneTo = function _cloneTo(target) {
15320
+ target.swingOffset = this.swingOffset;
15321
+ target.minDistance = this.minDistance;
15322
+ target.maxDistance = this.maxDistance;
15323
+ target.tolerance = this.tolerance;
15324
+ target.stiffness = this.stiffness;
15325
+ target.damping = this.damping;
15326
+ };
15134
15327
  _create_class(SpringJoint, [
15135
15328
  {
15136
15329
  key: "swingOffset",
15137
15330
  get: /**
15138
15331
  * The swing offset.
15139
15332
  */ function get() {
15140
- return this._collider.localPosition;
15333
+ return this._colliderInfo.localPosition;
15141
15334
  },
15142
15335
  set: function set(value) {
15143
- var swingOffset = this._collider.localPosition;
15336
+ var swingOffset = this._colliderInfo.localPosition;
15144
15337
  if (value !== swingOffset) {
15145
15338
  swingOffset.copyFrom(value);
15146
15339
  }
@@ -15265,6 +15458,15 @@ Joint = __decorate([
15265
15458
  var _proto = ColliderShape.prototype;
15266
15459
  /**
15267
15460
  * @internal
15461
+ */ _proto._cloneTo = function _cloneTo(target) {
15462
+ target.contactOffset = this.contactOffset;
15463
+ target.rotation = this.rotation;
15464
+ target.position = this.position;
15465
+ target.isTrigger = this.isTrigger;
15466
+ target.material = this.material;
15467
+ };
15468
+ /**
15469
+ * @internal
15268
15470
  */ _proto._destroy = function _destroy() {
15269
15471
  this._material._destroy();
15270
15472
  this._nativeShape.destroy();
@@ -15366,6 +15568,30 @@ Joint = __decorate([
15366
15568
  (function() {
15367
15569
  ColliderShape._idGenerator = 0;
15368
15570
  })();
15571
+ __decorate([
15572
+ ignoreClone
15573
+ ], ColliderShape.prototype, "_collider", void 0);
15574
+ __decorate([
15575
+ ignoreClone
15576
+ ], ColliderShape.prototype, "_nativeShape", void 0);
15577
+ __decorate([
15578
+ ignoreClone
15579
+ ], ColliderShape.prototype, "_id", void 0);
15580
+ __decorate([
15581
+ ignoreClone
15582
+ ], ColliderShape.prototype, "_material", void 0);
15583
+ __decorate([
15584
+ ignoreClone
15585
+ ], ColliderShape.prototype, "_isTrigger", void 0);
15586
+ __decorate([
15587
+ ignoreClone
15588
+ ], ColliderShape.prototype, "_rotation", void 0);
15589
+ __decorate([
15590
+ ignoreClone
15591
+ ], ColliderShape.prototype, "_position", void 0);
15592
+ __decorate([
15593
+ ignoreClone
15594
+ ], ColliderShape.prototype, "_contactOffset", void 0);
15369
15595
 
15370
15596
  /**
15371
15597
  * Physical collider shape for box.
@@ -15382,6 +15608,12 @@ Joint = __decorate([
15382
15608
  return _this;
15383
15609
  }
15384
15610
  var _proto = BoxColliderShape.prototype;
15611
+ /**
15612
+ * @internal
15613
+ */ _proto._cloneTo = function _cloneTo(target) {
15614
+ ColliderShape1.prototype._cloneTo.call(this, target);
15615
+ target.size = this.size;
15616
+ };
15385
15617
  _proto._setSize = function _setSize() {
15386
15618
  this._nativeShape.setSize(this._size);
15387
15619
  };
@@ -15402,6 +15634,9 @@ Joint = __decorate([
15402
15634
  ]);
15403
15635
  return BoxColliderShape;
15404
15636
  }(ColliderShape);
15637
+ __decorate([
15638
+ ignoreClone
15639
+ ], BoxColliderShape.prototype, "_size", void 0);
15405
15640
 
15406
15641
  /**
15407
15642
  * Physical collider shape for sphere.
@@ -15414,6 +15649,11 @@ Joint = __decorate([
15414
15649
  _this._nativeShape = PhysicsScene._nativePhysics.createSphereColliderShape(_this._id, _this._radius, _this._material._nativeMaterial);
15415
15650
  return _this;
15416
15651
  }
15652
+ var _proto = SphereColliderShape.prototype;
15653
+ _proto._cloneTo = function _cloneTo(target) {
15654
+ ColliderShape1.prototype._cloneTo.call(this, target);
15655
+ target.radius = this.radius;
15656
+ };
15417
15657
  _create_class(SphereColliderShape, [
15418
15658
  {
15419
15659
  key: "radius",
@@ -15432,6 +15672,9 @@ Joint = __decorate([
15432
15672
  ]);
15433
15673
  return SphereColliderShape;
15434
15674
  }(ColliderShape);
15675
+ __decorate([
15676
+ ignoreClone
15677
+ ], SphereColliderShape.prototype, "_radius", void 0);
15435
15678
 
15436
15679
  /**
15437
15680
  * Physical collider shape plane.
@@ -15459,6 +15702,15 @@ Joint = __decorate([
15459
15702
  _this._nativeShape = PhysicsScene._nativePhysics.createCapsuleColliderShape(_this._id, _this._radius, _this._height, _this._material._nativeMaterial);
15460
15703
  return _this;
15461
15704
  }
15705
+ var _proto = CapsuleColliderShape.prototype;
15706
+ /**
15707
+ * @internal
15708
+ */ _proto._cloneTo = function _cloneTo(target) {
15709
+ ColliderShape1.prototype._cloneTo.call(this, target);
15710
+ target.radius = this.radius;
15711
+ target.height = this.height;
15712
+ target.upAxis = this.upAxis;
15713
+ };
15462
15714
  _create_class(CapsuleColliderShape, [
15463
15715
  {
15464
15716
  key: "radius",
@@ -15505,6 +15757,15 @@ Joint = __decorate([
15505
15757
  ]);
15506
15758
  return CapsuleColliderShape;
15507
15759
  }(ColliderShape);
15760
+ __decorate([
15761
+ ignoreClone
15762
+ ], CapsuleColliderShape.prototype, "_radius", void 0);
15763
+ __decorate([
15764
+ ignoreClone
15765
+ ], CapsuleColliderShape.prototype, "_height", void 0);
15766
+ __decorate([
15767
+ ignoreClone
15768
+ ], CapsuleColliderShape.prototype, "_upAxis", void 0);
15508
15769
 
15509
15770
  /**
15510
15771
  * Pointer Manager.
@@ -17273,33 +17534,37 @@ ShaderPool.init();
17273
17534
  };
17274
17535
  _proto.callScriptOnUpdate = function callScriptOnUpdate(deltaTime) {
17275
17536
  this._onUpdateScripts.forEach(function(element) {
17276
- if (element._started) {
17277
- element.onUpdate(deltaTime);
17278
- }
17537
+ element._started && element.onUpdate(deltaTime);
17538
+ }, function(element, index) {
17539
+ element._onUpdateIndex = index;
17279
17540
  });
17280
17541
  };
17281
17542
  _proto.callScriptOnLateUpdate = function callScriptOnLateUpdate(deltaTime) {
17282
17543
  this._onLateUpdateScripts.forEach(function(element) {
17283
- if (element._started) {
17284
- element.onLateUpdate(deltaTime);
17285
- }
17544
+ element._started && element.onLateUpdate(deltaTime);
17545
+ }, function(element, index) {
17546
+ element._onLateUpdateIndex = index;
17286
17547
  });
17287
17548
  };
17288
17549
  _proto.callScriptOnPhysicsUpdate = function callScriptOnPhysicsUpdate() {
17289
17550
  this._onPhysicsUpdateScripts.forEach(function(element) {
17290
- if (element._started) {
17291
- element.onPhysicsUpdate();
17292
- }
17551
+ element._started && element.onPhysicsUpdate();
17552
+ }, function(element, index) {
17553
+ element._onPhysicsUpdateIndex = index;
17293
17554
  });
17294
17555
  };
17295
17556
  _proto.callAnimationUpdate = function callAnimationUpdate(deltaTime) {
17296
17557
  this._onUpdateAnimations.forEach(function(element) {
17297
17558
  element.engine.time.frameCount > element._playFrameCount && element.update(deltaTime);
17559
+ }, function(element, index) {
17560
+ element._onUpdateIndex = index;
17298
17561
  });
17299
17562
  };
17300
17563
  _proto.callRendererOnUpdate = function callRendererOnUpdate(deltaTime) {
17301
17564
  this._onUpdateRenderers.forEach(function(element) {
17302
17565
  element.update(deltaTime);
17566
+ }, function(element, index) {
17567
+ element._onUpdateIndex = index;
17303
17568
  });
17304
17569
  };
17305
17570
  _proto.handlingInvalidScripts = function handlingInvalidScripts() {
@@ -17317,11 +17582,15 @@ ShaderPool.init();
17317
17582
  _proto.callCameraOnBeginRender = function callCameraOnBeginRender(camera) {
17318
17583
  camera.entity._scripts.forEach(function(element) {
17319
17584
  element.onBeginRender(camera);
17585
+ }, function(element, index) {
17586
+ element._entityScriptsIndex = index;
17320
17587
  });
17321
17588
  };
17322
17589
  _proto.callCameraOnEndRender = function callCameraOnEndRender(camera) {
17323
17590
  camera.entity._scripts.forEach(function(element) {
17324
17591
  element.onEndRender(camera);
17592
+ }, function(element, index) {
17593
+ element._entityScriptsIndex = index;
17325
17594
  });
17326
17595
  };
17327
17596
  _proto.getActiveChangedTempList = function getActiveChangedTempList() {
@@ -24180,6 +24449,9 @@ var DirtyFlag;
24180
24449
  this.property = property;
24181
24450
  this.component = target.getComponent(type);
24182
24451
  this.cureType = cureType;
24452
+ var isBlendShape = _instanceof(this.component, SkinnedMeshRenderer);
24453
+ // @todo: Temp solution with blendShape
24454
+ this._isCopyMode = cureType._isCopyMode && !isBlendShape;
24183
24455
  var assemblerType = AnimationCurveOwner.getAssemblerType(type, property);
24184
24456
  this._assembler = new assemblerType();
24185
24457
  this._assembler.initialize(this);
@@ -24211,7 +24483,7 @@ var DirtyFlag;
24211
24483
  this._assembler.setTargetValue(this.defaultValue);
24212
24484
  };
24213
24485
  _proto.getEvaluateValue = function getEvaluateValue(out) {
24214
- if (this.cureType._isCopyMode) {
24486
+ if (this._isCopyMode) {
24215
24487
  this.cureType._setValue(this.baseEvaluateData.value, out);
24216
24488
  return out;
24217
24489
  } else {
@@ -24219,14 +24491,14 @@ var DirtyFlag;
24219
24491
  }
24220
24492
  };
24221
24493
  _proto.saveDefaultValue = function saveDefaultValue() {
24222
- if (this.cureType._isCopyMode) {
24494
+ if (this._isCopyMode) {
24223
24495
  this.cureType._setValue(this.referenceTargetValue, this.defaultValue);
24224
24496
  } else {
24225
24497
  this.defaultValue = this._assembler.getTargetValue();
24226
24498
  }
24227
24499
  };
24228
24500
  _proto.saveFixedPoseValue = function saveFixedPoseValue() {
24229
- if (this.cureType._isCopyMode) {
24501
+ if (this._isCopyMode) {
24230
24502
  this.cureType._setValue(this.referenceTargetValue, this.fixedPoseValue);
24231
24503
  } else {
24232
24504
  this.fixedPoseValue = this._assembler.getTargetValue();
@@ -24235,7 +24507,7 @@ var DirtyFlag;
24235
24507
  _proto.applyValue = function applyValue(value, weight, additive) {
24236
24508
  var cureType = this.cureType;
24237
24509
  if (additive) {
24238
- if (cureType._isCopyMode) {
24510
+ if (this._isCopyMode) {
24239
24511
  cureType._additiveValue(value, weight, this.referenceTargetValue);
24240
24512
  } else {
24241
24513
  var assembler = this._assembler;
@@ -24245,13 +24517,13 @@ var DirtyFlag;
24245
24517
  }
24246
24518
  } else {
24247
24519
  if (weight === 1.0) {
24248
- if (cureType._isCopyMode) {
24520
+ if (this._isCopyMode) {
24249
24521
  cureType._setValue(value, this.referenceTargetValue);
24250
24522
  } else {
24251
24523
  this._assembler.setTargetValue(value);
24252
24524
  }
24253
24525
  } else {
24254
- if (cureType._isCopyMode) {
24526
+ if (this._isCopyMode) {
24255
24527
  var targetValue = this.referenceTargetValue;
24256
24528
  cureType._lerpValue(targetValue, value, weight, targetValue);
24257
24529
  } else {
@@ -24263,7 +24535,7 @@ var DirtyFlag;
24263
24535
  }
24264
24536
  };
24265
24537
  _proto._lerpValue = function _lerpValue(srcValue, destValue, crossWeight) {
24266
- if (this.cureType._isCopyMode) {
24538
+ if (this._isCopyMode) {
24267
24539
  return this.cureType._lerpValue(srcValue, destValue, crossWeight, this.baseEvaluateData.value);
24268
24540
  } else {
24269
24541
  this.baseEvaluateData.value = this.cureType._lerpValue(srcValue, destValue, crossWeight);