@galacean/engine-core 1.1.0-beta.7 → 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.
package/dist/main.js CHANGED
@@ -553,6 +553,7 @@ function _instanceof(left, right) {
553
553
  for(var i = 0; i < length; i++){
554
554
  CloneManager.cloneProperty(sourceProperty, targetPropertyA, i, cloneMode);
555
555
  }
556
+ break;
556
557
  default:
557
558
  var _target, _k;
558
559
  var targetOProperty = (_target = target)[_k = k] || (_target[_k] = new sourceProperty.constructor());
@@ -2834,14 +2835,14 @@ exports.DependentMode = void 0;
2834
2835
  }
2835
2836
  return end;
2836
2837
  };
2837
- _proto.forEach = function forEach(callbackFn) {
2838
+ _proto.forEach = function forEach(callbackFn, swapFn) {
2838
2839
  this._startLoop();
2839
2840
  var elements = this._elements;
2840
2841
  for(var i = 0; i < this.length; i++){
2841
2842
  var element = elements[i];
2842
2843
  element && callbackFn(element);
2843
2844
  }
2844
- this._endLoop();
2845
+ this._endLoop(swapFn);
2845
2846
  };
2846
2847
  _proto.forEachAndClean = function forEachAndClean(callbackFn) {
2847
2848
  this._startLoop();
@@ -2858,16 +2859,24 @@ exports.DependentMode = void 0;
2858
2859
  _proto._startLoop = function _startLoop() {
2859
2860
  this._isLooping = true;
2860
2861
  };
2861
- _proto._endLoop = function _endLoop() {
2862
+ _proto._endLoop = function _endLoop(swapFn) {
2862
2863
  this._isLooping = false;
2863
2864
  if (this._blankCount) {
2865
+ var from = 0;
2866
+ var to = this.length - 1;
2864
2867
  var elements = this._elements;
2865
- for(var i = 0, j = 0, n = this.length; i < n; i++){
2866
- var element = elements[i];
2867
- if (element) {
2868
- elements[j++] = element;
2869
- }
2870
- }
2868
+ partition: do {
2869
+ while(elements[from])if (++from >= to) {
2870
+ break partition;
2871
+ }
2872
+ while(!elements[to])if (from >= --to) {
2873
+ break partition;
2874
+ }
2875
+ var swapElement = elements[to];
2876
+ swapFn(swapElement, from);
2877
+ elements[from++] = swapElement;
2878
+ elements[to--] = null;
2879
+ }while (from < to);
2871
2880
  this.length -= this._blankCount;
2872
2881
  this._blankCount = 0;
2873
2882
  }
@@ -13284,11 +13293,15 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
13284
13293
  if (this._currentEnteredEntity) {
13285
13294
  this._currentEnteredEntity._scripts.forEach(function(element) {
13286
13295
  element.onPointerExit(_this);
13296
+ }, function(element, index) {
13297
+ element._entityScriptsIndex = index;
13287
13298
  });
13288
13299
  }
13289
13300
  if (rayCastEntity) {
13290
13301
  rayCastEntity._scripts.forEach(function(element) {
13291
13302
  element.onPointerEnter(_this);
13303
+ }, function(element, index) {
13304
+ element._entityScriptsIndex = index;
13292
13305
  });
13293
13306
  }
13294
13307
  this._currentEnteredEntity = rayCastEntity;
@@ -13301,6 +13314,8 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
13301
13314
  if (rayCastEntity) {
13302
13315
  rayCastEntity._scripts.forEach(function(element) {
13303
13316
  element.onPointerDown(_this);
13317
+ }, function(element, index) {
13318
+ element._entityScriptsIndex = index;
13304
13319
  });
13305
13320
  }
13306
13321
  this._currentPressedEntity = rayCastEntity;
@@ -13312,6 +13327,8 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
13312
13327
  if (this._currentPressedEntity) {
13313
13328
  this._currentPressedEntity._scripts.forEach(function(element) {
13314
13329
  element.onPointerDrag(_this);
13330
+ }, function(element, index) {
13331
+ element._entityScriptsIndex = index;
13315
13332
  });
13316
13333
  }
13317
13334
  };
@@ -13325,6 +13342,8 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
13325
13342
  pressedEntity._scripts.forEach(function(element) {
13326
13343
  sameTarget && element.onPointerClick(_this);
13327
13344
  element.onPointerUp(_this);
13345
+ }, function(element, index) {
13346
+ element._entityScriptsIndex = index;
13328
13347
  });
13329
13348
  this._currentPressedEntity = null;
13330
13349
  }
@@ -13898,11 +13917,24 @@ exports.Collider = /*#__PURE__*/ function(Component1) {
13898
13917
  };
13899
13918
  /**
13900
13919
  * @internal
13920
+ */ _proto._cloneTo = function _cloneTo(target) {
13921
+ var shapes = target._shapes;
13922
+ for(var i = 0, n = shapes.length; i < n; i++){
13923
+ target._addPhysicsShape(shapes[i]);
13924
+ }
13925
+ };
13926
+ /**
13927
+ * @internal
13901
13928
  */ _proto._onDestroy = function _onDestroy() {
13902
13929
  Component1.prototype._onDestroy.call(this);
13903
13930
  this.clearShapes();
13904
13931
  this._nativeCollider.destroy();
13905
13932
  };
13933
+ _proto._addPhysicsShape = function _addPhysicsShape(shape) {
13934
+ shape._collider = this;
13935
+ this._nativeCollider.addShape(shape._nativeShape);
13936
+ this._phasedActiveInScene && this.scene.physics._addColliderShape(shape);
13937
+ };
13906
13938
  _create_class(Collider, [
13907
13939
  {
13908
13940
  key: "shapes",
@@ -13918,6 +13950,15 @@ exports.Collider = /*#__PURE__*/ function(Component1) {
13918
13950
  __decorate([
13919
13951
  ignoreClone
13920
13952
  ], exports.Collider.prototype, "_index", void 0);
13953
+ __decorate([
13954
+ ignoreClone
13955
+ ], exports.Collider.prototype, "_nativeCollider", void 0);
13956
+ __decorate([
13957
+ ignoreClone
13958
+ ], exports.Collider.prototype, "_updateFlag", void 0);
13959
+ __decorate([
13960
+ deepClone
13961
+ ], exports.Collider.prototype, "_shapes", void 0);
13921
13962
  exports.Collider = __decorate([
13922
13963
  dependentComponents(Transform, exports.DependentMode.CheckOnly)
13923
13964
  ], exports.Collider);
@@ -13942,11 +13983,15 @@ var Collision = function Collision() {
13942
13983
  var collision = PhysicsScene._collision;
13943
13984
  collision.shape = shape2;
13944
13985
  element.onCollisionEnter(collision);
13986
+ }, function(element, index) {
13987
+ element._entityScriptsIndex = index;
13945
13988
  });
13946
13989
  shape2.collider.entity._scripts.forEach(function(element) {
13947
13990
  var collision = PhysicsScene._collision;
13948
13991
  collision.shape = shape1;
13949
13992
  element.onCollisionEnter(collision);
13993
+ }, function(element, index) {
13994
+ element._entityScriptsIndex = index;
13950
13995
  });
13951
13996
  };
13952
13997
  this._onContactExit = function(obj1, obj2) {
@@ -13957,11 +14002,15 @@ var Collision = function Collision() {
13957
14002
  var collision = PhysicsScene._collision;
13958
14003
  collision.shape = shape2;
13959
14004
  element.onCollisionExit(collision);
14005
+ }, function(element, index) {
14006
+ element._entityScriptsIndex = index;
13960
14007
  });
13961
14008
  shape2.collider.entity._scripts.forEach(function(element) {
13962
14009
  var collision = PhysicsScene._collision;
13963
14010
  collision.shape = shape1;
13964
14011
  element.onCollisionExit(collision);
14012
+ }, function(element, index) {
14013
+ element._entityScriptsIndex = index;
13965
14014
  });
13966
14015
  };
13967
14016
  this._onContactStay = function(obj1, obj2) {
@@ -13972,11 +14021,15 @@ var Collision = function Collision() {
13972
14021
  var collision = PhysicsScene._collision;
13973
14022
  collision.shape = shape2;
13974
14023
  element.onCollisionStay(collision);
14024
+ }, function(element, index) {
14025
+ element._entityScriptsIndex = index;
13975
14026
  });
13976
14027
  shape2.collider.entity._scripts.forEach(function(element) {
13977
14028
  var collision = PhysicsScene._collision;
13978
14029
  collision.shape = shape1;
13979
14030
  element.onCollisionStay(collision);
14031
+ }, function(element, index) {
14032
+ element._entityScriptsIndex = index;
13980
14033
  });
13981
14034
  };
13982
14035
  this._onTriggerEnter = function(obj1, obj2) {
@@ -13985,9 +14038,13 @@ var Collision = function Collision() {
13985
14038
  var shape2 = physicalObjectsMap[obj2];
13986
14039
  shape1.collider.entity._scripts.forEach(function(element) {
13987
14040
  element.onTriggerEnter(shape2);
14041
+ }, function(element, index) {
14042
+ element._entityScriptsIndex = index;
13988
14043
  });
13989
14044
  shape2.collider.entity._scripts.forEach(function(element) {
13990
14045
  element.onTriggerEnter(shape1);
14046
+ }, function(element, index) {
14047
+ element._entityScriptsIndex = index;
13991
14048
  });
13992
14049
  };
13993
14050
  this._onTriggerExit = function(obj1, obj2) {
@@ -13996,9 +14053,13 @@ var Collision = function Collision() {
13996
14053
  var shape2 = physicalObjectsMap[obj2];
13997
14054
  shape1.collider.entity._scripts.forEach(function(element) {
13998
14055
  element.onTriggerExit(shape2);
14056
+ }, function(element, index) {
14057
+ element._entityScriptsIndex = index;
13999
14058
  });
14000
14059
  shape2.collider.entity._scripts.forEach(function(element) {
14001
14060
  element.onTriggerExit(shape1);
14061
+ }, function(element, index) {
14062
+ element._entityScriptsIndex = index;
14002
14063
  });
14003
14064
  };
14004
14065
  this._onTriggerStay = function(obj1, obj2) {
@@ -14007,9 +14068,13 @@ var Collision = function Collision() {
14007
14068
  var shape2 = physicalObjectsMap[obj2];
14008
14069
  shape1.collider.entity._scripts.forEach(function(element) {
14009
14070
  element.onTriggerStay(shape2);
14071
+ }, function(element, index) {
14072
+ element._entityScriptsIndex = index;
14010
14073
  });
14011
14074
  shape2.collider.entity._scripts.forEach(function(element) {
14012
14075
  element.onTriggerStay(shape1);
14076
+ }, function(element, index) {
14077
+ element._entityScriptsIndex = index;
14013
14078
  });
14014
14079
  };
14015
14080
  this._scene = scene;
@@ -14042,6 +14107,9 @@ var Collision = function Collision() {
14042
14107
  }
14043
14108
  var onRaycast = function(obj) {
14044
14109
  var shape = _this._scene.engine._physicalObjectsMap[obj];
14110
+ if (!shape) {
14111
+ return false;
14112
+ }
14045
14113
  return shape.collider.entity.layer & layerMask && shape.isSceneQuery;
14046
14114
  };
14047
14115
  if (hitResult != undefined) {
@@ -14266,7 +14334,6 @@ var Collision = function Collision() {
14266
14334
  */ _proto._onLateUpdate = function _onLateUpdate() {
14267
14335
  var position = this.entity.transform.worldPosition;
14268
14336
  this._nativeCollider.getWorldPosition(position);
14269
- this.entity.transform.worldPosition = position;
14270
14337
  this._updateFlag.flag = false;
14271
14338
  };
14272
14339
  /**
@@ -14423,6 +14490,25 @@ var Collision = function Collision() {
14423
14490
  this._nativeCollider.getWorldTransform(worldPosition, worldRotationQuaternion);
14424
14491
  this._updateFlag.flag = false;
14425
14492
  };
14493
+ /**
14494
+ * @internal
14495
+ */ _proto._cloneTo = function _cloneTo(target) {
14496
+ Collider1.prototype._cloneTo.call(this, target);
14497
+ target.linearDamping = this.linearDamping;
14498
+ target.angularDamping = this.angularDamping;
14499
+ target.linearVelocity = this.linearVelocity;
14500
+ target.angularVelocity = this.angularVelocity;
14501
+ target.mass = this.mass;
14502
+ target.centerOfMass = this.centerOfMass;
14503
+ target.inertiaTensor = this.inertiaTensor;
14504
+ target.maxAngularVelocity = this.maxAngularVelocity;
14505
+ target.maxDepenetrationVelocity = this.maxDepenetrationVelocity;
14506
+ target.sleepThreshold = this.sleepThreshold;
14507
+ target.solverIterations = this.solverIterations;
14508
+ target.isKinematic = this.isKinematic;
14509
+ target.constraints = this.constraints;
14510
+ target.collisionDetectionMode = this.collisionDetectionMode;
14511
+ };
14426
14512
  _proto._setLinearVelocity = function _setLinearVelocity() {
14427
14513
  this._nativeCollider.setLinearVelocity(this._linearVelocity);
14428
14514
  };
@@ -14631,6 +14717,48 @@ var Collision = function Collision() {
14631
14717
  ]);
14632
14718
  return DynamicCollider;
14633
14719
  }(exports.Collider);
14720
+ __decorate([
14721
+ ignoreClone
14722
+ ], DynamicCollider.prototype, "_linearDamping", void 0);
14723
+ __decorate([
14724
+ ignoreClone
14725
+ ], DynamicCollider.prototype, "_angularDamping", void 0);
14726
+ __decorate([
14727
+ ignoreClone
14728
+ ], DynamicCollider.prototype, "_linearVelocity", void 0);
14729
+ __decorate([
14730
+ ignoreClone
14731
+ ], DynamicCollider.prototype, "_angularVelocity", void 0);
14732
+ __decorate([
14733
+ ignoreClone
14734
+ ], DynamicCollider.prototype, "_mass", void 0);
14735
+ __decorate([
14736
+ ignoreClone
14737
+ ], DynamicCollider.prototype, "_centerOfMass", void 0);
14738
+ __decorate([
14739
+ ignoreClone
14740
+ ], DynamicCollider.prototype, "_inertiaTensor", void 0);
14741
+ __decorate([
14742
+ ignoreClone
14743
+ ], DynamicCollider.prototype, "_maxAngularVelocity", void 0);
14744
+ __decorate([
14745
+ ignoreClone
14746
+ ], DynamicCollider.prototype, "_maxDepenetrationVelocity", void 0);
14747
+ __decorate([
14748
+ ignoreClone
14749
+ ], DynamicCollider.prototype, "_solverIterations", void 0);
14750
+ __decorate([
14751
+ ignoreClone
14752
+ ], DynamicCollider.prototype, "_isKinematic", void 0);
14753
+ __decorate([
14754
+ ignoreClone
14755
+ ], DynamicCollider.prototype, "_constraints", void 0);
14756
+ __decorate([
14757
+ ignoreClone
14758
+ ], DynamicCollider.prototype, "_collisionDetectionMode", void 0);
14759
+ __decorate([
14760
+ ignoreClone
14761
+ ], DynamicCollider.prototype, "_sleepThreshold", void 0);
14634
14762
  exports.CollisionDetectionMode = void 0;
14635
14763
  (function(CollisionDetectionMode) {
14636
14764
  CollisionDetectionMode[CollisionDetectionMode["Discrete"] = 0] = "Discrete";
@@ -14683,7 +14811,8 @@ exports.DynamicColliderConstraints = void 0;
14683
14811
  /**
14684
14812
  * @internal
14685
14813
  */ _proto._destroy = function _destroy() {
14686
- this._nativeMaterial.destroy();
14814
+ !this._destroyed && this._nativeMaterial.destroy();
14815
+ this._destroyed = true;
14687
14816
  };
14688
14817
  _create_class(PhysicsMaterial, [
14689
14818
  {
@@ -14798,24 +14927,37 @@ exports.Joint = /*#__PURE__*/ function(Component1) {
14798
14927
  function Joint(entity) {
14799
14928
  var _this;
14800
14929
  _this = Component1.call(this, entity) || this;
14801
- _this._connectedCollider = new JointCollider();
14802
- _this._collider = new JointCollider();
14930
+ _this._colliderInfo = new JointColliderInfo();
14931
+ _this._connectedColliderInfo = new JointColliderInfo();
14803
14932
  _this._force = 0;
14804
14933
  _this._torque = 0;
14805
- _this._connectedCollider.localPosition = new engineMath.Vector3();
14934
+ _this._connectedColliderInfo.localPosition = new engineMath.Vector3();
14806
14935
  return _this;
14807
14936
  }
14937
+ var _proto = Joint.prototype;
14938
+ /**
14939
+ * @internal
14940
+ */ _proto._cloneTo = function _cloneTo(target) {
14941
+ target.connectedCollider = this.connectedCollider;
14942
+ target.connectedAnchor = this.connectedAnchor;
14943
+ target.connectedMassScale = this.connectedMassScale;
14944
+ target.connectedInertiaScale = this.connectedInertiaScale;
14945
+ target.massScale = this.massScale;
14946
+ target.inertiaScale = this.inertiaScale;
14947
+ target.breakForce = this.breakForce;
14948
+ target.breakTorque = this.breakTorque;
14949
+ };
14808
14950
  _create_class(Joint, [
14809
14951
  {
14810
14952
  key: "connectedCollider",
14811
14953
  get: /**
14812
14954
  * The connected collider.
14813
14955
  */ function get() {
14814
- return this._connectedCollider.collider;
14956
+ return this._connectedColliderInfo.collider;
14815
14957
  },
14816
14958
  set: function set(value) {
14817
- if (this._connectedCollider.collider !== value) {
14818
- this._connectedCollider.collider = value;
14959
+ if (this._connectedColliderInfo.collider !== value) {
14960
+ this._connectedColliderInfo.collider = value;
14819
14961
  this._nativeJoint.setConnectedCollider(value._nativeCollider);
14820
14962
  }
14821
14963
  }
@@ -14826,10 +14968,10 @@ exports.Joint = /*#__PURE__*/ function(Component1) {
14826
14968
  * The connected anchor position.
14827
14969
  * @remarks If connectedCollider is set, this anchor is relative offset, or the anchor is world position.
14828
14970
  */ function get() {
14829
- return this._connectedCollider.localPosition;
14971
+ return this._connectedColliderInfo.localPosition;
14830
14972
  },
14831
14973
  set: function set(value) {
14832
- var connectedAnchor = this._connectedCollider.localPosition;
14974
+ var connectedAnchor = this._connectedColliderInfo.localPosition;
14833
14975
  if (value !== connectedAnchor) {
14834
14976
  connectedAnchor.copyFrom(value);
14835
14977
  }
@@ -14841,11 +14983,11 @@ exports.Joint = /*#__PURE__*/ function(Component1) {
14841
14983
  get: /**
14842
14984
  * The scale to apply to the inverse mass of collider 0 for resolving this constraint.
14843
14985
  */ function get() {
14844
- return this._connectedCollider.massScale;
14986
+ return this._connectedColliderInfo.massScale;
14845
14987
  },
14846
14988
  set: function set(value) {
14847
- if (value !== this._connectedCollider.massScale) {
14848
- this._connectedCollider.massScale = value;
14989
+ if (value !== this._connectedColliderInfo.massScale) {
14990
+ this._connectedColliderInfo.massScale = value;
14849
14991
  this._nativeJoint.setConnectedMassScale(value);
14850
14992
  }
14851
14993
  }
@@ -14855,11 +14997,11 @@ exports.Joint = /*#__PURE__*/ function(Component1) {
14855
14997
  get: /**
14856
14998
  * The scale to apply to the inverse inertia of collider0 for resolving this constraint.
14857
14999
  */ function get() {
14858
- return this._connectedCollider.inertiaScale;
15000
+ return this._connectedColliderInfo.inertiaScale;
14859
15001
  },
14860
15002
  set: function set(value) {
14861
- if (value !== this._connectedCollider.inertiaScale) {
14862
- this._connectedCollider.inertiaScale = value;
15003
+ if (value !== this._connectedColliderInfo.inertiaScale) {
15004
+ this._connectedColliderInfo.inertiaScale = value;
14863
15005
  this._nativeJoint.setConnectedInertiaScale(value);
14864
15006
  }
14865
15007
  }
@@ -14869,11 +15011,11 @@ exports.Joint = /*#__PURE__*/ function(Component1) {
14869
15011
  get: /**
14870
15012
  * The scale to apply to the inverse mass of collider 1 for resolving this constraint.
14871
15013
  */ function get() {
14872
- return this._collider.massScale;
15014
+ return this._colliderInfo.massScale;
14873
15015
  },
14874
15016
  set: function set(value) {
14875
- if (value !== this._collider.massScale) {
14876
- this._collider.massScale = value;
15017
+ if (value !== this._colliderInfo.massScale) {
15018
+ this._colliderInfo.massScale = value;
14877
15019
  this._nativeJoint.setMassScale(value);
14878
15020
  }
14879
15021
  }
@@ -14883,11 +15025,11 @@ exports.Joint = /*#__PURE__*/ function(Component1) {
14883
15025
  get: /**
14884
15026
  * The scale to apply to the inverse inertia of collider1 for resolving this constraint.
14885
15027
  */ function get() {
14886
- return this._collider.inertiaScale;
15028
+ return this._colliderInfo.inertiaScale;
14887
15029
  },
14888
15030
  set: function set(value) {
14889
- if (value !== this._collider.inertiaScale) {
14890
- this._collider.inertiaScale = value;
15031
+ if (value !== this._colliderInfo.inertiaScale) {
15032
+ this._colliderInfo.inertiaScale = value;
14891
15033
  this._nativeJoint.setInertiaScale(value);
14892
15034
  }
14893
15035
  }
@@ -14923,12 +15065,27 @@ exports.Joint = /*#__PURE__*/ function(Component1) {
14923
15065
  ]);
14924
15066
  return Joint;
14925
15067
  }(Component);
15068
+ __decorate([
15069
+ ignoreClone
15070
+ ], exports.Joint.prototype, "_colliderInfo", void 0);
15071
+ __decorate([
15072
+ ignoreClone
15073
+ ], exports.Joint.prototype, "_connectedColliderInfo", void 0);
15074
+ __decorate([
15075
+ ignoreClone
15076
+ ], exports.Joint.prototype, "_nativeJoint", void 0);
15077
+ __decorate([
15078
+ ignoreClone
15079
+ ], exports.Joint.prototype, "_force", void 0);
15080
+ __decorate([
15081
+ ignoreClone
15082
+ ], exports.Joint.prototype, "_torque", void 0);
14926
15083
  exports.Joint = __decorate([
14927
15084
  dependentComponents(exports.Collider, exports.DependentMode.CheckOnly)
14928
15085
  ], exports.Joint);
14929
15086
  /**
14930
15087
  * @internal
14931
- */ var JointCollider = function JointCollider() {
15088
+ */ var JointColliderInfo = function JointColliderInfo() {
14932
15089
  this.collider = null;
14933
15090
  this.massScale = 0;
14934
15091
  this.inertiaScale = 0;
@@ -14945,7 +15102,7 @@ exports.Joint = __decorate([
14945
15102
  /**
14946
15103
  * @internal
14947
15104
  */ _proto._onAwake = function _onAwake() {
14948
- var collider = this._collider;
15105
+ var collider = this._colliderInfo;
14949
15106
  collider.collider = this.entity.getComponent(exports.Collider);
14950
15107
  this._nativeJoint = PhysicsScene._nativePhysics.createFixedJoint(collider.collider._nativeCollider);
14951
15108
  };
@@ -14979,11 +15136,22 @@ exports.Joint = __decorate([
14979
15136
  /**
14980
15137
  * @internal
14981
15138
  */ _proto._onAwake = function _onAwake() {
14982
- var collider = this._collider;
15139
+ var collider = this._colliderInfo;
14983
15140
  collider.localPosition = new engineMath.Vector3();
14984
15141
  collider.collider = this.entity.getComponent(exports.Collider);
14985
15142
  this._nativeJoint = PhysicsScene._nativePhysics.createHingeJoint(collider.collider._nativeCollider);
14986
15143
  };
15144
+ /**
15145
+ * @internal
15146
+ */ _proto._cloneTo = function _cloneTo(target) {
15147
+ target.axis = this.axis;
15148
+ target.swingOffset = this.swingOffset;
15149
+ target.useLimits = this.useLimits;
15150
+ target.useMotor = this.useMotor;
15151
+ target.useSpring = this.useSpring;
15152
+ target.motor = this.motor;
15153
+ target.limits = this.limits;
15154
+ };
14987
15155
  _create_class(HingeJoint, [
14988
15156
  {
14989
15157
  key: "axis",
@@ -15005,10 +15173,10 @@ exports.Joint = __decorate([
15005
15173
  get: /**
15006
15174
  * The swing offset.
15007
15175
  */ function get() {
15008
- return this._collider.localPosition;
15176
+ return this._colliderInfo.localPosition;
15009
15177
  },
15010
15178
  set: function set(value) {
15011
- var swingOffset = this._collider.localPosition;
15179
+ var swingOffset = this._colliderInfo.localPosition;
15012
15180
  if (value !== swingOffset) {
15013
15181
  swingOffset.copyFrom(value);
15014
15182
  }
@@ -15111,6 +15279,21 @@ exports.Joint = __decorate([
15111
15279
  ]);
15112
15280
  return HingeJoint;
15113
15281
  }(exports.Joint);
15282
+ __decorate([
15283
+ ignoreClone
15284
+ ], HingeJoint.prototype, "_axis", void 0);
15285
+ __decorate([
15286
+ ignoreClone
15287
+ ], HingeJoint.prototype, "_hingeFlags", void 0);
15288
+ __decorate([
15289
+ ignoreClone
15290
+ ], HingeJoint.prototype, "_useSpring", void 0);
15291
+ __decorate([
15292
+ ignoreClone
15293
+ ], HingeJoint.prototype, "_jointMonitor", void 0);
15294
+ __decorate([
15295
+ ignoreClone
15296
+ ], HingeJoint.prototype, "_limits", void 0);
15114
15297
 
15115
15298
  /**
15116
15299
  * A joint that maintains an upper or lower bound (or both) on the distance between two points on different objects.
@@ -15130,21 +15313,31 @@ exports.Joint = __decorate([
15130
15313
  /**
15131
15314
  * @internal
15132
15315
  */ _proto._onAwake = function _onAwake() {
15133
- var collider = this._collider;
15316
+ var collider = this._colliderInfo;
15134
15317
  collider.localPosition = new engineMath.Vector3();
15135
15318
  collider.collider = this.entity.getComponent(exports.Collider);
15136
15319
  this._nativeJoint = PhysicsScene._nativePhysics.createSpringJoint(collider.collider._nativeCollider);
15137
15320
  };
15321
+ /**
15322
+ * @internal
15323
+ */ _proto._cloneTo = function _cloneTo(target) {
15324
+ target.swingOffset = this.swingOffset;
15325
+ target.minDistance = this.minDistance;
15326
+ target.maxDistance = this.maxDistance;
15327
+ target.tolerance = this.tolerance;
15328
+ target.stiffness = this.stiffness;
15329
+ target.damping = this.damping;
15330
+ };
15138
15331
  _create_class(SpringJoint, [
15139
15332
  {
15140
15333
  key: "swingOffset",
15141
15334
  get: /**
15142
15335
  * The swing offset.
15143
15336
  */ function get() {
15144
- return this._collider.localPosition;
15337
+ return this._colliderInfo.localPosition;
15145
15338
  },
15146
15339
  set: function set(value) {
15147
- var swingOffset = this._collider.localPosition;
15340
+ var swingOffset = this._colliderInfo.localPosition;
15148
15341
  if (value !== swingOffset) {
15149
15342
  swingOffset.copyFrom(value);
15150
15343
  }
@@ -15269,6 +15462,15 @@ exports.Joint = __decorate([
15269
15462
  var _proto = ColliderShape.prototype;
15270
15463
  /**
15271
15464
  * @internal
15465
+ */ _proto._cloneTo = function _cloneTo(target) {
15466
+ target.contactOffset = this.contactOffset;
15467
+ target.rotation = this.rotation;
15468
+ target.position = this.position;
15469
+ target.isTrigger = this.isTrigger;
15470
+ target.material = this.material;
15471
+ };
15472
+ /**
15473
+ * @internal
15272
15474
  */ _proto._destroy = function _destroy() {
15273
15475
  this._material._destroy();
15274
15476
  this._nativeShape.destroy();
@@ -15370,6 +15572,30 @@ exports.Joint = __decorate([
15370
15572
  (function() {
15371
15573
  ColliderShape._idGenerator = 0;
15372
15574
  })();
15575
+ __decorate([
15576
+ ignoreClone
15577
+ ], ColliderShape.prototype, "_collider", void 0);
15578
+ __decorate([
15579
+ ignoreClone
15580
+ ], ColliderShape.prototype, "_nativeShape", void 0);
15581
+ __decorate([
15582
+ ignoreClone
15583
+ ], ColliderShape.prototype, "_id", void 0);
15584
+ __decorate([
15585
+ ignoreClone
15586
+ ], ColliderShape.prototype, "_material", void 0);
15587
+ __decorate([
15588
+ ignoreClone
15589
+ ], ColliderShape.prototype, "_isTrigger", void 0);
15590
+ __decorate([
15591
+ ignoreClone
15592
+ ], ColliderShape.prototype, "_rotation", void 0);
15593
+ __decorate([
15594
+ ignoreClone
15595
+ ], ColliderShape.prototype, "_position", void 0);
15596
+ __decorate([
15597
+ ignoreClone
15598
+ ], ColliderShape.prototype, "_contactOffset", void 0);
15373
15599
 
15374
15600
  /**
15375
15601
  * Physical collider shape for box.
@@ -15386,6 +15612,12 @@ exports.Joint = __decorate([
15386
15612
  return _this;
15387
15613
  }
15388
15614
  var _proto = BoxColliderShape.prototype;
15615
+ /**
15616
+ * @internal
15617
+ */ _proto._cloneTo = function _cloneTo(target) {
15618
+ ColliderShape1.prototype._cloneTo.call(this, target);
15619
+ target.size = this.size;
15620
+ };
15389
15621
  _proto._setSize = function _setSize() {
15390
15622
  this._nativeShape.setSize(this._size);
15391
15623
  };
@@ -15406,6 +15638,9 @@ exports.Joint = __decorate([
15406
15638
  ]);
15407
15639
  return BoxColliderShape;
15408
15640
  }(ColliderShape);
15641
+ __decorate([
15642
+ ignoreClone
15643
+ ], BoxColliderShape.prototype, "_size", void 0);
15409
15644
 
15410
15645
  /**
15411
15646
  * Physical collider shape for sphere.
@@ -15418,6 +15653,11 @@ exports.Joint = __decorate([
15418
15653
  _this._nativeShape = PhysicsScene._nativePhysics.createSphereColliderShape(_this._id, _this._radius, _this._material._nativeMaterial);
15419
15654
  return _this;
15420
15655
  }
15656
+ var _proto = SphereColliderShape.prototype;
15657
+ _proto._cloneTo = function _cloneTo(target) {
15658
+ ColliderShape1.prototype._cloneTo.call(this, target);
15659
+ target.radius = this.radius;
15660
+ };
15421
15661
  _create_class(SphereColliderShape, [
15422
15662
  {
15423
15663
  key: "radius",
@@ -15436,6 +15676,9 @@ exports.Joint = __decorate([
15436
15676
  ]);
15437
15677
  return SphereColliderShape;
15438
15678
  }(ColliderShape);
15679
+ __decorate([
15680
+ ignoreClone
15681
+ ], SphereColliderShape.prototype, "_radius", void 0);
15439
15682
 
15440
15683
  /**
15441
15684
  * Physical collider shape plane.
@@ -15463,6 +15706,15 @@ exports.Joint = __decorate([
15463
15706
  _this._nativeShape = PhysicsScene._nativePhysics.createCapsuleColliderShape(_this._id, _this._radius, _this._height, _this._material._nativeMaterial);
15464
15707
  return _this;
15465
15708
  }
15709
+ var _proto = CapsuleColliderShape.prototype;
15710
+ /**
15711
+ * @internal
15712
+ */ _proto._cloneTo = function _cloneTo(target) {
15713
+ ColliderShape1.prototype._cloneTo.call(this, target);
15714
+ target.radius = this.radius;
15715
+ target.height = this.height;
15716
+ target.upAxis = this.upAxis;
15717
+ };
15466
15718
  _create_class(CapsuleColliderShape, [
15467
15719
  {
15468
15720
  key: "radius",
@@ -15509,6 +15761,15 @@ exports.Joint = __decorate([
15509
15761
  ]);
15510
15762
  return CapsuleColliderShape;
15511
15763
  }(ColliderShape);
15764
+ __decorate([
15765
+ ignoreClone
15766
+ ], CapsuleColliderShape.prototype, "_radius", void 0);
15767
+ __decorate([
15768
+ ignoreClone
15769
+ ], CapsuleColliderShape.prototype, "_height", void 0);
15770
+ __decorate([
15771
+ ignoreClone
15772
+ ], CapsuleColliderShape.prototype, "_upAxis", void 0);
15512
15773
 
15513
15774
  /**
15514
15775
  * Pointer Manager.
@@ -17277,33 +17538,37 @@ ShaderPool.init();
17277
17538
  };
17278
17539
  _proto.callScriptOnUpdate = function callScriptOnUpdate(deltaTime) {
17279
17540
  this._onUpdateScripts.forEach(function(element) {
17280
- if (element._started) {
17281
- element.onUpdate(deltaTime);
17282
- }
17541
+ element._started && element.onUpdate(deltaTime);
17542
+ }, function(element, index) {
17543
+ element._onUpdateIndex = index;
17283
17544
  });
17284
17545
  };
17285
17546
  _proto.callScriptOnLateUpdate = function callScriptOnLateUpdate(deltaTime) {
17286
17547
  this._onLateUpdateScripts.forEach(function(element) {
17287
- if (element._started) {
17288
- element.onLateUpdate(deltaTime);
17289
- }
17548
+ element._started && element.onLateUpdate(deltaTime);
17549
+ }, function(element, index) {
17550
+ element._onLateUpdateIndex = index;
17290
17551
  });
17291
17552
  };
17292
17553
  _proto.callScriptOnPhysicsUpdate = function callScriptOnPhysicsUpdate() {
17293
17554
  this._onPhysicsUpdateScripts.forEach(function(element) {
17294
- if (element._started) {
17295
- element.onPhysicsUpdate();
17296
- }
17555
+ element._started && element.onPhysicsUpdate();
17556
+ }, function(element, index) {
17557
+ element._onPhysicsUpdateIndex = index;
17297
17558
  });
17298
17559
  };
17299
17560
  _proto.callAnimationUpdate = function callAnimationUpdate(deltaTime) {
17300
17561
  this._onUpdateAnimations.forEach(function(element) {
17301
17562
  element.engine.time.frameCount > element._playFrameCount && element.update(deltaTime);
17563
+ }, function(element, index) {
17564
+ element._onUpdateIndex = index;
17302
17565
  });
17303
17566
  };
17304
17567
  _proto.callRendererOnUpdate = function callRendererOnUpdate(deltaTime) {
17305
17568
  this._onUpdateRenderers.forEach(function(element) {
17306
17569
  element.update(deltaTime);
17570
+ }, function(element, index) {
17571
+ element._onUpdateIndex = index;
17307
17572
  });
17308
17573
  };
17309
17574
  _proto.handlingInvalidScripts = function handlingInvalidScripts() {
@@ -17321,11 +17586,15 @@ ShaderPool.init();
17321
17586
  _proto.callCameraOnBeginRender = function callCameraOnBeginRender(camera) {
17322
17587
  camera.entity._scripts.forEach(function(element) {
17323
17588
  element.onBeginRender(camera);
17589
+ }, function(element, index) {
17590
+ element._entityScriptsIndex = index;
17324
17591
  });
17325
17592
  };
17326
17593
  _proto.callCameraOnEndRender = function callCameraOnEndRender(camera) {
17327
17594
  camera.entity._scripts.forEach(function(element) {
17328
17595
  element.onEndRender(camera);
17596
+ }, function(element, index) {
17597
+ element._entityScriptsIndex = index;
17329
17598
  });
17330
17599
  };
17331
17600
  _proto.getActiveChangedTempList = function getActiveChangedTempList() {
@@ -24184,6 +24453,9 @@ var DirtyFlag;
24184
24453
  this.property = property;
24185
24454
  this.component = target.getComponent(type);
24186
24455
  this.cureType = cureType;
24456
+ var isBlendShape = _instanceof(this.component, SkinnedMeshRenderer);
24457
+ // @todo: Temp solution with blendShape
24458
+ this._isCopyMode = cureType._isCopyMode && !isBlendShape;
24187
24459
  var assemblerType = AnimationCurveOwner.getAssemblerType(type, property);
24188
24460
  this._assembler = new assemblerType();
24189
24461
  this._assembler.initialize(this);
@@ -24215,7 +24487,7 @@ var DirtyFlag;
24215
24487
  this._assembler.setTargetValue(this.defaultValue);
24216
24488
  };
24217
24489
  _proto.getEvaluateValue = function getEvaluateValue(out) {
24218
- if (this.cureType._isCopyMode) {
24490
+ if (this._isCopyMode) {
24219
24491
  this.cureType._setValue(this.baseEvaluateData.value, out);
24220
24492
  return out;
24221
24493
  } else {
@@ -24223,14 +24495,14 @@ var DirtyFlag;
24223
24495
  }
24224
24496
  };
24225
24497
  _proto.saveDefaultValue = function saveDefaultValue() {
24226
- if (this.cureType._isCopyMode) {
24498
+ if (this._isCopyMode) {
24227
24499
  this.cureType._setValue(this.referenceTargetValue, this.defaultValue);
24228
24500
  } else {
24229
24501
  this.defaultValue = this._assembler.getTargetValue();
24230
24502
  }
24231
24503
  };
24232
24504
  _proto.saveFixedPoseValue = function saveFixedPoseValue() {
24233
- if (this.cureType._isCopyMode) {
24505
+ if (this._isCopyMode) {
24234
24506
  this.cureType._setValue(this.referenceTargetValue, this.fixedPoseValue);
24235
24507
  } else {
24236
24508
  this.fixedPoseValue = this._assembler.getTargetValue();
@@ -24239,7 +24511,7 @@ var DirtyFlag;
24239
24511
  _proto.applyValue = function applyValue(value, weight, additive) {
24240
24512
  var cureType = this.cureType;
24241
24513
  if (additive) {
24242
- if (cureType._isCopyMode) {
24514
+ if (this._isCopyMode) {
24243
24515
  cureType._additiveValue(value, weight, this.referenceTargetValue);
24244
24516
  } else {
24245
24517
  var assembler = this._assembler;
@@ -24249,13 +24521,13 @@ var DirtyFlag;
24249
24521
  }
24250
24522
  } else {
24251
24523
  if (weight === 1.0) {
24252
- if (cureType._isCopyMode) {
24524
+ if (this._isCopyMode) {
24253
24525
  cureType._setValue(value, this.referenceTargetValue);
24254
24526
  } else {
24255
24527
  this._assembler.setTargetValue(value);
24256
24528
  }
24257
24529
  } else {
24258
- if (cureType._isCopyMode) {
24530
+ if (this._isCopyMode) {
24259
24531
  var targetValue = this.referenceTargetValue;
24260
24532
  cureType._lerpValue(targetValue, value, weight, targetValue);
24261
24533
  } else {
@@ -24267,7 +24539,7 @@ var DirtyFlag;
24267
24539
  }
24268
24540
  };
24269
24541
  _proto._lerpValue = function _lerpValue(srcValue, destValue, crossWeight) {
24270
- if (this.cureType._isCopyMode) {
24542
+ if (this._isCopyMode) {
24271
24543
  return this.cureType._lerpValue(srcValue, destValue, crossWeight, this.baseEvaluateData.value);
24272
24544
  } else {
24273
24545
  this.baseEvaluateData.value = this.cureType._lerpValue(srcValue, destValue, crossWeight);