@galacean/engine 1.4.4 → 1.4.6
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 +99 -47
- package/dist/browser.js.map +1 -1
- package/dist/browser.min.js +1 -1
- package/dist/browser.min.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/module.js +1 -1
- package/package.json +5 -5
package/dist/browser.js
CHANGED
|
@@ -22323,21 +22323,14 @@
|
|
|
22323
22323
|
};
|
|
22324
22324
|
/**
|
|
22325
22325
|
* Find the entity by path.
|
|
22326
|
-
* @param path - The path
|
|
22326
|
+
* @param path - The path of the entity eg: /entity
|
|
22327
22327
|
* @returns The component which be found
|
|
22328
22328
|
*/ _proto.findByPath = function findByPath(path) {
|
|
22329
|
-
var splits = path.split("/");
|
|
22330
|
-
|
|
22331
|
-
|
|
22332
|
-
var split = splits[i];
|
|
22333
|
-
if (split) {
|
|
22334
|
-
entity = Entity._findChildByName(entity, split);
|
|
22335
|
-
if (!entity) {
|
|
22336
|
-
return null;
|
|
22337
|
-
}
|
|
22338
|
-
}
|
|
22329
|
+
var splits = path.split("/").filter(Boolean);
|
|
22330
|
+
if (!splits.length) {
|
|
22331
|
+
return this;
|
|
22339
22332
|
}
|
|
22340
|
-
return
|
|
22333
|
+
return Entity._findChildByName(this, 0, splits, 0);
|
|
22341
22334
|
};
|
|
22342
22335
|
/**
|
|
22343
22336
|
* Create child entity.
|
|
@@ -22669,15 +22662,19 @@
|
|
|
22669
22662
|
};
|
|
22670
22663
|
/**
|
|
22671
22664
|
* @internal
|
|
22672
|
-
*/ Entity._findChildByName = function _findChildByName(
|
|
22673
|
-
var
|
|
22674
|
-
|
|
22675
|
-
|
|
22676
|
-
|
|
22677
|
-
|
|
22665
|
+
*/ Entity._findChildByName = function _findChildByName(entity, childIndex, paths, pathIndex) {
|
|
22666
|
+
var searchPath = paths[pathIndex];
|
|
22667
|
+
var isEndPath = pathIndex === paths.length - 1;
|
|
22668
|
+
var children = entity._children;
|
|
22669
|
+
for(var n = children.length; childIndex < n; childIndex++){
|
|
22670
|
+
var child = children[childIndex];
|
|
22671
|
+
if (child.name === searchPath) {
|
|
22672
|
+
// Search success if end path, or downward search
|
|
22673
|
+
return isEndPath ? child : Entity._findChildByName(child, 0, paths, pathIndex + 1);
|
|
22678
22674
|
}
|
|
22679
22675
|
}
|
|
22680
|
-
|
|
22676
|
+
// Search failed if first path, or upward search
|
|
22677
|
+
return pathIndex === 0 ? null : Entity._findChildByName(entity.parent, entity.siblingIndex + 1, paths, pathIndex - 1);
|
|
22681
22678
|
};
|
|
22682
22679
|
/**
|
|
22683
22680
|
* @internal
|
|
@@ -26102,7 +26099,16 @@
|
|
|
26102
26099
|
*/ _proto._onLateUpdate = function _onLateUpdate() {
|
|
26103
26100
|
var transform = this.entity.transform;
|
|
26104
26101
|
var worldPosition = transform.worldPosition, worldRotationQuaternion = transform.worldRotationQuaternion;
|
|
26105
|
-
|
|
26102
|
+
var outPosition = DynamicCollider._tempVector3;
|
|
26103
|
+
var outRotation = DynamicCollider._tempQuat;
|
|
26104
|
+
this._nativeCollider.getWorldTransform(outPosition, outRotation);
|
|
26105
|
+
// To resolve the issue where onValueChanged is triggered even though the values are equal
|
|
26106
|
+
if (!Vector3.equals(outPosition, worldPosition)) {
|
|
26107
|
+
worldPosition.copyFrom(outPosition);
|
|
26108
|
+
}
|
|
26109
|
+
if (!Quaternion.equals(outRotation, worldRotationQuaternion)) {
|
|
26110
|
+
worldRotationQuaternion.copyFrom(outRotation);
|
|
26111
|
+
}
|
|
26106
26112
|
this._updateFlag.flag = false;
|
|
26107
26113
|
};
|
|
26108
26114
|
/**
|
|
@@ -26138,6 +26144,7 @@
|
|
|
26138
26144
|
this._nativeCollider.setMaxDepenetrationVelocity(this._maxDepenetrationVelocity);
|
|
26139
26145
|
this._nativeCollider.setSleepThreshold(this._sleepThreshold);
|
|
26140
26146
|
this._nativeCollider.setSolverIterations(this._solverIterations);
|
|
26147
|
+
this._nativeCollider.setUseGravity(this._useGravity);
|
|
26141
26148
|
this._nativeCollider.setIsKinematic(this._isKinematic);
|
|
26142
26149
|
this._nativeCollider.setConstraints(this._constraints);
|
|
26143
26150
|
this._nativeCollider.setCollisionDetectionMode(this._collisionDetectionMode);
|
|
@@ -26437,6 +26444,8 @@
|
|
|
26437
26444
|
]);
|
|
26438
26445
|
return DynamicCollider;
|
|
26439
26446
|
}(exports.Collider);
|
|
26447
|
+
DynamicCollider._tempVector3 = new Vector3();
|
|
26448
|
+
DynamicCollider._tempQuat = new Quaternion();
|
|
26440
26449
|
__decorate$1([
|
|
26441
26450
|
ignoreClone
|
|
26442
26451
|
], DynamicCollider.prototype, "_linearVelocity", void 0);
|
|
@@ -26644,6 +26653,7 @@
|
|
|
26644
26653
|
*/ _proto._onEnableInScene = function _onEnableInScene() {
|
|
26645
26654
|
this._createJoint();
|
|
26646
26655
|
this._syncNative();
|
|
26656
|
+
this._updateRotation();
|
|
26647
26657
|
};
|
|
26648
26658
|
/**
|
|
26649
26659
|
* @internal
|
|
@@ -26672,20 +26682,19 @@
|
|
|
26672
26682
|
_proto._calculateConnectedAnchor = function _calculateConnectedAnchor() {
|
|
26673
26683
|
var colliderInfo = this._colliderInfo;
|
|
26674
26684
|
var connectedColliderInfo = this._connectedColliderInfo;
|
|
26675
|
-
var _this_entity_transform = this.entity.transform, selfPos = _this_entity_transform.worldPosition;
|
|
26676
|
-
var selfActualAnchor = colliderInfo.actualAnchor;
|
|
26677
26685
|
var connectedAnchor = connectedColliderInfo.anchor;
|
|
26678
26686
|
var connectedActualAnchor = connectedColliderInfo.actualAnchor;
|
|
26679
26687
|
var connectedCollider = connectedColliderInfo.collider;
|
|
26680
26688
|
// @ts-ignore
|
|
26681
26689
|
connectedAnchor._onValueChanged = null;
|
|
26682
26690
|
if (connectedCollider) {
|
|
26683
|
-
var
|
|
26684
|
-
|
|
26685
|
-
Vector3.
|
|
26686
|
-
|
|
26691
|
+
var tempVector3 = Joint._tempVector3;
|
|
26692
|
+
var tempMatrix = Joint._tempMatrix;
|
|
26693
|
+
Vector3.transformCoordinate(colliderInfo.anchor, this.entity.transform.worldMatrix, tempVector3);
|
|
26694
|
+
Matrix.invert(connectedCollider.entity.transform.worldMatrix, tempMatrix);
|
|
26695
|
+
Vector3.transformCoordinate(tempVector3, tempMatrix, connectedAnchor);
|
|
26687
26696
|
} else {
|
|
26688
|
-
Vector3.
|
|
26697
|
+
Vector3.transformCoordinate(colliderInfo.anchor, this.entity.transform.worldMatrix, connectedActualAnchor);
|
|
26689
26698
|
connectedAnchor.copyFrom(connectedActualAnchor);
|
|
26690
26699
|
}
|
|
26691
26700
|
// @ts-ignore
|
|
@@ -26709,6 +26718,17 @@
|
|
|
26709
26718
|
this._updateActualAnchor(2);
|
|
26710
26719
|
}
|
|
26711
26720
|
};
|
|
26721
|
+
_proto._updateRotation = function _updateRotation() {
|
|
26722
|
+
var _this__nativeJoint;
|
|
26723
|
+
var quat = Joint._tempQuat;
|
|
26724
|
+
var connectedColliderInfo = this._connectedColliderInfo;
|
|
26725
|
+
var connectedCollider = connectedColliderInfo.collider;
|
|
26726
|
+
if (connectedCollider) {
|
|
26727
|
+
Quaternion.invert(connectedCollider.entity.transform.worldRotationQuaternion, quat);
|
|
26728
|
+
}
|
|
26729
|
+
Quaternion.multiply(quat, this.entity.transform.worldRotationQuaternion, quat);
|
|
26730
|
+
(_this__nativeJoint = this._nativeJoint) == null ? void 0 : _this__nativeJoint.setRotation(quat);
|
|
26731
|
+
};
|
|
26712
26732
|
_proto._updateActualAnchor = function _updateActualAnchor(flag) {
|
|
26713
26733
|
if (flag & 1) {
|
|
26714
26734
|
var _this__nativeJoint;
|
|
@@ -26746,6 +26766,7 @@
|
|
|
26746
26766
|
value == null ? void 0 : value.entity._updateFlagManager.addListener(this._onConnectedTransformChanged);
|
|
26747
26767
|
this._connectedColliderInfo.collider = value;
|
|
26748
26768
|
(_this__nativeJoint = this._nativeJoint) == null ? void 0 : _this__nativeJoint.setConnectedCollider(value == null ? void 0 : value._nativeCollider);
|
|
26769
|
+
this._updateRotation();
|
|
26749
26770
|
if (this._automaticConnectedAnchor) {
|
|
26750
26771
|
this._calculateConnectedAnchor();
|
|
26751
26772
|
} else {
|
|
@@ -26892,6 +26913,8 @@
|
|
|
26892
26913
|
return Joint;
|
|
26893
26914
|
}(Component);
|
|
26894
26915
|
exports.Joint._tempVector3 = new Vector3();
|
|
26916
|
+
exports.Joint._tempQuat = new Quaternion();
|
|
26917
|
+
exports.Joint._tempMatrix = new Matrix();
|
|
26895
26918
|
__decorate$1([
|
|
26896
26919
|
deepClone
|
|
26897
26920
|
], exports.Joint.prototype, "_colliderInfo", void 0);
|
|
@@ -31713,12 +31736,20 @@
|
|
|
31713
31736
|
* @returns Entity
|
|
31714
31737
|
*/ _proto.findEntityByPath = function findEntityByPath(path) {
|
|
31715
31738
|
var splits = path.split("/").filter(Boolean);
|
|
31739
|
+
if (!splits.length) {
|
|
31740
|
+
return null;
|
|
31741
|
+
}
|
|
31742
|
+
var searchRootName = splits.shift();
|
|
31716
31743
|
for(var i = 0, n = this.rootEntitiesCount; i < n; i++){
|
|
31717
31744
|
var findEntity = this.getRootEntity(i);
|
|
31718
|
-
if (findEntity.name
|
|
31719
|
-
|
|
31720
|
-
|
|
31721
|
-
|
|
31745
|
+
if (findEntity.name !== searchRootName) {
|
|
31746
|
+
continue;
|
|
31747
|
+
}
|
|
31748
|
+
if (splits.length) {
|
|
31749
|
+
findEntity = Entity._findChildByName(findEntity, 0, splits, 0);
|
|
31750
|
+
if (!findEntity) {
|
|
31751
|
+
continue;
|
|
31752
|
+
}
|
|
31722
31753
|
}
|
|
31723
31754
|
return findEntity;
|
|
31724
31755
|
}
|
|
@@ -43948,6 +43979,7 @@
|
|
|
43948
43979
|
this._organizeEntities = this._organizeEntities.bind(this);
|
|
43949
43980
|
this._parseComponents = this._parseComponents.bind(this);
|
|
43950
43981
|
this._parsePrefabModification = this._parsePrefabModification.bind(this);
|
|
43982
|
+
this._parseAddedComponents = this._parseAddedComponents.bind(this);
|
|
43951
43983
|
this._parsePrefabRemovedEntities = this._parsePrefabRemovedEntities.bind(this);
|
|
43952
43984
|
this._parsePrefabRemovedComponents = this._parsePrefabRemovedComponents.bind(this);
|
|
43953
43985
|
this._clearAndResolve = this._clearAndResolve.bind(this);
|
|
@@ -43959,7 +43991,7 @@
|
|
|
43959
43991
|
}
|
|
43960
43992
|
var _proto = HierarchyParser.prototype;
|
|
43961
43993
|
/** 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);
|
|
43994
|
+
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
43995
|
};
|
|
43964
43996
|
_proto._parseEntities = function _parseEntities() {
|
|
43965
43997
|
var _this = this;
|
|
@@ -43987,21 +44019,11 @@
|
|
|
43987
44019
|
var promises = [];
|
|
43988
44020
|
for(var i = 0, l = entitiesConfig.length; i < l; i++){
|
|
43989
44021
|
var entityConfig = entitiesConfig[i];
|
|
43990
|
-
|
|
43991
|
-
|
|
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);
|
|
44022
|
+
if (entityConfig.strippedId) {
|
|
44023
|
+
continue;
|
|
43998
44024
|
}
|
|
43999
|
-
|
|
44000
|
-
|
|
44001
|
-
var waitingList = _step.value;
|
|
44002
|
-
waitingList.forEach(function(resolve) {
|
|
44003
|
-
return resolve(null);
|
|
44004
|
-
});
|
|
44025
|
+
var entity = entityMap.get(entityConfig.id);
|
|
44026
|
+
this._addComponents(entity, entityConfig.components, promises);
|
|
44005
44027
|
}
|
|
44006
44028
|
return Promise.all(promises);
|
|
44007
44029
|
};
|
|
@@ -44036,6 +44058,25 @@
|
|
|
44036
44058
|
for(var i = 0, l = entitiesConfig.length; i < l; i++)_loop(i);
|
|
44037
44059
|
return Promise.all(promises);
|
|
44038
44060
|
};
|
|
44061
|
+
_proto._parseAddedComponents = function _parseAddedComponents() {
|
|
44062
|
+
var entityMap = this.context.entityMap;
|
|
44063
|
+
var entityConfigMap = this.context.entityConfigMap;
|
|
44064
|
+
var strippedIds = this.context.strippedIds;
|
|
44065
|
+
var promises = [];
|
|
44066
|
+
for(var i = 0, n = strippedIds.length; i < n; i++){
|
|
44067
|
+
var entityConfig = entityConfigMap.get(strippedIds[i]);
|
|
44068
|
+
var prefabContext = this._prefabContextMap.get(entityMap.get(entityConfig.prefabInstanceId));
|
|
44069
|
+
var entity = prefabContext.entityMap.get(entityConfig.prefabSource.entityId);
|
|
44070
|
+
this._addComponents(entity, entityConfig.components, promises);
|
|
44071
|
+
}
|
|
44072
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.context.componentWaitingMap.values()), _step; !(_step = _iterator()).done;){
|
|
44073
|
+
var waitingList = _step.value;
|
|
44074
|
+
waitingList.forEach(function(resolve) {
|
|
44075
|
+
return resolve(null);
|
|
44076
|
+
});
|
|
44077
|
+
}
|
|
44078
|
+
return Promise.all(promises);
|
|
44079
|
+
};
|
|
44039
44080
|
_proto._parsePrefabRemovedEntities = function _parsePrefabRemovedEntities() {
|
|
44040
44081
|
var _loop = function _loop(i, l) {
|
|
44041
44082
|
var entityConfig = entitiesConfig[i];
|
|
@@ -44165,6 +44206,17 @@
|
|
|
44165
44206
|
}
|
|
44166
44207
|
}
|
|
44167
44208
|
};
|
|
44209
|
+
_proto._addComponents = function _addComponents(entity, components, promises) {
|
|
44210
|
+
for(var i = 0, n = components.length; i < n; i++){
|
|
44211
|
+
var componentConfig = components[i];
|
|
44212
|
+
var key = !componentConfig.refId ? componentConfig.class : componentConfig.refId;
|
|
44213
|
+
var component = entity.addComponent(Loader.getClass(key));
|
|
44214
|
+
this.context.addComponent(componentConfig.id, component);
|
|
44215
|
+
var promise = this._reflectionParser.parsePropsAndMethods(component, componentConfig);
|
|
44216
|
+
promises.push(promise);
|
|
44217
|
+
}
|
|
44218
|
+
return promises;
|
|
44219
|
+
};
|
|
44168
44220
|
_proto._applyEntityData = function _applyEntityData(entity, entityConfig) {
|
|
44169
44221
|
if (entityConfig === void 0) entityConfig = {};
|
|
44170
44222
|
var _entityConfig_isActive;
|
|
@@ -49983,7 +50035,7 @@
|
|
|
49983
50035
|
], EXT_texture_webp);
|
|
49984
50036
|
|
|
49985
50037
|
//@ts-ignore
|
|
49986
|
-
var version = "1.4.
|
|
50038
|
+
var version = "1.4.6";
|
|
49987
50039
|
console.log("Galacean Engine Version: " + version);
|
|
49988
50040
|
for(var key in CoreObjects){
|
|
49989
50041
|
Loader.registerClass(key, CoreObjects[key]);
|