@galacean/engine-physics-physx 0.0.0-experimental-2.0-migrate.5 → 0.0.0-experimental-2.0-skill.0

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
@@ -1,11 +1,5 @@
1
1
  import { Vector3, Vector4, MathUtil, Quaternion, DisorderedArray, MeshColliderShapeCookingFlag, SystemInfo } from '@galacean/engine';
2
2
 
3
- function _type_of(obj) {
4
- "@swc/helpers - typeof";
5
-
6
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
7
- }
8
-
9
3
  function _instanceof(left, right) {
10
4
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
11
5
  return !!right[Symbol.hasInstance](left);
@@ -45,7 +39,7 @@ function _inherits(subClass, superClass) {
45
39
  */ var PhysXColliderShape = /*#__PURE__*/ function() {
46
40
  function PhysXColliderShape(physXPhysics) {
47
41
  /** @internal */ this._controllers = new DisorderedArray();
48
- /** @internal */ this._contactOffset = 0.02;
42
+ /** @internal */ this._contractOffset = 0.02;
49
43
  /** @internal */ this._worldScale = new Vector3(1, 1, 1);
50
44
  /** @internal */ this._position = new Vector3();
51
45
  /** @internal */ this._rotation = new Vector3();
@@ -53,7 +47,6 @@ function _inherits(subClass, superClass) {
53
47
  this._physXRotation = new Quaternion();
54
48
  this._shapeFlags = 2 | 1;
55
49
  this._physXPhysics = physXPhysics;
56
- this._contactOffset = physXPhysics.getDefaultContactOffset();
57
50
  }
58
51
  var _proto = PhysXColliderShape.prototype;
59
52
  /**
@@ -91,7 +84,7 @@ function _inherits(subClass, superClass) {
91
84
  * {@inheritDoc IColliderShape.setContactOffset }
92
85
  * @default 0.02f * PxTolerancesScale::length
93
86
  */ _proto.setContactOffset = function setContactOffset(offset) {
94
- this._contactOffset = offset;
87
+ this._contractOffset = offset;
95
88
  var controllers = this._controllers;
96
89
  if (controllers.length) {
97
90
  for(var i = 0, n = controllers.length; i < n; i++){
@@ -432,7 +425,7 @@ PhysXBoxColliderShape._tempHalfExtents = new Vector3();
432
425
  this._pxManager && this._createPXController(this._pxManager, shape);
433
426
  this._shape = shape;
434
427
  shape._controllers.add(this);
435
- (_this__pxController = this._pxController) == null ? void 0 : _this__pxController.setContactOffset(shape._contactOffset);
428
+ (_this__pxController = this._pxController) == null ? void 0 : _this__pxController.setContactOffset(shape._contractOffset);
436
429
  (_this__scene = this._scene) == null ? void 0 : _this__scene._addColliderShape(shape._id);
437
430
  };
438
431
  /**
@@ -528,7 +521,9 @@ PhysXCharacterController._tempVec = new Vector3();
528
521
  * {@inheritDoc ICollider.addShape }
529
522
  */ _proto.addShape = function addShape(shape) {
530
523
  var _this__scene;
531
- this._pxActor.attachShape(shape._pxShape);
524
+ if (!this._pxActor.attachShape(shape._pxShape)) {
525
+ throw new Error("PhysXCollider: failed to attach shape to the native actor.");
526
+ }
532
527
  this._shapes.push(shape);
533
528
  (_this__scene = this._scene) == null ? void 0 : _this__scene._addColliderShape(shape._id);
534
529
  };
@@ -584,15 +579,7 @@ PhysXCollider._tempTransform = {
584
579
  _inherits(PhysXDynamicCollider, PhysXCollider);
585
580
  function PhysXDynamicCollider(physXPhysics, position, rotation) {
586
581
  var _this;
587
- _this = PhysXCollider.call(this, physXPhysics) || this, /**
588
- * Whether actor is currently kinematic.
589
- * PhysX 拒绝在 kinematic actor 上启用 CCD(会打印警告并忽略),
590
- * 所以 setCollisionDetectionMode 在 kinematic 状态下只缓存目标值,
591
- * 等切回 dynamic 时再真正写到 PhysX。
592
- */ _this._isKinematic = false, /**
593
- * Cached collision detection mode. Always reflects user's intent.
594
- * 实际 PhysX CCD flag 可能跟这个不一致(kinematic 时强制 Discrete)。
595
- */ _this._collisionDetectionMode = 0;
582
+ _this = PhysXCollider.call(this, physXPhysics) || this;
596
583
  var transform = _this._transform(position, rotation);
597
584
  _this._pxActor = physXPhysics._pxPhysics.createRigidDynamic(transform);
598
585
  return _this;
@@ -675,7 +662,7 @@ PhysXCollider._tempTransform = {
675
662
  };
676
663
  /**
677
664
  * {@inheritDoc IDynamicCollider.setSleepThreshold }
678
- * @default 5e-5f * PxTolerancesScale::speed * PxTolerancesScale::speed
665
+ * @default 1e-5f * PxTolerancesScale::speed * PxTolerancesScale::speed
679
666
  */ _proto.setSleepThreshold = function setSleepThreshold(value) {
680
667
  this._pxActor.setSleepThreshold(value);
681
668
  };
@@ -686,45 +673,7 @@ PhysXCollider._tempTransform = {
686
673
  };
687
674
  /**
688
675
  * {@inheritDoc IDynamicCollider.setCollisionDetectionMode }
689
- *
690
- * PhysX 在 kinematic actor 上调用 setRigidBodyFlag(eENABLE_CCD, true) 会触发警告:
691
- * "kinematic bodies with CCD enabled are not supported! CCD will be ignored"
692
- * 虽然 PhysX 会忽略这次调用而非真的拒绝(切回 dynamic 时 flag 不会自动恢复),
693
- * 但每次 setIsKinematic 切换都会让这个 warning 重复打印,污染日志,
694
- * 同时让 actor 在 dynamic 状态下 CCD flag 状态不确定。
695
- *
696
- * 解决: 只在 dynamic 状态时立即 apply CCD flags。kinematic 时仅缓存到
697
- * `_collisionDetectionMode`,等切回 dynamic 时由 setIsKinematic 重新 apply。
698
676
  */ _proto.setCollisionDetectionMode = function setCollisionDetectionMode(value) {
699
- this._collisionDetectionMode = value;
700
- if (!this._isKinematic) {
701
- this._applyCollisionDetectionFlags(value);
702
- }
703
- };
704
- /**
705
- * {@inheritDoc IDynamicCollider.setUseGravity }
706
- */ _proto.setUseGravity = function setUseGravity(value) {
707
- this._pxActor.setActorFlag(this._physXPhysics._physX.PxActorFlag.eDISABLE_GRAVITY, !value);
708
- };
709
- /**
710
- * {@inheritDoc IDynamicCollider.setIsKinematic }
711
- *
712
- * 切换 kinematic 状态时同步处理 CCD flag:
713
- * - 切到 kinematic 前先关 CCD(避免 PhysX 警告 + 让状态显式)
714
- * - 切回 dynamic 后恢复用户期望的 CCD mode(来自 `_collisionDetectionMode` 缓存)
715
- */ _proto.setIsKinematic = function setIsKinematic(value) {
716
- if (this._isKinematic === value) return;
717
- var physX = this._physXPhysics._physX;
718
- if (value) {
719
- this._applyCollisionDetectionFlags(0);
720
- this._pxActor.setRigidBodyFlag(physX.PxRigidBodyFlag.eKINEMATIC, true);
721
- } else {
722
- this._pxActor.setRigidBodyFlag(physX.PxRigidBodyFlag.eKINEMATIC, false);
723
- this._applyCollisionDetectionFlags(this._collisionDetectionMode);
724
- }
725
- this._isKinematic = value;
726
- };
727
- _proto._applyCollisionDetectionFlags = function _applyCollisionDetectionFlags(value) {
728
677
  var physX = this._physXPhysics._physX;
729
678
  switch(value){
730
679
  case 1:
@@ -750,20 +699,27 @@ PhysXCollider._tempTransform = {
750
699
  }
751
700
  };
752
701
  /**
702
+ * {@inheritDoc IDynamicCollider.setUseGravity }
703
+ */ _proto.setUseGravity = function setUseGravity(value) {
704
+ this._pxActor.setActorFlag(this._physXPhysics._physX.PxActorFlag.eDISABLE_GRAVITY, !value);
705
+ };
706
+ /**
707
+ * {@inheritDoc IDynamicCollider.setIsKinematic }
708
+ */ _proto.setIsKinematic = function setIsKinematic(value) {
709
+ if (value) {
710
+ this._pxActor.setRigidBodyFlag(this._physXPhysics._physX.PxRigidBodyFlag.eKINEMATIC, true);
711
+ } else {
712
+ this._pxActor.setRigidBodyFlag(this._physXPhysics._physX.PxRigidBodyFlag.eKINEMATIC, false);
713
+ }
714
+ };
715
+ /**
753
716
  * {@inheritDoc IDynamicCollider.setConstraints }
754
717
  */ _proto.setConstraints = function setConstraints(flags) {
755
718
  this._pxActor.setRigidDynamicLockFlags(flags);
756
719
  };
757
720
  /**
758
721
  * {@inheritDoc IDynamicCollider.addForce }
759
- *
760
- * PhysX 在 kinematic actor 上调 addForce 是 no-op(doc: "kinematic bodies don't
761
- * respond to forces")。提前 return 避免无意义的 wasm boundary cross。
762
- *
763
- * Sleeping actor 不需要显式 wakeUp — wasm binding 调用 `addForce(force, eFORCE,
764
- * autowake=true)`,PhysX 自动唤醒(已通过 `applyForce on sleeping actor` 测试验证)。
765
722
  */ _proto.addForce = function addForce(force) {
766
- if (this._isKinematic) return;
767
723
  this._pxActor.addForce(force);
768
724
  };
769
725
  /**
@@ -773,33 +729,23 @@ PhysXCollider._tempTransform = {
773
729
  };
774
730
  /**
775
731
  * {@inheritDoc IDynamicCollider.addTorque }
776
- *
777
- * 同 addForce — kinematic 提前 return,sleeping 由 PhysX autowake 自动处理。
778
732
  */ _proto.addTorque = function addTorque(torque) {
779
- if (this._isKinematic) return;
780
733
  this._pxActor.addTorque(torque);
781
734
  };
782
735
  /**
783
736
  * {@inheritDoc IDynamicCollider.move }
784
- *
785
- * PhysX 要求 setKinematicTarget 的 rotation 是 normalized quaternion,否则会触发
786
- * 内部 assertion / 警告,并把 actor 转到错误的姿态。所以在写入 wasm 边界前统一 normalize。
787
737
  */ _proto.move = function move(positionOrRotation, rotation) {
788
- var tempTranslation = PhysXDynamicCollider._tempTranslation;
789
- var tempRotation = PhysXDynamicCollider._tempRotation;
790
738
  if (rotation) {
791
- tempRotation.copyFrom(rotation).normalize();
792
- this._pxActor.setKinematicTarget(positionOrRotation, tempRotation);
739
+ this._pxActor.setKinematicTarget(positionOrRotation, rotation);
793
740
  return;
794
741
  }
742
+ var tempTranslation = PhysXDynamicCollider._tempTranslation;
743
+ var tempRotation = PhysXDynamicCollider._tempRotation;
744
+ this.getWorldTransform(tempTranslation, tempRotation);
795
745
  if (_instanceof(positionOrRotation, Vector3)) {
796
- this.getWorldTransform(tempTranslation, tempRotation);
797
- // current rotation read from PhysX is already normalized; no extra work needed
798
746
  this._pxActor.setKinematicTarget(positionOrRotation, tempRotation);
799
747
  } else {
800
- this.getWorldTransform(tempTranslation, tempRotation);
801
- tempRotation.copyFrom(positionOrRotation).normalize();
802
- this._pxActor.setKinematicTarget(tempTranslation, tempRotation);
748
+ this._pxActor.setKinematicTarget(tempTranslation, positionOrRotation);
803
749
  }
804
750
  };
805
751
  /**
@@ -902,7 +848,6 @@ function _create_class(Constructor, protoProps, staticProps) {
902
848
  this._activeTriggers = new DisorderedArray();
903
849
  this._contactEvents = [];
904
850
  this._contactEventCount = 0;
905
- this._contactEventEnabled = true;
906
851
  this._triggerEvents = [];
907
852
  this._physicsEvents = {
908
853
  contactEvents: [],
@@ -1025,17 +970,6 @@ function _create_class(Constructor, protoProps, staticProps) {
1025
970
  this._fetchResults();
1026
971
  };
1027
972
  /**
1028
- * {@inheritDoc IPhysicsScene.setContactEventEnabled }
1029
- */ _proto.setContactEventEnabled = function setContactEventEnabled(enabled) {
1030
- if (this._contactEventEnabled === enabled) {
1031
- return;
1032
- }
1033
- this._contactEventEnabled = enabled;
1034
- if (!enabled) {
1035
- this._contactEventCount = 0;
1036
- }
1037
- };
1038
- /**
1039
973
  * {@inheritDoc IPhysicsScene.updateEvents }
1040
974
  */ _proto.updateEvents = function updateEvents() {
1041
975
  var physicsEvents = this._physicsEvents;
@@ -1283,7 +1217,6 @@ function _create_class(Constructor, protoProps, staticProps) {
1283
1217
  };
1284
1218
  _proto._bufferContactEvent = function _bufferContactEvent(collision, state) {
1285
1219
  var _this__contactEvents, _index;
1286
- if (!this._contactEventEnabled) return;
1287
1220
  var index = this._contactEventCount++;
1288
1221
  var event = (_this__contactEvents = this._contactEvents)[_index = index] || (_this__contactEvents[_index] = new ContactEvent());
1289
1222
  event.shape0Id = collision.shape0Id;
@@ -1621,6 +1554,12 @@ function _assert_this_initialized(self) {
1621
1554
  return self;
1622
1555
  }
1623
1556
 
1557
+ function _type_of(obj) {
1558
+ "@swc/helpers - typeof";
1559
+
1560
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
1561
+ }
1562
+
1624
1563
  function _possible_constructor_return(self, call) {
1625
1564
  if (call && (_type_of(call) === "object" || typeof call === "function")) return call;
1626
1565
 
@@ -1635,8 +1574,7 @@ function _possible_constructor_return(self, call) {
1635
1574
  var _this;
1636
1575
  _this = PhysXColliderShape.call(this, physXPhysics) || this, _this._pxMesh = null;
1637
1576
  _this._isConvex = isConvex;
1638
- var cooked = _this._cookMesh(positions, indices, isConvex, cookingFlags);
1639
- if (!cooked) {
1577
+ if (!_this._cookMesh(positions, indices, cookingFlags)) {
1640
1578
  return _possible_constructor_return(_this);
1641
1579
  }
1642
1580
  var physX = physXPhysics._physX, physics = physXPhysics._pxPhysics;
@@ -1644,11 +1582,9 @@ function _possible_constructor_return(self, call) {
1644
1582
  var shapeFlags = ShapeFlag.SCENE_QUERY_SHAPE | ShapeFlag.SIMULATION_SHAPE;
1645
1583
  var meshFlag = isConvex ? PhysXMeshColliderShape._tightBoundsFlag : 0;
1646
1584
  var createShapeFn = isConvex ? physX.createConvexMeshShape : physX.createTriMeshShape;
1647
- _this._pxShape = createShapeFn(cooked.mesh, scaleX, scaleY, scaleZ, meshFlag, shapeFlags, material._pxMaterial, physics);
1585
+ _this._pxShape = createShapeFn(_this._pxMesh, scaleX, scaleY, scaleZ, meshFlag, shapeFlags, material._pxMaterial, physics);
1648
1586
  _this._id = uniqueID;
1649
1587
  _this._pxMaterial = material._pxMaterial;
1650
- _this._pxMesh = cooked.mesh;
1651
- _this._pxGeometry = cooked.geometry;
1652
1588
  _this._pxShape.setUUID(uniqueID);
1653
1589
  _this._setLocalPose();
1654
1590
  return _this;
@@ -1657,25 +1593,16 @@ function _possible_constructor_return(self, call) {
1657
1593
  /**
1658
1594
  * {@inheritDoc IMeshColliderShape.setMeshData }
1659
1595
  */ _proto.setMeshData = function setMeshData(positions, indices, isConvex, cookingFlags) {
1660
- var cooked = this._cookMesh(positions, indices, isConvex, cookingFlags);
1661
- if (!cooked) {
1596
+ var _this__pxMesh, _this__pxGeometry;
1597
+ (_this__pxMesh = this._pxMesh) == null ? void 0 : _this__pxMesh.release();
1598
+ (_this__pxGeometry = this._pxGeometry) == null ? void 0 : _this__pxGeometry.delete();
1599
+ this._pxMesh = null;
1600
+ this._pxGeometry = null;
1601
+ this._isConvex = isConvex;
1602
+ if (!this._cookMesh(positions, indices, cookingFlags)) {
1662
1603
  return false;
1663
1604
  }
1664
- var oldMesh = this._pxMesh;
1665
- var oldGeometry = this._pxGeometry;
1666
- try {
1667
- this._pxShape.setGeometry(cooked.geometry);
1668
- } catch (error) {
1669
- var _cooked_mesh, _cooked_geometry;
1670
- (_cooked_mesh = cooked.mesh) == null ? void 0 : _cooked_mesh.release();
1671
- (_cooked_geometry = cooked.geometry) == null ? void 0 : _cooked_geometry.delete();
1672
- throw error;
1673
- }
1674
- this._pxMesh = cooked.mesh;
1675
- this._pxGeometry = cooked.geometry;
1676
- this._isConvex = isConvex;
1677
- oldMesh == null ? void 0 : oldMesh.release();
1678
- oldGeometry == null ? void 0 : oldGeometry.delete();
1605
+ this._pxShape.setGeometry(this._pxGeometry);
1679
1606
  return true;
1680
1607
  };
1681
1608
  /**
@@ -1691,7 +1618,7 @@ function _possible_constructor_return(self, call) {
1691
1618
  (_this__pxMesh = this._pxMesh) == null ? void 0 : _this__pxMesh.release();
1692
1619
  PhysXColliderShape.prototype.destroy.call(this);
1693
1620
  };
1694
- _proto._cookMesh = function _cookMesh(positions, indices, isConvex, cookingFlags) {
1621
+ _proto._cookMesh = function _cookMesh(positions, indices, cookingFlags) {
1695
1622
  var _this__physXPhysics = this._physXPhysics, physX = _this__physXPhysics._physX, physics = _this__physXPhysics._pxPhysics, cooking = _this__physXPhysics._pxCooking, cookingParams = _this__physXPhysics._pxCookingParams;
1696
1623
  // Apply per-shape cooking flags
1697
1624
  var preprocessFlags = 0;
@@ -1704,37 +1631,33 @@ function _possible_constructor_return(self, call) {
1704
1631
  physX.setCookingMeshPreprocessParams(cookingParams, preprocessFlags);
1705
1632
  cooking.setParams(cookingParams);
1706
1633
  var verticesPtr = this._allocatePositions(positions);
1707
- var pxMesh = null;
1708
- if (isConvex) {
1709
- pxMesh = cooking.createConvexMesh(verticesPtr, positions.length, physics);
1634
+ if (this._isConvex) {
1635
+ this._pxMesh = cooking.createConvexMesh(verticesPtr, positions.length, physics);
1710
1636
  physX._free(verticesPtr);
1711
- if (!pxMesh) {
1637
+ if (!this._pxMesh) {
1712
1638
  this._logConvexCookingError(physX);
1713
- return null;
1639
+ return false;
1714
1640
  }
1715
1641
  } else {
1716
1642
  if (!indices) {
1717
1643
  physX._free(verticesPtr);
1718
1644
  console.error("PhysXMeshColliderShape: Triangle mesh requires indices.");
1719
- return null;
1645
+ return false;
1720
1646
  }
1721
1647
  var isU32 = _instanceof(indices, Uint32Array);
1722
1648
  var indicesPtr = this._allocateIndices(indices, isU32);
1723
- pxMesh = cooking.createTriMesh(verticesPtr, positions.length, indicesPtr, indices.length / 3, !isU32, physics);
1649
+ this._pxMesh = cooking.createTriMesh(verticesPtr, positions.length, indicesPtr, indices.length / 3, !isU32, physics);
1724
1650
  physX._free(verticesPtr);
1725
1651
  physX._free(indicesPtr);
1726
- if (!pxMesh) {
1652
+ if (!this._pxMesh) {
1727
1653
  this._logTriMeshCookingError(physX);
1728
- return null;
1654
+ return false;
1729
1655
  }
1730
1656
  }
1731
1657
  var _this__worldScale = this._worldScale, scaleX = _this__worldScale.x, scaleY = _this__worldScale.y, scaleZ = _this__worldScale.z;
1732
- var meshFlag = isConvex ? PhysXMeshColliderShape._tightBoundsFlag : 0;
1733
- var geometry = isConvex ? physX.createConvexMeshGeometry(pxMesh, scaleX, scaleY, scaleZ, meshFlag) : physX.createTriMeshGeometry(pxMesh, scaleX, scaleY, scaleZ, meshFlag);
1734
- return {
1735
- mesh: pxMesh,
1736
- geometry: geometry
1737
- };
1658
+ var meshFlag = this._isConvex ? PhysXMeshColliderShape._tightBoundsFlag : 0;
1659
+ this._pxGeometry = this._isConvex ? physX.createConvexMeshGeometry(this._pxMesh, scaleX, scaleY, scaleZ, meshFlag) : physX.createTriMeshGeometry(this._pxMesh, scaleX, scaleY, scaleZ, meshFlag);
1660
+ return true;
1738
1661
  };
1739
1662
  _proto._logConvexCookingError = function _logConvexCookingError(physX) {
1740
1663
  switch(physX.getLastConvexCookingResult()){
@@ -1784,15 +1707,9 @@ function _possible_constructor_return(self, call) {
1784
1707
  var _this__worldScale = this._worldScale, scaleX = _this__worldScale.x, scaleY = _this__worldScale.y, scaleZ = _this__worldScale.z;
1785
1708
  var meshFlag = this._isConvex ? PhysXMeshColliderShape._tightBoundsFlag : 0;
1786
1709
  var newGeometry = this._isConvex ? physX.createConvexMeshGeometry(this._pxMesh, scaleX, scaleY, scaleZ, meshFlag) : physX.createTriMeshGeometry(this._pxMesh, scaleX, scaleY, scaleZ, meshFlag);
1787
- var oldGeometry = this._pxGeometry;
1788
- try {
1789
- this._pxShape.setGeometry(newGeometry);
1790
- } catch (error) {
1791
- newGeometry == null ? void 0 : newGeometry.delete();
1792
- throw error;
1793
- }
1710
+ this._pxGeometry.delete();
1794
1711
  this._pxGeometry = newGeometry;
1795
- oldGeometry == null ? void 0 : oldGeometry.delete();
1712
+ this._pxShape.setGeometry(this._pxGeometry);
1796
1713
  };
1797
1714
  return PhysXMeshColliderShape;
1798
1715
  }(PhysXColliderShape);
@@ -1851,27 +1768,14 @@ PhysXMeshColliderShape._tightBoundsFlag = 1 // eTIGHT_BOUNDS = 1 (1<<0)
1851
1768
  /**
1852
1769
  * PhysX object creation.
1853
1770
  */ var PhysXPhysics = /*#__PURE__*/ function() {
1854
- function PhysXPhysics(runtimeModeOrOptions, runtimeUrls, options) {
1855
- if (runtimeModeOrOptions === void 0) runtimeModeOrOptions = PhysXRuntimeMode.Auto;
1856
- var _this__tolerancesScaleOptions, _this__tolerancesScaleOptions1;
1771
+ function PhysXPhysics(runtimeMode, runtimeUrls) {
1772
+ if (runtimeMode === void 0) runtimeMode = PhysXRuntimeMode.Auto;
1857
1773
  this._initializeState = 0;
1858
- this._defaultContactOffset = 0.02;
1859
- this._defaultSleepThreshold = 5e-3;
1860
- var isOptionsObject = (typeof runtimeModeOrOptions === "undefined" ? "undefined" : _type_of(runtimeModeOrOptions)) === "object";
1861
- var runtimeMode = isOptionsObject ? PhysXRuntimeMode.Auto : runtimeModeOrOptions != null ? runtimeModeOrOptions : PhysXRuntimeMode.Auto;
1862
- var resolvedOptions = isOptionsObject ? runtimeModeOrOptions : options;
1863
1774
  this._runTimeMode = runtimeMode;
1864
1775
  var _runtimeUrls_wasmSIMDModeUrl;
1865
1776
  this._wasmSIMDModeUrl = (_runtimeUrls_wasmSIMDModeUrl = runtimeUrls == null ? void 0 : runtimeUrls.wasmSIMDModeUrl) != null ? _runtimeUrls_wasmSIMDModeUrl : "https://mdn.alipayobjects.com/rms/uri/file/as/apwallet/1781696156399/suyi/physx.release.simd.js";
1866
1777
  var _runtimeUrls_wasmModeUrl;
1867
1778
  this._wasmModeUrl = (_runtimeUrls_wasmModeUrl = runtimeUrls == null ? void 0 : runtimeUrls.wasmModeUrl) != null ? _runtimeUrls_wasmModeUrl : "https://mdn.alipayobjects.com/rms/uri/file/as/apwallet/1781696156399/suyi/physx.release.js";
1868
- this._tolerancesScaleOptions = resolvedOptions == null ? void 0 : resolvedOptions.tolerancesScale;
1869
- var _this__tolerancesScaleOptions_length;
1870
- var length = (_this__tolerancesScaleOptions_length = (_this__tolerancesScaleOptions = this._tolerancesScaleOptions) == null ? void 0 : _this__tolerancesScaleOptions.length) != null ? _this__tolerancesScaleOptions_length : 1;
1871
- var _this__tolerancesScaleOptions_speed;
1872
- var speed = (_this__tolerancesScaleOptions_speed = (_this__tolerancesScaleOptions1 = this._tolerancesScaleOptions) == null ? void 0 : _this__tolerancesScaleOptions1.speed) != null ? _this__tolerancesScaleOptions_speed : 10;
1873
- this._validateTolerancesScale(length, speed);
1874
- this._updateScaledDefaults(length, speed);
1875
1779
  }
1876
1780
  var _proto = PhysXPhysics.prototype;
1877
1781
  /**
@@ -1941,16 +1845,6 @@ PhysXMeshColliderShape._tightBoundsFlag = 1 // eTIGHT_BOUNDS = 1 (1<<0)
1941
1845
  return scene;
1942
1846
  };
1943
1847
  /**
1944
- * {@inheritDoc IPhysics.getDefaultContactOffset }
1945
- */ _proto.getDefaultContactOffset = function getDefaultContactOffset() {
1946
- return this._defaultContactOffset;
1947
- };
1948
- /**
1949
- * {@inheritDoc IPhysics.getDefaultSleepThreshold }
1950
- */ _proto.getDefaultSleepThreshold = function getDefaultSleepThreshold() {
1951
- return this._defaultSleepThreshold;
1952
- };
1953
- /**
1954
1848
  * {@inheritDoc IPhysics.createStaticCollider }
1955
1849
  */ _proto.createStaticCollider = function createStaticCollider(position, rotation) {
1956
1850
  return new PhysXStaticCollider(this, position, rotation);
@@ -2027,7 +1921,6 @@ PhysXMeshColliderShape._tightBoundsFlag = 1 // eTIGHT_BOUNDS = 1 (1<<0)
2027
1921
  var allocator = new physX.PxDefaultAllocator();
2028
1922
  var pxFoundation = physX.PxCreateFoundation(version, allocator, defaultErrorCallback);
2029
1923
  var tolerancesScale = new physX.PxTolerancesScale();
2030
- this._applyTolerancesScale(tolerancesScale);
2031
1924
  var pxPhysics = physX.PxCreatePhysics(version, pxFoundation, tolerancesScale, false, null);
2032
1925
  physX.PxInitExtensions(pxPhysics, null);
2033
1926
  // Initialize cooking for mesh colliders
@@ -2048,35 +1941,11 @@ PhysXMeshColliderShape._tightBoundsFlag = 1 // eTIGHT_BOUNDS = 1 (1<<0)
2048
1941
  this._allocator = allocator;
2049
1942
  this._tolerancesScale = tolerancesScale;
2050
1943
  };
2051
- _proto._applyTolerancesScale = function _applyTolerancesScale(tolerancesScale) {
2052
- var _this__tolerancesScaleOptions, _this__tolerancesScaleOptions1;
2053
- var _this__tolerancesScaleOptions_length;
2054
- var length = (_this__tolerancesScaleOptions_length = (_this__tolerancesScaleOptions = this._tolerancesScaleOptions) == null ? void 0 : _this__tolerancesScaleOptions.length) != null ? _this__tolerancesScaleOptions_length : tolerancesScale.length;
2055
- var _this__tolerancesScaleOptions_speed;
2056
- var speed = (_this__tolerancesScaleOptions_speed = (_this__tolerancesScaleOptions1 = this._tolerancesScaleOptions) == null ? void 0 : _this__tolerancesScaleOptions1.speed) != null ? _this__tolerancesScaleOptions_speed : tolerancesScale.speed;
2057
- this._validateTolerancesScale(length, speed);
2058
- tolerancesScale.length = length;
2059
- tolerancesScale.speed = speed;
2060
- this._updateScaledDefaults(length, speed);
2061
- };
2062
- _proto._assertPositiveFinite = function _assertPositiveFinite(value, name) {
2063
- if (!Number.isFinite(value) || value <= 0) {
2064
- throw new Error("PhysXPhysics " + name + " must be a positive finite number.");
2065
- }
2066
- };
2067
- _proto._validateTolerancesScale = function _validateTolerancesScale(length, speed) {
2068
- this._assertPositiveFinite(length, "tolerancesScale.length");
2069
- this._assertPositiveFinite(speed, "tolerancesScale.speed");
2070
- };
2071
- _proto._updateScaledDefaults = function _updateScaledDefaults(length, speed) {
2072
- this._defaultContactOffset = 0.02 * length;
2073
- this._defaultSleepThreshold = 5e-5 * speed * speed;
2074
- };
2075
1944
  return PhysXPhysics;
2076
1945
  }();
2077
1946
 
2078
1947
  //@ts-ignore
2079
- var version = "0.0.0-experimental-2.0-migrate.5";
1948
+ var version = "0.0.0-experimental-2.0-skill.0";
2080
1949
  console.log("Galacean Engine Physics PhysX Version: " + version);
2081
1950
 
2082
1951
  export { PhysXPhysics, PhysXRuntimeMode, version };