@galacean/engine 1.4.5 → 1.4.7

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
@@ -22323,21 +22323,14 @@
22323
22323
  };
22324
22324
  /**
22325
22325
  * Find the entity by path.
22326
- * @param path - The path fo the entity eg: /entity
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
- var entity = this;
22331
- for(var i = 0, length = splits.length; i < length; ++i){
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 entity;
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(root, name) {
22673
- var children = root._children;
22674
- for(var i = children.length - 1; i >= 0; i--){
22675
- var child = children[i];
22676
- if (child.name === name) {
22677
- return child;
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
- return null;
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
@@ -26147,6 +26144,7 @@
26147
26144
  this._nativeCollider.setMaxDepenetrationVelocity(this._maxDepenetrationVelocity);
26148
26145
  this._nativeCollider.setSleepThreshold(this._sleepThreshold);
26149
26146
  this._nativeCollider.setSolverIterations(this._solverIterations);
26147
+ this._nativeCollider.setUseGravity(this._useGravity);
26150
26148
  this._nativeCollider.setIsKinematic(this._isKinematic);
26151
26149
  this._nativeCollider.setConstraints(this._constraints);
26152
26150
  this._nativeCollider.setCollisionDetectionMode(this._collisionDetectionMode);
@@ -31738,12 +31736,20 @@
31738
31736
  * @returns Entity
31739
31737
  */ _proto.findEntityByPath = function findEntityByPath(path) {
31740
31738
  var splits = path.split("/").filter(Boolean);
31739
+ if (!splits.length) {
31740
+ return null;
31741
+ }
31742
+ var searchRootName = splits.shift();
31741
31743
  for(var i = 0, n = this.rootEntitiesCount; i < n; i++){
31742
31744
  var findEntity = this.getRootEntity(i);
31743
- if (findEntity.name != splits[0]) continue;
31744
- for(var j = 1, m = splits.length; j < m; ++j){
31745
- findEntity = Entity._findChildByName(findEntity, splits[j]);
31746
- if (!findEntity) break;
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
+ }
31747
31753
  }
31748
31754
  return findEntity;
31749
31755
  }
@@ -38684,13 +38690,17 @@
38684
38690
  instanceVertices[offset + 14] = size;
38685
38691
  }
38686
38692
  // Start rotation
38687
- var startRotationRand = main._startRotationRand;
38693
+ var startRotationRand = main._startRotationRand, flipRotation = main.flipRotation;
38694
+ var isOpposite = flipRotation < startRotationRand.random();
38695
+ var rotationZ = MathUtil.degreeToRadian(main.startRotationZ.evaluate(undefined, startRotationRand.random()));
38688
38696
  if (main.startRotation3D) {
38689
- instanceVertices[offset + 15] = MathUtil.degreeToRadian(main.startRotationX.evaluate(undefined, startRotationRand.random()));
38690
- instanceVertices[offset + 16] = MathUtil.degreeToRadian(main.startRotationY.evaluate(undefined, startRotationRand.random()));
38691
- instanceVertices[offset + 17] = MathUtil.degreeToRadian(main.startRotationZ.evaluate(undefined, startRotationRand.random()));
38697
+ var rotationX = MathUtil.degreeToRadian(main.startRotationX.evaluate(undefined, startRotationRand.random()));
38698
+ var rotationY = MathUtil.degreeToRadian(main.startRotationY.evaluate(undefined, startRotationRand.random()));
38699
+ instanceVertices[offset + 15] = isOpposite ? -rotationX : rotationX;
38700
+ instanceVertices[offset + 16] = isOpposite ? -rotationY : rotationY;
38701
+ instanceVertices[offset + 17] = isOpposite ? -rotationZ : rotationZ;
38692
38702
  } else {
38693
- instanceVertices[offset + 15] = MathUtil.degreeToRadian(main.startRotationZ.evaluate(undefined, startRotationRand.random()));
38703
+ instanceVertices[offset + 15] = isOpposite ? -rotationZ : rotationZ;
38694
38704
  }
38695
38705
  // Start speed
38696
38706
  instanceVertices[offset + 18] = startSpeed;
@@ -50029,7 +50039,7 @@
50029
50039
  ], EXT_texture_webp);
50030
50040
 
50031
50041
  //@ts-ignore
50032
- var version = "1.4.5";
50042
+ var version = "1.4.7";
50033
50043
  console.log("Galacean Engine Version: " + version);
50034
50044
  for(var key in CoreObjects){
50035
50045
  Loader.registerClass(key, CoreObjects[key]);