@galacean/engine-physics-physx 2.0.0-alpha.40 → 2.0.0-alpha.43

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
@@ -672,44 +672,27 @@ PhysXCollider._tempTransform = {
672
672
  this._pxActor.setSolverIterationCounts(value, 1);
673
673
  };
674
674
  /**
675
- * {@inheritDoc IDynamicCollider.setCollisionDetectionMode }
676
- */ _proto.setCollisionDetectionMode = function setCollisionDetectionMode(value) {
677
- var physX = this._physXPhysics._physX;
678
- switch(value){
679
- case 1:
680
- this._pxActor.setRigidBodyFlag(physX.PxRigidBodyFlag.eENABLE_CCD, true);
681
- this._pxActor.setRigidBodyFlag(physX.PxRigidBodyFlag.eENABLE_CCD_FRICTION, false);
682
- this._pxActor.setRigidBodyFlag(physX.PxRigidBodyFlag.eENABLE_SPECULATIVE_CCD, false);
683
- break;
684
- case 2:
685
- this._pxActor.setRigidBodyFlag(physX.PxRigidBodyFlag.eENABLE_CCD, true);
686
- this._pxActor.setRigidBodyFlag(physX.PxRigidBodyFlag.eENABLE_CCD_FRICTION, true);
687
- this._pxActor.setRigidBodyFlag(physX.PxRigidBodyFlag.eENABLE_SPECULATIVE_CCD, false);
688
- break;
689
- case 3:
690
- this._pxActor.setRigidBodyFlag(physX.PxRigidBodyFlag.eENABLE_CCD, false);
691
- this._pxActor.setRigidBodyFlag(physX.PxRigidBodyFlag.eENABLE_CCD_FRICTION, false);
692
- this._pxActor.setRigidBodyFlag(physX.PxRigidBodyFlag.eENABLE_SPECULATIVE_CCD, true);
693
- break;
694
- case 0:
695
- this._pxActor.setRigidBodyFlag(physX.PxRigidBodyFlag.eENABLE_CCD, false);
696
- this._pxActor.setRigidBodyFlag(physX.PxRigidBodyFlag.eENABLE_CCD_FRICTION, false);
697
- this._pxActor.setRigidBodyFlag(physX.PxRigidBodyFlag.eENABLE_SPECULATIVE_CCD, false);
698
- break;
699
- }
700
- };
701
- /**
702
675
  * {@inheritDoc IDynamicCollider.setUseGravity }
703
676
  */ _proto.setUseGravity = function setUseGravity(value) {
704
677
  this._pxActor.setActorFlag(this._physXPhysics._physX.PxActorFlag.eDISABLE_GRAVITY, !value);
705
678
  };
706
679
  /**
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);
680
+ * {@inheritDoc IDynamicCollider.setMotionState }
681
+ */ _proto.setMotionState = function setMotionState(isKinematic, collisionDetectionMode) {
682
+ var PxRigidBodyFlag = this._physXPhysics._physX.PxRigidBodyFlag;
683
+ // PhysX 4.1 does not support sweep-based CCD on kinematic bodies
684
+ var useSpeculativeCCD = collisionDetectionMode === 3 || isKinematic && collisionDetectionMode !== 0;
685
+ this._pxActor.setRigidBodyFlag(PxRigidBodyFlag.eENABLE_CCD, false);
686
+ this._pxActor.setRigidBodyFlag(PxRigidBodyFlag.eENABLE_CCD_FRICTION, false);
687
+ this._pxActor.setRigidBodyFlag(PxRigidBodyFlag.eENABLE_SPECULATIVE_CCD, false);
688
+ this._pxActor.setRigidBodyFlag(PxRigidBodyFlag.eKINEMATIC, isKinematic);
689
+ if (useSpeculativeCCD) {
690
+ this._pxActor.setRigidBodyFlag(PxRigidBodyFlag.eENABLE_SPECULATIVE_CCD, true);
691
+ } else if (collisionDetectionMode !== 0) {
692
+ this._pxActor.setRigidBodyFlag(PxRigidBodyFlag.eENABLE_CCD, true);
693
+ if (collisionDetectionMode === 2) {
694
+ this._pxActor.setRigidBodyFlag(PxRigidBodyFlag.eENABLE_CCD_FRICTION, true);
695
+ }
713
696
  }
714
697
  };
715
698
  /**
@@ -970,6 +953,14 @@ function _create_class(Constructor, protoProps, staticProps) {
970
953
  this._fetchResults();
971
954
  };
972
955
  /**
956
+ * {@inheritDoc IPhysicsScene.setContactEventEnabled }
957
+ */ _proto.setContactEventEnabled = function setContactEventEnabled(enabled) {
958
+ this._physXPhysics._physX.setContactEventEnabled(this._physXSimulationCallbackInstance, enabled);
959
+ if (!enabled) {
960
+ this._contactEventCount = 0;
961
+ }
962
+ };
963
+ /**
973
964
  * {@inheritDoc IPhysicsScene.updateEvents }
974
965
  */ _proto.updateEvents = function updateEvents() {
975
966
  var physicsEvents = this._physicsEvents;
@@ -1773,9 +1764,9 @@ PhysXMeshColliderShape._tightBoundsFlag = 1 // eTIGHT_BOUNDS = 1 (1<<0)
1773
1764
  this._initializeState = 0;
1774
1765
  this._runTimeMode = runtimeMode;
1775
1766
  var _runtimeUrls_wasmSIMDModeUrl;
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";
1767
+ this._wasmSIMDModeUrl = (_runtimeUrls_wasmSIMDModeUrl = runtimeUrls == null ? void 0 : runtimeUrls.wasmSIMDModeUrl) != null ? _runtimeUrls_wasmSIMDModeUrl : "https://mdn.alipayobjects.com/rms/uri/file/as/apwallet/1787063975729/suyi/physx.release.simd.js";
1777
1768
  var _runtimeUrls_wasmModeUrl;
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";
1769
+ this._wasmModeUrl = (_runtimeUrls_wasmModeUrl = runtimeUrls == null ? void 0 : runtimeUrls.wasmModeUrl) != null ? _runtimeUrls_wasmModeUrl : "https://mdn.alipayobjects.com/rms/uri/file/as/apwallet/1787063975729/suyi/physx.release.js";
1779
1770
  }
1780
1771
  var _proto = PhysXPhysics.prototype;
1781
1772
  /**
@@ -1945,7 +1936,7 @@ PhysXMeshColliderShape._tightBoundsFlag = 1 // eTIGHT_BOUNDS = 1 (1<<0)
1945
1936
  }();
1946
1937
 
1947
1938
  //@ts-ignore
1948
- var version = "2.0.0-alpha.40";
1939
+ var version = "2.0.0-alpha.43";
1949
1940
  console.log("Galacean Engine Physics PhysX Version: " + version);
1950
1941
 
1951
1942
  export { PhysXPhysics, PhysXRuntimeMode, version };