@galacean/engine 1.4.4 → 1.4.5

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/browser.js CHANGED
@@ -26102,7 +26102,16 @@
26102
26102
  */ _proto._onLateUpdate = function _onLateUpdate() {
26103
26103
  var transform = this.entity.transform;
26104
26104
  var worldPosition = transform.worldPosition, worldRotationQuaternion = transform.worldRotationQuaternion;
26105
- this._nativeCollider.getWorldTransform(worldPosition, worldRotationQuaternion);
26105
+ var outPosition = DynamicCollider._tempVector3;
26106
+ var outRotation = DynamicCollider._tempQuat;
26107
+ this._nativeCollider.getWorldTransform(outPosition, outRotation);
26108
+ // To resolve the issue where onValueChanged is triggered even though the values are equal
26109
+ if (!Vector3.equals(outPosition, worldPosition)) {
26110
+ worldPosition.copyFrom(outPosition);
26111
+ }
26112
+ if (!Quaternion.equals(outRotation, worldRotationQuaternion)) {
26113
+ worldRotationQuaternion.copyFrom(outRotation);
26114
+ }
26106
26115
  this._updateFlag.flag = false;
26107
26116
  };
26108
26117
  /**
@@ -26437,6 +26446,8 @@
26437
26446
  ]);
26438
26447
  return DynamicCollider;
26439
26448
  }(exports.Collider);
26449
+ DynamicCollider._tempVector3 = new Vector3();
26450
+ DynamicCollider._tempQuat = new Quaternion();
26440
26451
  __decorate$1([
26441
26452
  ignoreClone
26442
26453
  ], DynamicCollider.prototype, "_linearVelocity", void 0);
@@ -26644,6 +26655,7 @@
26644
26655
  */ _proto._onEnableInScene = function _onEnableInScene() {
26645
26656
  this._createJoint();
26646
26657
  this._syncNative();
26658
+ this._updateRotation();
26647
26659
  };
26648
26660
  /**
26649
26661
  * @internal
@@ -26672,20 +26684,19 @@
26672
26684
  _proto._calculateConnectedAnchor = function _calculateConnectedAnchor() {
26673
26685
  var colliderInfo = this._colliderInfo;
26674
26686
  var connectedColliderInfo = this._connectedColliderInfo;
26675
- var _this_entity_transform = this.entity.transform, selfPos = _this_entity_transform.worldPosition;
26676
- var selfActualAnchor = colliderInfo.actualAnchor;
26677
26687
  var connectedAnchor = connectedColliderInfo.anchor;
26678
26688
  var connectedActualAnchor = connectedColliderInfo.actualAnchor;
26679
26689
  var connectedCollider = connectedColliderInfo.collider;
26680
26690
  // @ts-ignore
26681
26691
  connectedAnchor._onValueChanged = null;
26682
26692
  if (connectedCollider) {
26683
- var _connectedCollider_entity_transform = connectedCollider.entity.transform, connectedPos = _connectedCollider_entity_transform.worldPosition, connectedWorldScale = _connectedCollider_entity_transform.lossyWorldScale;
26684
- Vector3.subtract(selfPos, connectedPos, Joint._tempVector3);
26685
- Vector3.add(Joint._tempVector3, selfActualAnchor, connectedActualAnchor);
26686
- Vector3.divide(connectedActualAnchor, connectedWorldScale, connectedAnchor);
26693
+ var tempVector3 = Joint._tempVector3;
26694
+ var tempMatrix = Joint._tempMatrix;
26695
+ Vector3.transformCoordinate(colliderInfo.anchor, this.entity.transform.worldMatrix, tempVector3);
26696
+ Matrix.invert(connectedCollider.entity.transform.worldMatrix, tempMatrix);
26697
+ Vector3.transformCoordinate(tempVector3, tempMatrix, connectedAnchor);
26687
26698
  } else {
26688
- Vector3.add(selfPos, selfActualAnchor, connectedActualAnchor);
26699
+ Vector3.transformCoordinate(colliderInfo.anchor, this.entity.transform.worldMatrix, connectedActualAnchor);
26689
26700
  connectedAnchor.copyFrom(connectedActualAnchor);
26690
26701
  }
26691
26702
  // @ts-ignore
@@ -26709,6 +26720,17 @@
26709
26720
  this._updateActualAnchor(2);
26710
26721
  }
26711
26722
  };
26723
+ _proto._updateRotation = function _updateRotation() {
26724
+ var _this__nativeJoint;
26725
+ var quat = Joint._tempQuat;
26726
+ var connectedColliderInfo = this._connectedColliderInfo;
26727
+ var connectedCollider = connectedColliderInfo.collider;
26728
+ if (connectedCollider) {
26729
+ Quaternion.invert(connectedCollider.entity.transform.worldRotationQuaternion, quat);
26730
+ }
26731
+ Quaternion.multiply(quat, this.entity.transform.worldRotationQuaternion, quat);
26732
+ (_this__nativeJoint = this._nativeJoint) == null ? void 0 : _this__nativeJoint.setRotation(quat);
26733
+ };
26712
26734
  _proto._updateActualAnchor = function _updateActualAnchor(flag) {
26713
26735
  if (flag & 1) {
26714
26736
  var _this__nativeJoint;
@@ -26746,6 +26768,7 @@
26746
26768
  value == null ? void 0 : value.entity._updateFlagManager.addListener(this._onConnectedTransformChanged);
26747
26769
  this._connectedColliderInfo.collider = value;
26748
26770
  (_this__nativeJoint = this._nativeJoint) == null ? void 0 : _this__nativeJoint.setConnectedCollider(value == null ? void 0 : value._nativeCollider);
26771
+ this._updateRotation();
26749
26772
  if (this._automaticConnectedAnchor) {
26750
26773
  this._calculateConnectedAnchor();
26751
26774
  } else {
@@ -26892,6 +26915,8 @@
26892
26915
  return Joint;
26893
26916
  }(Component);
26894
26917
  exports.Joint._tempVector3 = new Vector3();
26918
+ exports.Joint._tempQuat = new Quaternion();
26919
+ exports.Joint._tempMatrix = new Matrix();
26895
26920
  __decorate$1([
26896
26921
  deepClone
26897
26922
  ], exports.Joint.prototype, "_colliderInfo", void 0);
@@ -43948,6 +43973,7 @@
43948
43973
  this._organizeEntities = this._organizeEntities.bind(this);
43949
43974
  this._parseComponents = this._parseComponents.bind(this);
43950
43975
  this._parsePrefabModification = this._parsePrefabModification.bind(this);
43976
+ this._parseAddedComponents = this._parseAddedComponents.bind(this);
43951
43977
  this._parsePrefabRemovedEntities = this._parsePrefabRemovedEntities.bind(this);
43952
43978
  this._parsePrefabRemovedComponents = this._parsePrefabRemovedComponents.bind(this);
43953
43979
  this._clearAndResolve = this._clearAndResolve.bind(this);
@@ -43959,7 +43985,7 @@
43959
43985
  }
43960
43986
  var _proto = HierarchyParser.prototype;
43961
43987
  /** start parse the scene or prefab or others */ _proto.start = function start() {
43962
- this._parseEntities().then(this._organizeEntities).then(this._parseComponents).then(this._parsePrefabModification).then(this._parsePrefabRemovedEntities).then(this._parsePrefabRemovedComponents).then(this._clearAndResolve).then(this._resolve).catch(this._reject);
43988
+ this._parseEntities().then(this._organizeEntities).then(this._parseComponents).then(this._parsePrefabModification).then(this._parseAddedComponents).then(this._parsePrefabRemovedEntities).then(this._parsePrefabRemovedComponents).then(this._clearAndResolve).then(this._resolve).catch(this._reject);
43963
43989
  };
43964
43990
  _proto._parseEntities = function _parseEntities() {
43965
43991
  var _this = this;
@@ -43987,21 +44013,11 @@
43987
44013
  var promises = [];
43988
44014
  for(var i = 0, l = entitiesConfig.length; i < l; i++){
43989
44015
  var entityConfig = entitiesConfig[i];
43990
- var entity = entityMap.get(entityConfig.id);
43991
- for(var i1 = 0; i1 < entityConfig.components.length; i1++){
43992
- var componentConfig = entityConfig.components[i1];
43993
- var key = !componentConfig.refId ? componentConfig.class : componentConfig.refId;
43994
- var component = entity.addComponent(Loader.getClass(key));
43995
- this.context.addComponent(componentConfig.id, component);
43996
- var promise = this._reflectionParser.parsePropsAndMethods(component, componentConfig);
43997
- promises.push(promise);
44016
+ if (entityConfig.strippedId) {
44017
+ continue;
43998
44018
  }
43999
- }
44000
- for(var _iterator = _create_for_of_iterator_helper_loose(this.context.componentWaitingMap.values()), _step; !(_step = _iterator()).done;){
44001
- var waitingList = _step.value;
44002
- waitingList.forEach(function(resolve) {
44003
- return resolve(null);
44004
- });
44019
+ var entity = entityMap.get(entityConfig.id);
44020
+ this._addComponents(entity, entityConfig.components, promises);
44005
44021
  }
44006
44022
  return Promise.all(promises);
44007
44023
  };
@@ -44036,6 +44052,25 @@
44036
44052
  for(var i = 0, l = entitiesConfig.length; i < l; i++)_loop(i);
44037
44053
  return Promise.all(promises);
44038
44054
  };
44055
+ _proto._parseAddedComponents = function _parseAddedComponents() {
44056
+ var entityMap = this.context.entityMap;
44057
+ var entityConfigMap = this.context.entityConfigMap;
44058
+ var strippedIds = this.context.strippedIds;
44059
+ var promises = [];
44060
+ for(var i = 0, n = strippedIds.length; i < n; i++){
44061
+ var entityConfig = entityConfigMap.get(strippedIds[i]);
44062
+ var prefabContext = this._prefabContextMap.get(entityMap.get(entityConfig.prefabInstanceId));
44063
+ var entity = prefabContext.entityMap.get(entityConfig.prefabSource.entityId);
44064
+ this._addComponents(entity, entityConfig.components, promises);
44065
+ }
44066
+ for(var _iterator = _create_for_of_iterator_helper_loose(this.context.componentWaitingMap.values()), _step; !(_step = _iterator()).done;){
44067
+ var waitingList = _step.value;
44068
+ waitingList.forEach(function(resolve) {
44069
+ return resolve(null);
44070
+ });
44071
+ }
44072
+ return Promise.all(promises);
44073
+ };
44039
44074
  _proto._parsePrefabRemovedEntities = function _parsePrefabRemovedEntities() {
44040
44075
  var _loop = function _loop(i, l) {
44041
44076
  var entityConfig = entitiesConfig[i];
@@ -44165,6 +44200,17 @@
44165
44200
  }
44166
44201
  }
44167
44202
  };
44203
+ _proto._addComponents = function _addComponents(entity, components, promises) {
44204
+ for(var i = 0, n = components.length; i < n; i++){
44205
+ var componentConfig = components[i];
44206
+ var key = !componentConfig.refId ? componentConfig.class : componentConfig.refId;
44207
+ var component = entity.addComponent(Loader.getClass(key));
44208
+ this.context.addComponent(componentConfig.id, component);
44209
+ var promise = this._reflectionParser.parsePropsAndMethods(component, componentConfig);
44210
+ promises.push(promise);
44211
+ }
44212
+ return promises;
44213
+ };
44168
44214
  _proto._applyEntityData = function _applyEntityData(entity, entityConfig) {
44169
44215
  if (entityConfig === void 0) entityConfig = {};
44170
44216
  var _entityConfig_isActive;
@@ -49983,7 +50029,7 @@
49983
50029
  ], EXT_texture_webp);
49984
50030
 
49985
50031
  //@ts-ignore
49986
- var version = "1.4.4";
50032
+ var version = "1.4.5";
49987
50033
  console.log("Galacean Engine Version: " + version);
49988
50034
  for(var key in CoreObjects){
49989
50035
  Loader.registerClass(key, CoreObjects[key]);