@galacean/engine-physics-physx 0.0.0-experimental-2.0-migrate.6 → 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/main.js CHANGED
@@ -4,12 +4,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var engine = require('@galacean/engine');
6
6
 
7
- function _type_of(obj) {
8
- "@swc/helpers - typeof";
9
-
10
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
11
- }
12
-
13
7
  function _instanceof(left, right) {
14
8
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
15
9
  return !!right[Symbol.hasInstance](left);
@@ -49,7 +43,7 @@ function _inherits(subClass, superClass) {
49
43
  */ var PhysXColliderShape = /*#__PURE__*/ function() {
50
44
  function PhysXColliderShape(physXPhysics) {
51
45
  /** @internal */ this._controllers = new engine.DisorderedArray();
52
- /** @internal */ this._contactOffset = 0.02;
46
+ /** @internal */ this._contractOffset = 0.02;
53
47
  /** @internal */ this._worldScale = new engine.Vector3(1, 1, 1);
54
48
  /** @internal */ this._position = new engine.Vector3();
55
49
  /** @internal */ this._rotation = new engine.Vector3();
@@ -57,7 +51,6 @@ function _inherits(subClass, superClass) {
57
51
  this._physXRotation = new engine.Quaternion();
58
52
  this._shapeFlags = 2 | 1;
59
53
  this._physXPhysics = physXPhysics;
60
- this._contactOffset = physXPhysics.getDefaultContactOffset();
61
54
  }
62
55
  var _proto = PhysXColliderShape.prototype;
63
56
  /**
@@ -95,7 +88,7 @@ function _inherits(subClass, superClass) {
95
88
  * {@inheritDoc IColliderShape.setContactOffset }
96
89
  * @default 0.02f * PxTolerancesScale::length
97
90
  */ _proto.setContactOffset = function setContactOffset(offset) {
98
- this._contactOffset = offset;
91
+ this._contractOffset = offset;
99
92
  var controllers = this._controllers;
100
93
  if (controllers.length) {
101
94
  for(var i = 0, n = controllers.length; i < n; i++){
@@ -436,7 +429,7 @@ PhysXBoxColliderShape._tempHalfExtents = new engine.Vector3();
436
429
  this._pxManager && this._createPXController(this._pxManager, shape);
437
430
  this._shape = shape;
438
431
  shape._controllers.add(this);
439
- (_this__pxController = this._pxController) == null ? void 0 : _this__pxController.setContactOffset(shape._contactOffset);
432
+ (_this__pxController = this._pxController) == null ? void 0 : _this__pxController.setContactOffset(shape._contractOffset);
440
433
  (_this__scene = this._scene) == null ? void 0 : _this__scene._addColliderShape(shape._id);
441
434
  };
442
435
  /**
@@ -590,15 +583,7 @@ PhysXCollider._tempTransform = {
590
583
  _inherits(PhysXDynamicCollider, PhysXCollider);
591
584
  function PhysXDynamicCollider(physXPhysics, position, rotation) {
592
585
  var _this;
593
- _this = PhysXCollider.call(this, physXPhysics) || this, /**
594
- * Whether actor is currently kinematic.
595
- * PhysX 拒绝在 kinematic actor 上启用 CCD(会打印警告并忽略),
596
- * 所以 setCollisionDetectionMode 在 kinematic 状态下只缓存目标值,
597
- * 等切回 dynamic 时再真正写到 PhysX。
598
- */ _this._isKinematic = false, /**
599
- * Cached collision detection mode. Always reflects user's intent.
600
- * 实际 PhysX CCD flag 可能跟这个不一致(kinematic 时强制 Discrete)。
601
- */ _this._collisionDetectionMode = 0;
586
+ _this = PhysXCollider.call(this, physXPhysics) || this;
602
587
  var transform = _this._transform(position, rotation);
603
588
  _this._pxActor = physXPhysics._pxPhysics.createRigidDynamic(transform);
604
589
  return _this;
@@ -681,7 +666,7 @@ PhysXCollider._tempTransform = {
681
666
  };
682
667
  /**
683
668
  * {@inheritDoc IDynamicCollider.setSleepThreshold }
684
- * @default 5e-5f * PxTolerancesScale::speed * PxTolerancesScale::speed
669
+ * @default 1e-5f * PxTolerancesScale::speed * PxTolerancesScale::speed
685
670
  */ _proto.setSleepThreshold = function setSleepThreshold(value) {
686
671
  this._pxActor.setSleepThreshold(value);
687
672
  };
@@ -692,45 +677,7 @@ PhysXCollider._tempTransform = {
692
677
  };
693
678
  /**
694
679
  * {@inheritDoc IDynamicCollider.setCollisionDetectionMode }
695
- *
696
- * PhysX 在 kinematic actor 上调用 setRigidBodyFlag(eENABLE_CCD, true) 会触发警告:
697
- * "kinematic bodies with CCD enabled are not supported! CCD will be ignored"
698
- * 虽然 PhysX 会忽略这次调用而非真的拒绝(切回 dynamic 时 flag 不会自动恢复),
699
- * 但每次 setIsKinematic 切换都会让这个 warning 重复打印,污染日志,
700
- * 同时让 actor 在 dynamic 状态下 CCD flag 状态不确定。
701
- *
702
- * 解决: 只在 dynamic 状态时立即 apply CCD flags。kinematic 时仅缓存到
703
- * `_collisionDetectionMode`,等切回 dynamic 时由 setIsKinematic 重新 apply。
704
680
  */ _proto.setCollisionDetectionMode = function setCollisionDetectionMode(value) {
705
- this._collisionDetectionMode = value;
706
- if (!this._isKinematic) {
707
- this._applyCollisionDetectionFlags(value);
708
- }
709
- };
710
- /**
711
- * {@inheritDoc IDynamicCollider.setUseGravity }
712
- */ _proto.setUseGravity = function setUseGravity(value) {
713
- this._pxActor.setActorFlag(this._physXPhysics._physX.PxActorFlag.eDISABLE_GRAVITY, !value);
714
- };
715
- /**
716
- * {@inheritDoc IDynamicCollider.setIsKinematic }
717
- *
718
- * 切换 kinematic 状态时同步处理 CCD flag:
719
- * - 切到 kinematic 前先关 CCD(避免 PhysX 警告 + 让状态显式)
720
- * - 切回 dynamic 后恢复用户期望的 CCD mode(来自 `_collisionDetectionMode` 缓存)
721
- */ _proto.setIsKinematic = function setIsKinematic(value) {
722
- if (this._isKinematic === value) return;
723
- var physX = this._physXPhysics._physX;
724
- if (value) {
725
- this._applyCollisionDetectionFlags(0);
726
- this._pxActor.setRigidBodyFlag(physX.PxRigidBodyFlag.eKINEMATIC, true);
727
- } else {
728
- this._pxActor.setRigidBodyFlag(physX.PxRigidBodyFlag.eKINEMATIC, false);
729
- this._applyCollisionDetectionFlags(this._collisionDetectionMode);
730
- }
731
- this._isKinematic = value;
732
- };
733
- _proto._applyCollisionDetectionFlags = function _applyCollisionDetectionFlags(value) {
734
681
  var physX = this._physXPhysics._physX;
735
682
  switch(value){
736
683
  case 1:
@@ -756,20 +703,27 @@ PhysXCollider._tempTransform = {
756
703
  }
757
704
  };
758
705
  /**
706
+ * {@inheritDoc IDynamicCollider.setUseGravity }
707
+ */ _proto.setUseGravity = function setUseGravity(value) {
708
+ this._pxActor.setActorFlag(this._physXPhysics._physX.PxActorFlag.eDISABLE_GRAVITY, !value);
709
+ };
710
+ /**
711
+ * {@inheritDoc IDynamicCollider.setIsKinematic }
712
+ */ _proto.setIsKinematic = function setIsKinematic(value) {
713
+ if (value) {
714
+ this._pxActor.setRigidBodyFlag(this._physXPhysics._physX.PxRigidBodyFlag.eKINEMATIC, true);
715
+ } else {
716
+ this._pxActor.setRigidBodyFlag(this._physXPhysics._physX.PxRigidBodyFlag.eKINEMATIC, false);
717
+ }
718
+ };
719
+ /**
759
720
  * {@inheritDoc IDynamicCollider.setConstraints }
760
721
  */ _proto.setConstraints = function setConstraints(flags) {
761
722
  this._pxActor.setRigidDynamicLockFlags(flags);
762
723
  };
763
724
  /**
764
725
  * {@inheritDoc IDynamicCollider.addForce }
765
- *
766
- * PhysX 在 kinematic actor 上调 addForce 是 no-op(doc: "kinematic bodies don't
767
- * respond to forces")。提前 return 避免无意义的 wasm boundary cross。
768
- *
769
- * Sleeping actor 不需要显式 wakeUp — wasm binding 调用 `addForce(force, eFORCE,
770
- * autowake=true)`,PhysX 自动唤醒(已通过 `applyForce on sleeping actor` 测试验证)。
771
726
  */ _proto.addForce = function addForce(force) {
772
- if (this._isKinematic) return;
773
727
  this._pxActor.addForce(force);
774
728
  };
775
729
  /**
@@ -779,33 +733,23 @@ PhysXCollider._tempTransform = {
779
733
  };
780
734
  /**
781
735
  * {@inheritDoc IDynamicCollider.addTorque }
782
- *
783
- * 同 addForce — kinematic 提前 return,sleeping 由 PhysX autowake 自动处理。
784
736
  */ _proto.addTorque = function addTorque(torque) {
785
- if (this._isKinematic) return;
786
737
  this._pxActor.addTorque(torque);
787
738
  };
788
739
  /**
789
740
  * {@inheritDoc IDynamicCollider.move }
790
- *
791
- * PhysX 要求 setKinematicTarget 的 rotation 是 normalized quaternion,否则会触发
792
- * 内部 assertion / 警告,并把 actor 转到错误的姿态。所以在写入 wasm 边界前统一 normalize。
793
741
  */ _proto.move = function move(positionOrRotation, rotation) {
794
- var tempTranslation = PhysXDynamicCollider._tempTranslation;
795
- var tempRotation = PhysXDynamicCollider._tempRotation;
796
742
  if (rotation) {
797
- tempRotation.copyFrom(rotation).normalize();
798
- this._pxActor.setKinematicTarget(positionOrRotation, tempRotation);
743
+ this._pxActor.setKinematicTarget(positionOrRotation, rotation);
799
744
  return;
800
745
  }
746
+ var tempTranslation = PhysXDynamicCollider._tempTranslation;
747
+ var tempRotation = PhysXDynamicCollider._tempRotation;
748
+ this.getWorldTransform(tempTranslation, tempRotation);
801
749
  if (_instanceof(positionOrRotation, engine.Vector3)) {
802
- this.getWorldTransform(tempTranslation, tempRotation);
803
- // current rotation read from PhysX is already normalized; no extra work needed
804
750
  this._pxActor.setKinematicTarget(positionOrRotation, tempRotation);
805
751
  } else {
806
- this.getWorldTransform(tempTranslation, tempRotation);
807
- tempRotation.copyFrom(positionOrRotation).normalize();
808
- this._pxActor.setKinematicTarget(tempTranslation, tempRotation);
752
+ this._pxActor.setKinematicTarget(tempTranslation, positionOrRotation);
809
753
  }
810
754
  };
811
755
  /**
@@ -908,7 +852,6 @@ function _create_class(Constructor, protoProps, staticProps) {
908
852
  this._activeTriggers = new engine.DisorderedArray();
909
853
  this._contactEvents = [];
910
854
  this._contactEventCount = 0;
911
- this._contactEventEnabled = true;
912
855
  this._triggerEvents = [];
913
856
  this._physicsEvents = {
914
857
  contactEvents: [],
@@ -1031,17 +974,6 @@ function _create_class(Constructor, protoProps, staticProps) {
1031
974
  this._fetchResults();
1032
975
  };
1033
976
  /**
1034
- * {@inheritDoc IPhysicsScene.setContactEventEnabled }
1035
- */ _proto.setContactEventEnabled = function setContactEventEnabled(enabled) {
1036
- if (this._contactEventEnabled === enabled) {
1037
- return;
1038
- }
1039
- this._contactEventEnabled = enabled;
1040
- if (!enabled) {
1041
- this._contactEventCount = 0;
1042
- }
1043
- };
1044
- /**
1045
977
  * {@inheritDoc IPhysicsScene.updateEvents }
1046
978
  */ _proto.updateEvents = function updateEvents() {
1047
979
  var physicsEvents = this._physicsEvents;
@@ -1289,7 +1221,6 @@ function _create_class(Constructor, protoProps, staticProps) {
1289
1221
  };
1290
1222
  _proto._bufferContactEvent = function _bufferContactEvent(collision, state) {
1291
1223
  var _this__contactEvents, _index;
1292
- if (!this._contactEventEnabled) return;
1293
1224
  var index = this._contactEventCount++;
1294
1225
  var event = (_this__contactEvents = this._contactEvents)[_index = index] || (_this__contactEvents[_index] = new ContactEvent());
1295
1226
  event.shape0Id = collision.shape0Id;
@@ -1627,6 +1558,12 @@ function _assert_this_initialized(self) {
1627
1558
  return self;
1628
1559
  }
1629
1560
 
1561
+ function _type_of(obj) {
1562
+ "@swc/helpers - typeof";
1563
+
1564
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
1565
+ }
1566
+
1630
1567
  function _possible_constructor_return(self, call) {
1631
1568
  if (call && (_type_of(call) === "object" || typeof call === "function")) return call;
1632
1569
 
@@ -1641,8 +1578,7 @@ function _possible_constructor_return(self, call) {
1641
1578
  var _this;
1642
1579
  _this = PhysXColliderShape.call(this, physXPhysics) || this, _this._pxMesh = null;
1643
1580
  _this._isConvex = isConvex;
1644
- var cooked = _this._cookMesh(positions, indices, isConvex, cookingFlags);
1645
- if (!cooked) {
1581
+ if (!_this._cookMesh(positions, indices, cookingFlags)) {
1646
1582
  return _possible_constructor_return(_this);
1647
1583
  }
1648
1584
  var physX = physXPhysics._physX, physics = physXPhysics._pxPhysics;
@@ -1650,11 +1586,9 @@ function _possible_constructor_return(self, call) {
1650
1586
  var shapeFlags = ShapeFlag.SCENE_QUERY_SHAPE | ShapeFlag.SIMULATION_SHAPE;
1651
1587
  var meshFlag = isConvex ? PhysXMeshColliderShape._tightBoundsFlag : 0;
1652
1588
  var createShapeFn = isConvex ? physX.createConvexMeshShape : physX.createTriMeshShape;
1653
- _this._pxShape = createShapeFn(cooked.mesh, scaleX, scaleY, scaleZ, meshFlag, shapeFlags, material._pxMaterial, physics);
1589
+ _this._pxShape = createShapeFn(_this._pxMesh, scaleX, scaleY, scaleZ, meshFlag, shapeFlags, material._pxMaterial, physics);
1654
1590
  _this._id = uniqueID;
1655
1591
  _this._pxMaterial = material._pxMaterial;
1656
- _this._pxMesh = cooked.mesh;
1657
- _this._pxGeometry = cooked.geometry;
1658
1592
  _this._pxShape.setUUID(uniqueID);
1659
1593
  _this._setLocalPose();
1660
1594
  return _this;
@@ -1663,25 +1597,16 @@ function _possible_constructor_return(self, call) {
1663
1597
  /**
1664
1598
  * {@inheritDoc IMeshColliderShape.setMeshData }
1665
1599
  */ _proto.setMeshData = function setMeshData(positions, indices, isConvex, cookingFlags) {
1666
- var cooked = this._cookMesh(positions, indices, isConvex, cookingFlags);
1667
- if (!cooked) {
1600
+ var _this__pxMesh, _this__pxGeometry;
1601
+ (_this__pxMesh = this._pxMesh) == null ? void 0 : _this__pxMesh.release();
1602
+ (_this__pxGeometry = this._pxGeometry) == null ? void 0 : _this__pxGeometry.delete();
1603
+ this._pxMesh = null;
1604
+ this._pxGeometry = null;
1605
+ this._isConvex = isConvex;
1606
+ if (!this._cookMesh(positions, indices, cookingFlags)) {
1668
1607
  return false;
1669
1608
  }
1670
- var oldMesh = this._pxMesh;
1671
- var oldGeometry = this._pxGeometry;
1672
- try {
1673
- this._pxShape.setGeometry(cooked.geometry);
1674
- } catch (error) {
1675
- var _cooked_mesh, _cooked_geometry;
1676
- (_cooked_mesh = cooked.mesh) == null ? void 0 : _cooked_mesh.release();
1677
- (_cooked_geometry = cooked.geometry) == null ? void 0 : _cooked_geometry.delete();
1678
- throw error;
1679
- }
1680
- this._pxMesh = cooked.mesh;
1681
- this._pxGeometry = cooked.geometry;
1682
- this._isConvex = isConvex;
1683
- oldMesh == null ? void 0 : oldMesh.release();
1684
- oldGeometry == null ? void 0 : oldGeometry.delete();
1609
+ this._pxShape.setGeometry(this._pxGeometry);
1685
1610
  return true;
1686
1611
  };
1687
1612
  /**
@@ -1697,7 +1622,7 @@ function _possible_constructor_return(self, call) {
1697
1622
  (_this__pxMesh = this._pxMesh) == null ? void 0 : _this__pxMesh.release();
1698
1623
  PhysXColliderShape.prototype.destroy.call(this);
1699
1624
  };
1700
- _proto._cookMesh = function _cookMesh(positions, indices, isConvex, cookingFlags) {
1625
+ _proto._cookMesh = function _cookMesh(positions, indices, cookingFlags) {
1701
1626
  var _this__physXPhysics = this._physXPhysics, physX = _this__physXPhysics._physX, physics = _this__physXPhysics._pxPhysics, cooking = _this__physXPhysics._pxCooking, cookingParams = _this__physXPhysics._pxCookingParams;
1702
1627
  // Apply per-shape cooking flags
1703
1628
  var preprocessFlags = 0;
@@ -1710,37 +1635,33 @@ function _possible_constructor_return(self, call) {
1710
1635
  physX.setCookingMeshPreprocessParams(cookingParams, preprocessFlags);
1711
1636
  cooking.setParams(cookingParams);
1712
1637
  var verticesPtr = this._allocatePositions(positions);
1713
- var pxMesh = null;
1714
- if (isConvex) {
1715
- pxMesh = cooking.createConvexMesh(verticesPtr, positions.length, physics);
1638
+ if (this._isConvex) {
1639
+ this._pxMesh = cooking.createConvexMesh(verticesPtr, positions.length, physics);
1716
1640
  physX._free(verticesPtr);
1717
- if (!pxMesh) {
1641
+ if (!this._pxMesh) {
1718
1642
  this._logConvexCookingError(physX);
1719
- return null;
1643
+ return false;
1720
1644
  }
1721
1645
  } else {
1722
1646
  if (!indices) {
1723
1647
  physX._free(verticesPtr);
1724
1648
  console.error("PhysXMeshColliderShape: Triangle mesh requires indices.");
1725
- return null;
1649
+ return false;
1726
1650
  }
1727
1651
  var isU32 = _instanceof(indices, Uint32Array);
1728
1652
  var indicesPtr = this._allocateIndices(indices, isU32);
1729
- pxMesh = cooking.createTriMesh(verticesPtr, positions.length, indicesPtr, indices.length / 3, !isU32, physics);
1653
+ this._pxMesh = cooking.createTriMesh(verticesPtr, positions.length, indicesPtr, indices.length / 3, !isU32, physics);
1730
1654
  physX._free(verticesPtr);
1731
1655
  physX._free(indicesPtr);
1732
- if (!pxMesh) {
1656
+ if (!this._pxMesh) {
1733
1657
  this._logTriMeshCookingError(physX);
1734
- return null;
1658
+ return false;
1735
1659
  }
1736
1660
  }
1737
1661
  var _this__worldScale = this._worldScale, scaleX = _this__worldScale.x, scaleY = _this__worldScale.y, scaleZ = _this__worldScale.z;
1738
- var meshFlag = isConvex ? PhysXMeshColliderShape._tightBoundsFlag : 0;
1739
- var geometry = isConvex ? physX.createConvexMeshGeometry(pxMesh, scaleX, scaleY, scaleZ, meshFlag) : physX.createTriMeshGeometry(pxMesh, scaleX, scaleY, scaleZ, meshFlag);
1740
- return {
1741
- mesh: pxMesh,
1742
- geometry: geometry
1743
- };
1662
+ var meshFlag = this._isConvex ? PhysXMeshColliderShape._tightBoundsFlag : 0;
1663
+ this._pxGeometry = this._isConvex ? physX.createConvexMeshGeometry(this._pxMesh, scaleX, scaleY, scaleZ, meshFlag) : physX.createTriMeshGeometry(this._pxMesh, scaleX, scaleY, scaleZ, meshFlag);
1664
+ return true;
1744
1665
  };
1745
1666
  _proto._logConvexCookingError = function _logConvexCookingError(physX) {
1746
1667
  switch(physX.getLastConvexCookingResult()){
@@ -1790,15 +1711,9 @@ function _possible_constructor_return(self, call) {
1790
1711
  var _this__worldScale = this._worldScale, scaleX = _this__worldScale.x, scaleY = _this__worldScale.y, scaleZ = _this__worldScale.z;
1791
1712
  var meshFlag = this._isConvex ? PhysXMeshColliderShape._tightBoundsFlag : 0;
1792
1713
  var newGeometry = this._isConvex ? physX.createConvexMeshGeometry(this._pxMesh, scaleX, scaleY, scaleZ, meshFlag) : physX.createTriMeshGeometry(this._pxMesh, scaleX, scaleY, scaleZ, meshFlag);
1793
- var oldGeometry = this._pxGeometry;
1794
- try {
1795
- this._pxShape.setGeometry(newGeometry);
1796
- } catch (error) {
1797
- newGeometry == null ? void 0 : newGeometry.delete();
1798
- throw error;
1799
- }
1714
+ this._pxGeometry.delete();
1800
1715
  this._pxGeometry = newGeometry;
1801
- oldGeometry == null ? void 0 : oldGeometry.delete();
1716
+ this._pxShape.setGeometry(this._pxGeometry);
1802
1717
  };
1803
1718
  return PhysXMeshColliderShape;
1804
1719
  }(PhysXColliderShape);
@@ -1857,27 +1772,14 @@ PhysXMeshColliderShape._tightBoundsFlag = 1 // eTIGHT_BOUNDS = 1 (1<<0)
1857
1772
  /**
1858
1773
  * PhysX object creation.
1859
1774
  */ var PhysXPhysics = /*#__PURE__*/ function() {
1860
- function PhysXPhysics(runtimeModeOrOptions, runtimeUrls, options) {
1861
- if (runtimeModeOrOptions === void 0) runtimeModeOrOptions = PhysXRuntimeMode.Auto;
1862
- var _this__tolerancesScaleOptions, _this__tolerancesScaleOptions1;
1775
+ function PhysXPhysics(runtimeMode, runtimeUrls) {
1776
+ if (runtimeMode === void 0) runtimeMode = PhysXRuntimeMode.Auto;
1863
1777
  this._initializeState = 0;
1864
- this._defaultContactOffset = 0.02;
1865
- this._defaultSleepThreshold = 5e-3;
1866
- var isOptionsObject = (typeof runtimeModeOrOptions === "undefined" ? "undefined" : _type_of(runtimeModeOrOptions)) === "object";
1867
- var runtimeMode = isOptionsObject ? PhysXRuntimeMode.Auto : runtimeModeOrOptions != null ? runtimeModeOrOptions : PhysXRuntimeMode.Auto;
1868
- var resolvedOptions = isOptionsObject ? runtimeModeOrOptions : options;
1869
1778
  this._runTimeMode = runtimeMode;
1870
1779
  var _runtimeUrls_wasmSIMDModeUrl;
1871
1780
  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";
1872
1781
  var _runtimeUrls_wasmModeUrl;
1873
1782
  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";
1874
- this._tolerancesScaleOptions = resolvedOptions == null ? void 0 : resolvedOptions.tolerancesScale;
1875
- var _this__tolerancesScaleOptions_length;
1876
- var length = (_this__tolerancesScaleOptions_length = (_this__tolerancesScaleOptions = this._tolerancesScaleOptions) == null ? void 0 : _this__tolerancesScaleOptions.length) != null ? _this__tolerancesScaleOptions_length : 1;
1877
- var _this__tolerancesScaleOptions_speed;
1878
- var speed = (_this__tolerancesScaleOptions_speed = (_this__tolerancesScaleOptions1 = this._tolerancesScaleOptions) == null ? void 0 : _this__tolerancesScaleOptions1.speed) != null ? _this__tolerancesScaleOptions_speed : 10;
1879
- this._validateTolerancesScale(length, speed);
1880
- this._updateScaledDefaults(length, speed);
1881
1783
  }
1882
1784
  var _proto = PhysXPhysics.prototype;
1883
1785
  /**
@@ -1947,16 +1849,6 @@ PhysXMeshColliderShape._tightBoundsFlag = 1 // eTIGHT_BOUNDS = 1 (1<<0)
1947
1849
  return scene;
1948
1850
  };
1949
1851
  /**
1950
- * {@inheritDoc IPhysics.getDefaultContactOffset }
1951
- */ _proto.getDefaultContactOffset = function getDefaultContactOffset() {
1952
- return this._defaultContactOffset;
1953
- };
1954
- /**
1955
- * {@inheritDoc IPhysics.getDefaultSleepThreshold }
1956
- */ _proto.getDefaultSleepThreshold = function getDefaultSleepThreshold() {
1957
- return this._defaultSleepThreshold;
1958
- };
1959
- /**
1960
1852
  * {@inheritDoc IPhysics.createStaticCollider }
1961
1853
  */ _proto.createStaticCollider = function createStaticCollider(position, rotation) {
1962
1854
  return new PhysXStaticCollider(this, position, rotation);
@@ -2033,7 +1925,6 @@ PhysXMeshColliderShape._tightBoundsFlag = 1 // eTIGHT_BOUNDS = 1 (1<<0)
2033
1925
  var allocator = new physX.PxDefaultAllocator();
2034
1926
  var pxFoundation = physX.PxCreateFoundation(version, allocator, defaultErrorCallback);
2035
1927
  var tolerancesScale = new physX.PxTolerancesScale();
2036
- this._applyTolerancesScale(tolerancesScale);
2037
1928
  var pxPhysics = physX.PxCreatePhysics(version, pxFoundation, tolerancesScale, false, null);
2038
1929
  physX.PxInitExtensions(pxPhysics, null);
2039
1930
  // Initialize cooking for mesh colliders
@@ -2054,35 +1945,11 @@ PhysXMeshColliderShape._tightBoundsFlag = 1 // eTIGHT_BOUNDS = 1 (1<<0)
2054
1945
  this._allocator = allocator;
2055
1946
  this._tolerancesScale = tolerancesScale;
2056
1947
  };
2057
- _proto._applyTolerancesScale = function _applyTolerancesScale(tolerancesScale) {
2058
- var _this__tolerancesScaleOptions, _this__tolerancesScaleOptions1;
2059
- var _this__tolerancesScaleOptions_length;
2060
- var length = (_this__tolerancesScaleOptions_length = (_this__tolerancesScaleOptions = this._tolerancesScaleOptions) == null ? void 0 : _this__tolerancesScaleOptions.length) != null ? _this__tolerancesScaleOptions_length : tolerancesScale.length;
2061
- var _this__tolerancesScaleOptions_speed;
2062
- var speed = (_this__tolerancesScaleOptions_speed = (_this__tolerancesScaleOptions1 = this._tolerancesScaleOptions) == null ? void 0 : _this__tolerancesScaleOptions1.speed) != null ? _this__tolerancesScaleOptions_speed : tolerancesScale.speed;
2063
- this._validateTolerancesScale(length, speed);
2064
- tolerancesScale.length = length;
2065
- tolerancesScale.speed = speed;
2066
- this._updateScaledDefaults(length, speed);
2067
- };
2068
- _proto._assertPositiveFinite = function _assertPositiveFinite(value, name) {
2069
- if (!Number.isFinite(value) || value <= 0) {
2070
- throw new Error("PhysXPhysics " + name + " must be a positive finite number.");
2071
- }
2072
- };
2073
- _proto._validateTolerancesScale = function _validateTolerancesScale(length, speed) {
2074
- this._assertPositiveFinite(length, "tolerancesScale.length");
2075
- this._assertPositiveFinite(speed, "tolerancesScale.speed");
2076
- };
2077
- _proto._updateScaledDefaults = function _updateScaledDefaults(length, speed) {
2078
- this._defaultContactOffset = 0.02 * length;
2079
- this._defaultSleepThreshold = 5e-5 * speed * speed;
2080
- };
2081
1948
  return PhysXPhysics;
2082
1949
  }();
2083
1950
 
2084
1951
  //@ts-ignore
2085
- var version = "0.0.0-experimental-2.0-migrate.6";
1952
+ var version = "0.0.0-experimental-2.0-skill.0";
2086
1953
  console.log("Galacean Engine Physics PhysX Version: " + version);
2087
1954
 
2088
1955
  exports.PhysXPhysics = PhysXPhysics;