@galacean/engine-physics-physx 1.2.0-beta.3 → 1.2.0-beta.4
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/LICENSE +2 -2
- package/dist/browser.js +1 -1
- 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/main.js.map +1 -1
- package/dist/miniprogram.js +1 -1
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/package.json +4 -4
- package/types/StaticInterfaceImplement.d.ts +5 -0
package/dist/browser.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@galacean/engine")):"function"==typeof define&&define.amd?define(["exports","@galacean/engine"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).Galacean=t.Galacean||{},t.Galacean.PhysicsPhysX={}),t.Galacean)}(this,function(t,e){"use strict";function i(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):t instanceof e}function n(t,e){return(n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function s(t,e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&n(t,e)}var o,a,r,h,l,c,_,u,p,f,x,y,d,g,m,S=function(){function t(t){void 0===t&&(t=0),this.length=0,this._elements=Array(t)}var e=t.prototype;return e.add=function(t){this.length===this._elements.length?this._elements.push(t):this._elements[this.length]=t,this.length++},e.delete=function(t){var e=this._elements.indexOf(t);this.deleteByIndex(e)},e.get=function(t){if(t>=this.length)throw"Index is out of range.";return this._elements[t]},e.deleteByIndex=function(t){var e=this._elements,i=null,n=this.length-1;return t!==n&&(i=e[n],e[t]=i),this.length--,i},e.garbageCollection=function(){this._elements.length=this.length},t}();(o=p||(p={}))[o.SIMULATION_SHAPE=1]="SIMULATION_SHAPE",o[o.SCENE_QUERY_SHAPE=2]="SCENE_QUERY_SHAPE",o[o.TRIGGER_SHAPE=4]="TRIGGER_SHAPE";var v=function(){function t(t){this._controllers=new S,this._worldScale=new e.Vector3(1,1,1),this._position=new e.Vector3,this._rotation=null,this._axis=null,this._physXRotation=new e.Quaternion,this._shapeFlags=3,this._physXPhysics=t}var i=t.prototype;return i.setRotation=function(t){this._rotation=t,e.Quaternion.rotationYawPitchRoll(t.x,t.y,t.z,this._physXRotation),this._axis&&e.Quaternion.multiply(this._physXRotation,this._axis,this._physXRotation),this._physXRotation.normalize(),this._setLocalPose()},i.setPosition=function(t){t!==this._position&&this._position.copyFrom(t);for(var e=this._controllers,i=0,n=e.length;i<n;i++)e.get(i)._updateShapePosition(this._position,this._worldScale);this._setLocalPose()},i.setWorldScale=function(t){this._worldScale.copyFrom(t),this._setLocalPose();for(var e=this._controllers,i=0,n=e.length;i<n;i++)e.get(i)._updateShapePosition(this._position,this._worldScale)},i.setContactOffset=function(t){this._pxShape.setContactOffset(t);for(var e=this._controllers,i=0,n=e.length;i<n;i++)e.get(i)._pxController.setContactOffset(t)},i.setMaterial=function(t){this._pxMaterial=t._pxMaterial,this._pxShape.setMaterial(this._pxMaterial)},i.setIsTrigger=function(t){this._modifyFlag(1,!t),this._modifyFlag(4,t),this._setShapeFlags(this._shapeFlags)},i.destroy=function(){this._pxShape.release()},i._setShapeFlags=function(t){this._shapeFlags=t,this._pxShape.setFlags(new this._physXPhysics._physX.PxShapeFlags(this._shapeFlags))},i._setLocalPose=function(){var i=t.transform;e.Vector3.multiply(this._position,this._worldScale,i.translation),i.rotation=this._physXRotation,this._pxShape.setLocalPose(i)},i._initialize=function(t,e){this._id=e,this._pxMaterial=t._pxMaterial,this._pxShape=this._physXPhysics._pxPhysics.createShape(this._pxGeometry,t._pxMaterial,!0,new this._physXPhysics._physX.PxShapeFlags(this._shapeFlags)),this._pxShape.setUUID(e)},i._modifyFlag=function(t,e){this._shapeFlags=e?this._shapeFlags|t:this._shapeFlags&~t},t}();v.halfSqrt=.70710678118655,v.transform={translation:new e.Vector3,rotation:null};var P=function(t){function i(i,n,s,o){(a=t.call(this,i)||this)._halfSize=new e.Vector3,a._sizeScale=new e.Vector3(1,1,1);var a,r=a._halfSize;return r.set(.5*s.x,.5*s.y,.5*s.z),a._pxGeometry=new i._physX.PxBoxGeometry(r.x,r.y,r.z),a._initialize(o,n),a._setLocalPose(),a}s(i,t);var n=i.prototype;return n.setSize=function(t){var n=this._halfSize,s=i._tempHalfExtents;n.set(.5*t.x,.5*t.y,.5*t.z),e.Vector3.multiply(n,this._sizeScale,s),this._pxGeometry.halfExtents=s,this._pxShape.setGeometry(this._pxGeometry),this._updateController(s)},n.setWorldScale=function(n){t.prototype.setWorldScale.call(this,n),this._sizeScale.set(Math.abs(n.x),Math.abs(n.y),Math.abs(n.z));var s=i._tempHalfExtents;e.Vector3.multiply(this._halfSize,this._sizeScale,s),this._pxGeometry.halfExtents=s,this._pxShape.setGeometry(this._pxGeometry),this._updateController(s)},n._updateController=function(t){for(var e=this._controllers,i=0,n=e.length;i<n;i++){var s=e.get(i)._pxController;s.setHalfHeight(t.x),s.setHalfSideExtent(t.y),s.setHalfForwardExtent(t.z)}},i}(v);P._tempHalfExtents=new e.Vector3;var A=function(t){function i(i,n,s,o,a){var r;return(r=t.call(this,i)||this)._upAxis=1,r._sizeScale=new e.Vector3(1,1,1),r._radius=s,r._halfHeight=.5*o,r._axis=new e.Quaternion(0,0,v.halfSqrt,v.halfSqrt),r._physXRotation.copyFrom(r._axis),r._pxGeometry=new i._physX.PxCapsuleGeometry(r._radius,r._halfHeight),r._initialize(a,n),r._setLocalPose(),r}s(i,t);var n=i.prototype;return n.setRadius=function(t){this._radius=t;var e=this._sizeScale;switch(this._upAxis){case 0:this._pxGeometry.radius=this._radius*Math.max(e.y,e.z);break;case 1:this._pxGeometry.radius=this._radius*Math.max(e.x,e.z);break;case 2:this._pxGeometry.radius=this._radius*Math.max(e.x,e.y)}this._pxShape.setGeometry(this._pxGeometry);for(var i=this._pxGeometry.radius,n=this._controllers,s=0,o=n.length;s<o;s++)n.get(s)._pxController.setRadius(i)},n.setHeight=function(t){this._halfHeight=.5*t;var e=this._sizeScale;switch(this._upAxis){case 0:this._pxGeometry.halfHeight=this._halfHeight*e.x;break;case 1:this._pxGeometry.halfHeight=this._halfHeight*e.y;break;case 2:this._pxGeometry.halfHeight=this._halfHeight*e.z}this._pxShape.setGeometry(this._pxGeometry);for(var i=2*this._pxGeometry.halfHeight,n=this._controllers,s=0,o=n.length;s<o;s++)n.get(s)._pxController.setHeight(i)},n.setUpAxis=function(t){var i=this._rotation,n=this._axis,s=this._physXRotation;switch(this._upAxis=t,this._upAxis){case 0:n.set(0,0,0,1);break;case 1:n.set(0,0,v.halfSqrt,v.halfSqrt);break;case 2:n.set(0,v.halfSqrt,0,v.halfSqrt)}i?(e.Quaternion.rotationYawPitchRoll(i.x,i.y,i.z,s),e.Quaternion.multiply(s,n,s)):s.copyFrom(n),this._setLocalPose()},n.setWorldScale=function(e){t.prototype.setWorldScale.call(this,e);var i=this._sizeScale.set(Math.abs(e.x),Math.abs(e.y),Math.abs(e.z)),n=this._pxGeometry;switch(this._upAxis){case 0:n.radius=this._radius*Math.max(i.y,i.z),n.halfHeight=this._halfHeight*i.x;break;case 1:n.radius=this._radius*Math.max(i.x,i.z),n.halfHeight=this._halfHeight*i.y;break;case 2:n.radius=this._radius*Math.max(i.x,i.y),n.halfHeight=this._halfHeight*i.z}this._pxShape.setGeometry(n);for(var s=n.radius,o=2*n.halfHeight,a=this._controllers,r=0,h=a.length;r<h;r++){var l=a.get(r)._pxController;l.setRadius(s),l.setHeight(o)}},i}(v);(a=f||(f={}))[a.X=0]="X",a[a.Y=1]="Y",a[a.Z=2]="Z";var C=function(){function t(t){this._shapeScaledPosition=new e.Vector3,this._worldPosition=null,this._physXPhysics=t}var n=t.prototype;return n.move=function(t,e,i){var n,s;return null!=(s=null==(n=this._pxController)?void 0:n.move(t,e,i))?s:0},n.setWorldPosition=function(t){this._worldPosition=t,this._updateNativePosition()},n.getWorldPosition=function(t){this._pxController&&(t.copyFrom(this._pxController.getPosition()),t.subtract(this._shapeScaledPosition))},n.setStepOffset=function(t){var e;null==(e=this._pxController)||e.setStepOffset(t)},n.setNonWalkableMode=function(t){var e;null==(e=this._pxController)||e.setNonWalkableMode(t)},n.setUpDirection=function(t){var e;null==(e=this._pxController)||e.setUpDirection(t)},n.setSlopeLimit=function(t){var e;null==(e=this._pxController)||e.setSlopeLimit(t)},n.addShape=function(t){this._pxManager&&this._createPXController(this._pxManager,t),this._shape=t,t._controllers.add(this)},n.removeShape=function(t){this._destroyPXController(),this._shape=null,t._controllers.delete(this)},n.destroy=function(){this._destroyPXController()},n._createPXController=function(t,e){var n;if(i(e,P))(n=new this._physXPhysics._physX.PxBoxControllerDesc).halfHeight=e._halfSize.x,n.halfSideExtent=e._halfSize.y,n.halfForwardExtent=e._halfSize.z;else if(i(e,A))(n=new this._physXPhysics._physX.PxCapsuleControllerDesc).radius=e._radius,n.height=2*e._halfHeight,n.climbingMode=1;else throw"unsupported shape type";n.setMaterial(e._pxMaterial),this._pxController=t._getControllerManager().createController(n),this._pxController.setUUID(e._id)},n._destroyPXController=function(){this._pxController&&(this._pxController.release(),this._pxController=null)},n._updateShapePosition=function(t,i){e.Vector3.multiply(t,i,this._shapeScaledPosition),this._updateNativePosition()},n._updateNativePosition=function(){var i=this._worldPosition;this._pxController&&i&&(e.Vector3.add(i,this._shapeScaledPosition,t._tempVec),this._pxController.setPosition(t._tempVec))},t}();C._tempVec=new e.Vector3;var M=function(){function t(t){this._physXPhysics=t}var e=t.prototype;return e.addShape=function(t){this._pxActor.attachShape(t._pxShape)},e.removeShape=function(t){this._pxActor.detachShape(t._pxShape,!0)},e.setWorldTransform=function(t,e){this._pxActor.setGlobalPose(this._transform(t,e),!0)},e.getWorldTransform=function(t,e){var i=this._pxActor.getGlobalPose();t.set(i.translation.x,i.translation.y,i.translation.z),e.set(i.rotation.x,i.rotation.y,i.rotation.z,i.rotation.w)},e.destroy=function(){this._pxActor.release()},e._transform=function(e,i){var n=t._tempTransform;return n.translation=e,n.rotation=i.normalize(),n},t}();M._tempTransform={translation:null,rotation:null},(r=x||(x={}))[r.Discrete=0]="Discrete",r[r.Continuous=1]="Continuous",r[r.ContinuousDynamic=2]="ContinuousDynamic",r[r.ContinuousSpeculative=3]="ContinuousSpeculative";var w=function(t){function n(e,i,n){var s,o=(s=t.call(this,e)||this)._transform(i,n);return s._pxActor=e._pxPhysics.createRigidDynamic(o),s}s(n,t);var o=n.prototype;return o.setLinearDamping=function(t){this._pxActor.setLinearDamping(t)},o.setAngularDamping=function(t){this._pxActor.setAngularDamping(t)},o.setLinearVelocity=function(t){this._pxActor.setLinearVelocity(t,!0)},o.setAngularVelocity=function(t){this._pxActor.setAngularVelocity(t,!0)},o.setMass=function(t){this._pxActor.setMass(t)},o.setCenterOfMass=function(t){this._pxActor.setCMassLocalPose(t)},o.setInertiaTensor=function(t){this._pxActor.setMassSpaceInertiaTensor(t)},o.setMaxAngularVelocity=function(t){this._pxActor.setMaxAngularVelocity(t)},o.setMaxDepenetrationVelocity=function(t){this._pxActor.setMaxDepenetrationVelocity(t)},o.setSleepThreshold=function(t){this._pxActor.setSleepThreshold(t)},o.setSolverIterations=function(t){this._pxActor.setSolverIterationCounts(t,1)},o.setCollisionDetectionMode=function(t){switch(t){case 1:this._pxActor.setRigidBodyFlag(this._physXPhysics._physX.PxRigidBodyFlag.eENABLE_CCD,!0);break;case 2:this._pxActor.setRigidBodyFlag(this._physXPhysics._physX.PxRigidBodyFlag.eENABLE_CCD_FRICTION,!0);break;case 3:this._pxActor.setRigidBodyFlag(this._physXPhysics._physX.PxRigidBodyFlag.eENABLE_SPECULATIVE_CCD,!0);break;case 0:var e=this._physXPhysics._physX;this._pxActor.setRigidBodyFlag(e.PxRigidBodyFlag.eENABLE_CCD,!1),this._pxActor.setRigidBodyFlag(e.PxRigidBodyFlag.eENABLE_CCD_FRICTION,!1),this._pxActor.setRigidBodyFlag(e.PxRigidBodyFlag.eENABLE_SPECULATIVE_CCD,!1)}},o.setIsKinematic=function(t){t?this._pxActor.setRigidBodyFlag(this._physXPhysics._physX.PxRigidBodyFlag.eKINEMATIC,!0):this._pxActor.setRigidBodyFlag(this._physXPhysics._physX.PxRigidBodyFlag.eKINEMATIC,!1)},o.setConstraints=function(t){this._pxActor.setRigidDynamicLockFlags(t)},o.addForce=function(t){this._pxActor.addForce({x:t.x,y:t.y,z:t.z})},o.addTorque=function(t){this._pxActor.addTorque({x:t.x,y:t.y,z:t.z})},o.move=function(t,s){if(s){this._pxActor.setKinematicTarget(t,s);return}var o=n._tempTranslation,a=n._tempRotation;this.getWorldTransform(o,a),i(t,e.Vector3)?this._pxActor.setKinematicTarget(t,a):this._pxActor.setKinematicTarget(o,t)},o.sleep=function(){return this._pxActor.putToSleep()},o.wakeUp=function(){return this._pxActor.wakeUp()},n}(M);w._tempTranslation=new e.Vector3,w._tempRotation=new e.Quaternion;var F=function(){this._eventMap={}},b=function(){function t(t,e,i,n,s,o){this._physXPhysics=t;var a=t._pxPhysics.createMaterial(e,i,n);a.setFrictionCombineMode(s),a.setRestitutionCombineMode(o),this._pxMaterial=a}var e=t.prototype;return e.setBounciness=function(t){this._pxMaterial.setRestitution(t)},e.setDynamicFriction=function(t){this._pxMaterial.setDynamicFriction(t)},e.setStaticFriction=function(t){this._pxMaterial.setStaticFriction(t)},e.setBounceCombine=function(t){this._pxMaterial.setRestitutionCombineMode(t)},e.setFrictionCombine=function(t){this._pxMaterial.setFrictionCombineMode(t)},e.destroy=function(){this._pxMaterial.release()},t}();(h=y||(y={}))[h.Average=0]="Average",h[h.Minimum=1]="Minimum",h[h.Multiply=2]="Multiply",h[h.Maximum=3]="Maximum";var R=function(){function t(t,e,i,n,s,o,a,r){var h=this;this._pxControllerManager=null,this._currentEvents=new S,this._eventPool=[],this._physXPhysics=t,this._physXManager=e;var l=t._physX;this._pxRaycastHit=new l.PxRaycastHit,this._pxFilterData=new l.PxQueryFilterData,this._pxFilterData.flags=new l.PxQueryFlags(7),this._onContactEnter=i,this._onContactExit=n,this._onContactStay=s,this._onTriggerEnter=o,this._onTriggerExit=a,this._onTriggerStay=r;var c=t._pxPhysics,_=l.PxSimulationEventCallback.implement({onContactBegin:function(t,e){h._onContactEnter(t,e)},onContactEnd:function(t,e){h._onContactExit(t,e)},onContactPersist:function(t,e){h._onContactStay(t,e)},onTriggerBegin:function(t,e){var i=t<e?h._getTrigger(t,e):h._getTrigger(e,t);i.state=0,h._currentEvents.add(i)},onTriggerEnd:function(t,e){var i;if(t<e){var n=h._physXManager._eventMap[t];i=n[e],n[e]=void 0}else{var s=h._physXManager._eventMap[e];i=s[t],s[t]=void 0}i.state=2}}),u=l.getDefaultSceneDesc(c.getTolerancesScale(),0,_);this._pxScene=c.createScene(u)}var e=t.prototype;return e.setGravity=function(t){this._pxScene.setGravity(t)},e.addColliderShape=function(t){this._physXManager._eventMap[t._id]={}},e.removeColliderShape=function(t){for(var e=this._eventPool,i=this._currentEvents,n=t._id,s=this._physXManager._eventMap,o=i.length-1;o>=0;o--){var a=i.get(o);a.index1==n?(i.deleteByIndex(o),e.push(a)):a.index2==n&&(i.deleteByIndex(o),e.push(a),s[a.index1][n]=void 0)}delete s[n]},e.addCollider=function(t){this._pxScene.addActor(t._pxActor,null)},e.removeCollider=function(t){this._pxScene.removeActor(t._pxActor,!0)},e.addCharacterController=function(t){if(!t._pxController){var e=t._shape;if(e){var i=t._pxManager;i!==this&&(i&&t._destroyPXController(),t._createPXController(this,e))}}t._pxManager=this},e.removeCharacterController=function(t){t._pxManager=null},e.update=function(t){this._simulate(t),this._fetchResults(),this._fireEvent()},e.raycast=function(e,i,n,s){var o=this._pxRaycastHit;i=Math.min(i,34e37);var a=this._pxScene.raycastSingle(e.origin,e.direction,i,o,this._pxFilterData,this._physXPhysics._physX.PxQueryFilterCallback.implement({preFilter:function(t,e,i){return n(e)?2:0},postFilter:function(t,e){}}));if(a&&void 0!=s){var r=t._tempPosition,h=t._tempNormal,l=o.position,c=o.normal;r.set(l.x,l.y,l.z),h.set(c.x,c.y,c.z),s(o.getShape().getUUID(),o.distance,r,h)}return a},e._getControllerManager=function(){var t=this._pxControllerManager;return null===t&&(this._pxControllerManager=t=this._pxScene.createControllerManager()),t},e._simulate=function(t){this._pxScene.simulate(t,!0)},e._fetchResults=function(t){void 0===t&&(t=!0),this._pxScene.fetchResults(t)},e._getTrigger=function(t,e){var i;return this._eventPool.length?((i=this._eventPool.pop()).index1=t,i.index2=e):i=new X(t,e),this._physXManager._eventMap[t][e]=i,i},e._fireEvent=function(){for(var t=this._eventPool,e=this._currentEvents,i=e.length-1;i>=0;i--){var n=e.get(i);0==n.state?(this._onTriggerEnter(n.index1,n.index2),n.state=1):1==n.state?this._onTriggerStay(n.index1,n.index2):2==n.state&&(this._onTriggerExit(n.index1,n.index2),e.deleteByIndex(i),t.push(n))}},t}();R._tempPosition=new e.Vector3,R._tempNormal=new e.Vector3,(l=d||(d={}))[l.STATIC=1]="STATIC",l[l.DYNAMIC=2]="DYNAMIC",l[l.PRE_FILTER=4]="PRE_FILTER",l[l.POST_FILTER=8]="POST_FILTER",l[l.ANY_HIT=16]="ANY_HIT",l[l.NO_BLOCK=32]="NO_BLOCK",(c=g||(g={}))[c.Enter=0]="Enter",c[c.Stay=1]="Stay",c[c.Exit=2]="Exit";var X=function(t,e){this.index1=t,this.index2=e},E=function(t){function e(e,i,n){var s;return(s=t.call(this,e)||this)._pxActor=e._pxPhysics.createRigidStatic(s._transform(i,n)),s}return s(e,t),e}(M);t.PhysXRuntimeMode=void 0,(_=t.PhysXRuntimeMode||(t.PhysXRuntimeMode={}))[_.Auto=0]="Auto",_[_.WebAssembly=1]="WebAssembly",_[_.JavaScript=2]="JavaScript";var T=function(){function t(t){this._connectedAnchor=new e.Vector3,this._breakForce=Number.MAX_VALUE,this._breakTorque=Number.MAX_VALUE,this._physXPhysics=t}var i=t.prototype;return i.setConnectedCollider=function(t){var e;this._pxJoint.setActors((null==t?void 0:t._pxActor)||null,(null==(e=this._collider)?void 0:e._pxActor)||null)},i.setConnectedAnchor=function(e){this._connectedAnchor.copyFrom(e),this._setLocalPose(0,e,t._defaultQuat)},i.setConnectedMassScale=function(t){this._pxJoint.setInvMassScale0(1/t)},i.setConnectedInertiaScale=function(t){this._pxJoint.setInvInertiaScale0(1/t)},i.setMassScale=function(t){this._pxJoint.setInvMassScale1(1/t)},i.setInertiaScale=function(t){this._pxJoint.setInvInertiaScale1(1/t)},i.setBreakForce=function(t){this._breakForce=t,this._pxJoint.setBreakForce(this._breakForce,this._breakTorque)},i.setBreakTorque=function(t){this._breakTorque=t,this._pxJoint.setBreakForce(this._breakForce,this._breakTorque)},i._setLocalPose=function(t,e,i){this._pxJoint.setLocalPose(t,e,i)},t}();T._xAxis=new e.Vector3(1,0,0),T._defaultVec=new e.Vector3,T._defaultQuat=new e.Quaternion;var z=function(t){function e(e,i){var n;return(n=t.call(this,e)||this)._collider=i,n._pxJoint=e._pxPhysics.createFixedJoint(null,T._defaultVec,T._defaultQuat,i._pxActor,T._defaultVec,T._defaultQuat),n}return s(e,t),e}(T),I=function(t){function i(i,n){var s;return(s=t.call(this,i)||this)._axisRotationQuaternion=new e.Quaternion,s._swingOffset=new e.Vector3,s._collider=n,s._pxJoint=i._pxPhysics.createRevoluteJoint(null,T._defaultVec,T._defaultQuat,n._pxActor,T._defaultVec,T._defaultQuat),s}s(i,t);var n=i.prototype;return n.setAxis=function(t){var i=T._xAxis,n=this._axisRotationQuaternion;i.set(1,0,0),t.normalize();var s=Math.acos(e.Vector3.dot(i,t));e.Vector3.cross(i,t,i),e.Quaternion.rotationAxisAngle(i,s,n),this._setLocalPose(0,this._swingOffset,n)},n.setSwingOffset=function(t){this._swingOffset.copyFrom(t),this._setLocalPose(1,this._swingOffset,this._axisRotationQuaternion)},n.getAngle=function(){return this._pxJoint.getAngle()},n.getVelocity=function(){return this._pxJoint.getVelocity()},n.setHardLimit=function(t,e,i){this._pxJoint.setHardLimit(t,e,i)},n.setSoftLimit=function(t,e,i,n){this._pxJoint.setSoftLimit(t,e,i,n)},n.setDriveVelocity=function(t,e){void 0===e&&(e=!0),this._pxJoint.setDriveVelocity(t,e)},n.setDriveForceLimit=function(t){this._pxJoint.setDriveForceLimit(t)},n.setDriveGearRatio=function(t){this._pxJoint.setDriveGearRatio(t)},n.setHingeJointFlag=function(t,e){this._pxJoint.setRevoluteJointFlag(t,e)},i}(T),D=function(t){function i(i,n){var s;return(s=t.call(this,i)||this)._swingOffset=new e.Vector3,s._collider=n,s._pxJoint=i._pxPhysics.createDistanceJoint(null,T._defaultVec,T._defaultQuat,n._pxActor,T._defaultVec,T._defaultQuat),s._pxJoint.setDistanceJointFlag(2,!0),s._pxJoint.setDistanceJointFlag(4,!0),s._pxJoint.setDistanceJointFlag(8,!0),s}s(i,t);var n=i.prototype;return n.setSwingOffset=function(t){this._swingOffset.copyFrom(t),this._setLocalPose(1,t,T._defaultQuat)},n.setMinDistance=function(t){this._pxJoint.setMinDistance(t)},n.setMaxDistance=function(t){this._pxJoint.setMaxDistance(t)},n.setTolerance=function(t){this._pxJoint.setTolerance(t)},n.setStiffness=function(t){this._pxJoint.setStiffness(t)},n.setDamping=function(t){this._pxJoint.setDamping(t)},i}(T),V=function(t){function i(i,n,s){var o;return(o=t.call(this,i)||this)._axis=new e.Quaternion(0,0,v.halfSqrt,v.halfSqrt),o._physXRotation.copyFrom(o._axis),o._pxGeometry=new i._physX.PxPlaneGeometry,o._initialize(s,n),o._setLocalPose(),o}return s(i,t),i}(v),G=function(t){function e(e,i,n,s){var o;return(o=t.call(this,e)||this)._maxScale=1,o._radius=n,o._pxGeometry=new e._physX.PxSphereGeometry(o._radius*o._maxScale),o._initialize(s,i),o._setLocalPose(),o}s(e,t);var i=e.prototype;return i.setRadius=function(t){this._radius=t,this._pxGeometry.radius=t*this._maxScale,this._pxShape.setGeometry(this._pxGeometry)},i.setWorldScale=function(e){t.prototype.setWorldScale.call(this,e),this._maxScale=Math.max(Math.abs(e.x),Math.abs(e.y),Math.abs(e.z)),this._pxGeometry.radius=this._radius*this._maxScale,this._pxShape.setGeometry(this._pxGeometry)},e}(v),L=function(){function e(e){void 0===e&&(e=t.PhysXRuntimeMode.Auto),this._initializeState=0,this._runTimeMode=e}var n=e.prototype;return n.initialize=function(){var e=this;if(2===this._initializeState)return Promise.resolve();if(1===this._initializeState)return this._initializePromise;var n=this._runTimeMode,s=new Promise(function(e,s){var o=document.createElement("script");document.body.appendChild(o),o.async=!0,o.onload=e,o.onerror=s,n==t.PhysXRuntimeMode.Auto&&(n=!function(){try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){var t=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(i(t,WebAssembly.Module))return i(new WebAssembly.Instance(t),WebAssembly.Instance)}}catch(t){}return!1}()?t.PhysXRuntimeMode.JavaScript:t.PhysXRuntimeMode.WebAssembly),n==t.PhysXRuntimeMode.JavaScript?o.src="https://mdn.alipayobjects.com/rms/afts/file/A*rnDeR58NNGoAAAAAAAAAAAAAARQnAQ/physx.release.js.js":n==t.PhysXRuntimeMode.WebAssembly&&(o.src="https://mdn.alipayobjects.com/rms/afts/file/A*nA97QLQehRMAAAAAAAAAAAAAARQnAQ/physx.release.js")}),o=new Promise(function(t,i){s.then(function(){return window.PHYSX().then(function(i){e._init(i),e._initializeState=2,e._initializePromise=null,console.log("PhysX loaded."),t()},i)},i).catch(i)});return this._initializePromise=o,o},n.destroy=function(){this._physX.PxCloseExtensions(),this._pxPhysics.release(),this._pxFoundation.release(),this._physX=null,this._pxFoundation=null,this._pxPhysics=null},n.createPhysicsManager=function(){return new F},n.createPhysicsScene=function(t,e,i,n,s,o,a){return new R(this,t,e,i,n,s,o,a)},n.createStaticCollider=function(t,e){return new E(this,t,e)},n.createDynamicCollider=function(t,e){return new w(this,t,e)},n.createCharacterController=function(){return new C(this)},n.createPhysicsMaterial=function(t,e,i,n,s){return new b(this,t,e,i,n,s)},n.createBoxColliderShape=function(t,e,i){return new P(this,t,e,i)},n.createSphereColliderShape=function(t,e,i){return new G(this,t,e,i)},n.createPlaneColliderShape=function(t,e){return new V(this,t,e)},n.createCapsuleColliderShape=function(t,e,i,n){return new A(this,t,e,i,n)},n.createFixedJoint=function(t){return new z(this,t)},n.createHingeJoint=function(t){return new I(this,t)},n.createSpringJoint=function(t){return new D(this,t)},n._init=function(t){var e=t.PX_PHYSICS_VERSION,i=new t.PxDefaultErrorCallback,n=new t.PxDefaultAllocator,s=t.PxCreateFoundation(e,n,i),o=t.PxCreatePhysics(e,s,new t.PxTolerancesScale,!1,null);t.PxInitExtensions(o,null),this._physX=t,this._pxFoundation=s,this._pxPhysics=o},e}();(u=m||(m={}))[u.Uninitialized=0]="Uninitialized",u[u.Initializing=1]="Initializing",u[u.Initialized=2]="Initialized";var H="1.2.0-beta.3";console.log("Galacean PhysX version: "+H),t.PhysXPhysics=L,t.version=H,Object.defineProperty(t,"__esModule",{value:!0})});
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@galacean/engine")):"function"==typeof define&&define.amd?define(["exports","@galacean/engine"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).Galacean=t.Galacean||{},t.Galacean.PhysicsPhysX={}),t.Galacean)}(this,function(t,e){"use strict";function i(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):t instanceof e}function n(t,e){return(n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function s(t,e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&n(t,e)}var o,a,r,h,l,c,_,u,p,f,x,y,d,g,m,S=function(){function t(t){void 0===t&&(t=0),this.length=0,this._elements=Array(t)}var e=t.prototype;return e.add=function(t){this.length===this._elements.length?this._elements.push(t):this._elements[this.length]=t,this.length++},e.delete=function(t){var e=this._elements.indexOf(t);this.deleteByIndex(e)},e.get=function(t){if(t>=this.length)throw"Index is out of range.";return this._elements[t]},e.deleteByIndex=function(t){var e=this._elements,i=null,n=this.length-1;return t!==n&&(i=e[n],e[t]=i),this.length--,i},e.garbageCollection=function(){this._elements.length=this.length},t}();(o=p||(p={}))[o.SIMULATION_SHAPE=1]="SIMULATION_SHAPE",o[o.SCENE_QUERY_SHAPE=2]="SCENE_QUERY_SHAPE",o[o.TRIGGER_SHAPE=4]="TRIGGER_SHAPE";var v=function(){function t(t){this._controllers=new S,this._worldScale=new e.Vector3(1,1,1),this._position=new e.Vector3,this._rotation=null,this._axis=null,this._physXRotation=new e.Quaternion,this._shapeFlags=3,this._physXPhysics=t}var i=t.prototype;return i.setRotation=function(t){this._rotation=t,e.Quaternion.rotationYawPitchRoll(t.x,t.y,t.z,this._physXRotation),this._axis&&e.Quaternion.multiply(this._physXRotation,this._axis,this._physXRotation),this._physXRotation.normalize(),this._setLocalPose()},i.setPosition=function(t){t!==this._position&&this._position.copyFrom(t);for(var e=this._controllers,i=0,n=e.length;i<n;i++)e.get(i)._updateShapePosition(this._position,this._worldScale);this._setLocalPose()},i.setWorldScale=function(t){this._worldScale.copyFrom(t),this._setLocalPose();for(var e=this._controllers,i=0,n=e.length;i<n;i++)e.get(i)._updateShapePosition(this._position,this._worldScale)},i.setContactOffset=function(t){this._pxShape.setContactOffset(t);for(var e=this._controllers,i=0,n=e.length;i<n;i++)e.get(i)._pxController.setContactOffset(t)},i.setMaterial=function(t){this._pxMaterial=t._pxMaterial,this._pxShape.setMaterial(this._pxMaterial)},i.setIsTrigger=function(t){this._modifyFlag(1,!t),this._modifyFlag(4,t),this._setShapeFlags(this._shapeFlags)},i.destroy=function(){this._pxShape.release()},i._setShapeFlags=function(t){this._shapeFlags=t,this._pxShape.setFlags(new this._physXPhysics._physX.PxShapeFlags(this._shapeFlags))},i._setLocalPose=function(){var i=t.transform;e.Vector3.multiply(this._position,this._worldScale,i.translation),i.rotation=this._physXRotation,this._pxShape.setLocalPose(i)},i._initialize=function(t,e){this._id=e,this._pxMaterial=t._pxMaterial,this._pxShape=this._physXPhysics._pxPhysics.createShape(this._pxGeometry,t._pxMaterial,!0,new this._physXPhysics._physX.PxShapeFlags(this._shapeFlags)),this._pxShape.setUUID(e)},i._modifyFlag=function(t,e){this._shapeFlags=e?this._shapeFlags|t:this._shapeFlags&~t},t}();v.halfSqrt=.70710678118655,v.transform={translation:new e.Vector3,rotation:null};var P=function(t){function i(i,n,s,o){(a=t.call(this,i)||this)._halfSize=new e.Vector3,a._sizeScale=new e.Vector3(1,1,1);var a,r=a._halfSize;return r.set(.5*s.x,.5*s.y,.5*s.z),a._pxGeometry=new i._physX.PxBoxGeometry(r.x,r.y,r.z),a._initialize(o,n),a._setLocalPose(),a}s(i,t);var n=i.prototype;return n.setSize=function(t){var n=this._halfSize,s=i._tempHalfExtents;n.set(.5*t.x,.5*t.y,.5*t.z),e.Vector3.multiply(n,this._sizeScale,s),this._pxGeometry.halfExtents=s,this._pxShape.setGeometry(this._pxGeometry),this._updateController(s)},n.setWorldScale=function(n){t.prototype.setWorldScale.call(this,n),this._sizeScale.set(Math.abs(n.x),Math.abs(n.y),Math.abs(n.z));var s=i._tempHalfExtents;e.Vector3.multiply(this._halfSize,this._sizeScale,s),this._pxGeometry.halfExtents=s,this._pxShape.setGeometry(this._pxGeometry),this._updateController(s)},n._updateController=function(t){for(var e=this._controllers,i=0,n=e.length;i<n;i++){var s=e.get(i)._pxController;s.setHalfHeight(t.x),s.setHalfSideExtent(t.y),s.setHalfForwardExtent(t.z)}},i}(v);P._tempHalfExtents=new e.Vector3;var A=function(t){function i(i,n,s,o,a){var r;return(r=t.call(this,i)||this)._upAxis=1,r._sizeScale=new e.Vector3(1,1,1),r._radius=s,r._halfHeight=.5*o,r._axis=new e.Quaternion(0,0,v.halfSqrt,v.halfSqrt),r._physXRotation.copyFrom(r._axis),r._pxGeometry=new i._physX.PxCapsuleGeometry(r._radius,r._halfHeight),r._initialize(a,n),r._setLocalPose(),r}s(i,t);var n=i.prototype;return n.setRadius=function(t){this._radius=t;var e=this._sizeScale;switch(this._upAxis){case 0:this._pxGeometry.radius=this._radius*Math.max(e.y,e.z);break;case 1:this._pxGeometry.radius=this._radius*Math.max(e.x,e.z);break;case 2:this._pxGeometry.radius=this._radius*Math.max(e.x,e.y)}this._pxShape.setGeometry(this._pxGeometry);for(var i=this._pxGeometry.radius,n=this._controllers,s=0,o=n.length;s<o;s++)n.get(s)._pxController.setRadius(i)},n.setHeight=function(t){this._halfHeight=.5*t;var e=this._sizeScale;switch(this._upAxis){case 0:this._pxGeometry.halfHeight=this._halfHeight*e.x;break;case 1:this._pxGeometry.halfHeight=this._halfHeight*e.y;break;case 2:this._pxGeometry.halfHeight=this._halfHeight*e.z}this._pxShape.setGeometry(this._pxGeometry);for(var i=2*this._pxGeometry.halfHeight,n=this._controllers,s=0,o=n.length;s<o;s++)n.get(s)._pxController.setHeight(i)},n.setUpAxis=function(t){var i=this._rotation,n=this._axis,s=this._physXRotation;switch(this._upAxis=t,this._upAxis){case 0:n.set(0,0,0,1);break;case 1:n.set(0,0,v.halfSqrt,v.halfSqrt);break;case 2:n.set(0,v.halfSqrt,0,v.halfSqrt)}i?(e.Quaternion.rotationYawPitchRoll(i.x,i.y,i.z,s),e.Quaternion.multiply(s,n,s)):s.copyFrom(n),this._setLocalPose()},n.setWorldScale=function(e){t.prototype.setWorldScale.call(this,e);var i=this._sizeScale.set(Math.abs(e.x),Math.abs(e.y),Math.abs(e.z)),n=this._pxGeometry;switch(this._upAxis){case 0:n.radius=this._radius*Math.max(i.y,i.z),n.halfHeight=this._halfHeight*i.x;break;case 1:n.radius=this._radius*Math.max(i.x,i.z),n.halfHeight=this._halfHeight*i.y;break;case 2:n.radius=this._radius*Math.max(i.x,i.y),n.halfHeight=this._halfHeight*i.z}this._pxShape.setGeometry(n);for(var s=n.radius,o=2*n.halfHeight,a=this._controllers,r=0,h=a.length;r<h;r++){var l=a.get(r)._pxController;l.setRadius(s),l.setHeight(o)}},i}(v);(a=f||(f={}))[a.X=0]="X",a[a.Y=1]="Y",a[a.Z=2]="Z";var C=function(){function t(t){this._shapeScaledPosition=new e.Vector3,this._worldPosition=null,this._physXPhysics=t}var n=t.prototype;return n.move=function(t,e,i){var n,s;return null!=(s=null==(n=this._pxController)?void 0:n.move(t,e,i))?s:0},n.setWorldPosition=function(t){this._worldPosition=t,this._updateNativePosition()},n.getWorldPosition=function(t){this._pxController&&(t.copyFrom(this._pxController.getPosition()),t.subtract(this._shapeScaledPosition))},n.setStepOffset=function(t){var e;null==(e=this._pxController)||e.setStepOffset(t)},n.setNonWalkableMode=function(t){var e;null==(e=this._pxController)||e.setNonWalkableMode(t)},n.setUpDirection=function(t){var e;null==(e=this._pxController)||e.setUpDirection(t)},n.setSlopeLimit=function(t){var e;null==(e=this._pxController)||e.setSlopeLimit(t)},n.addShape=function(t){this._pxManager&&this._createPXController(this._pxManager,t),this._shape=t,t._controllers.add(this)},n.removeShape=function(t){this._destroyPXController(),this._shape=null,t._controllers.delete(this)},n.destroy=function(){this._destroyPXController()},n._createPXController=function(t,e){var n;if(i(e,P))(n=new this._physXPhysics._physX.PxBoxControllerDesc).halfHeight=e._halfSize.x,n.halfSideExtent=e._halfSize.y,n.halfForwardExtent=e._halfSize.z;else if(i(e,A))(n=new this._physXPhysics._physX.PxCapsuleControllerDesc).radius=e._radius,n.height=2*e._halfHeight,n.climbingMode=1;else throw"unsupported shape type";n.setMaterial(e._pxMaterial),this._pxController=t._getControllerManager().createController(n),this._pxController.setUUID(e._id)},n._destroyPXController=function(){this._pxController&&(this._pxController.release(),this._pxController=null)},n._updateShapePosition=function(t,i){e.Vector3.multiply(t,i,this._shapeScaledPosition),this._updateNativePosition()},n._updateNativePosition=function(){var i=this._worldPosition;this._pxController&&i&&(e.Vector3.add(i,this._shapeScaledPosition,t._tempVec),this._pxController.setPosition(t._tempVec))},t}();C._tempVec=new e.Vector3;var M=function(){function t(t){this._physXPhysics=t}var e=t.prototype;return e.addShape=function(t){this._pxActor.attachShape(t._pxShape)},e.removeShape=function(t){this._pxActor.detachShape(t._pxShape,!0)},e.setWorldTransform=function(t,e){this._pxActor.setGlobalPose(this._transform(t,e),!0)},e.getWorldTransform=function(t,e){var i=this._pxActor.getGlobalPose();t.set(i.translation.x,i.translation.y,i.translation.z),e.set(i.rotation.x,i.rotation.y,i.rotation.z,i.rotation.w)},e.destroy=function(){this._pxActor.release()},e._transform=function(e,i){var n=t._tempTransform;return n.translation=e,n.rotation=i.normalize(),n},t}();M._tempTransform={translation:null,rotation:null},(r=x||(x={}))[r.Discrete=0]="Discrete",r[r.Continuous=1]="Continuous",r[r.ContinuousDynamic=2]="ContinuousDynamic",r[r.ContinuousSpeculative=3]="ContinuousSpeculative";var w=function(t){function n(e,i,n){var s,o=(s=t.call(this,e)||this)._transform(i,n);return s._pxActor=e._pxPhysics.createRigidDynamic(o),s}s(n,t);var o=n.prototype;return o.setLinearDamping=function(t){this._pxActor.setLinearDamping(t)},o.setAngularDamping=function(t){this._pxActor.setAngularDamping(t)},o.setLinearVelocity=function(t){this._pxActor.setLinearVelocity(t,!0)},o.setAngularVelocity=function(t){this._pxActor.setAngularVelocity(t,!0)},o.setMass=function(t){this._pxActor.setMass(t)},o.setCenterOfMass=function(t){this._pxActor.setCMassLocalPose(t)},o.setInertiaTensor=function(t){this._pxActor.setMassSpaceInertiaTensor(t)},o.setMaxAngularVelocity=function(t){this._pxActor.setMaxAngularVelocity(t)},o.setMaxDepenetrationVelocity=function(t){this._pxActor.setMaxDepenetrationVelocity(t)},o.setSleepThreshold=function(t){this._pxActor.setSleepThreshold(t)},o.setSolverIterations=function(t){this._pxActor.setSolverIterationCounts(t,1)},o.setCollisionDetectionMode=function(t){switch(t){case 1:this._pxActor.setRigidBodyFlag(this._physXPhysics._physX.PxRigidBodyFlag.eENABLE_CCD,!0);break;case 2:this._pxActor.setRigidBodyFlag(this._physXPhysics._physX.PxRigidBodyFlag.eENABLE_CCD_FRICTION,!0);break;case 3:this._pxActor.setRigidBodyFlag(this._physXPhysics._physX.PxRigidBodyFlag.eENABLE_SPECULATIVE_CCD,!0);break;case 0:var e=this._physXPhysics._physX;this._pxActor.setRigidBodyFlag(e.PxRigidBodyFlag.eENABLE_CCD,!1),this._pxActor.setRigidBodyFlag(e.PxRigidBodyFlag.eENABLE_CCD_FRICTION,!1),this._pxActor.setRigidBodyFlag(e.PxRigidBodyFlag.eENABLE_SPECULATIVE_CCD,!1)}},o.setIsKinematic=function(t){t?this._pxActor.setRigidBodyFlag(this._physXPhysics._physX.PxRigidBodyFlag.eKINEMATIC,!0):this._pxActor.setRigidBodyFlag(this._physXPhysics._physX.PxRigidBodyFlag.eKINEMATIC,!1)},o.setConstraints=function(t){this._pxActor.setRigidDynamicLockFlags(t)},o.addForce=function(t){this._pxActor.addForce({x:t.x,y:t.y,z:t.z})},o.addTorque=function(t){this._pxActor.addTorque({x:t.x,y:t.y,z:t.z})},o.move=function(t,s){if(s){this._pxActor.setKinematicTarget(t,s);return}var o=n._tempTranslation,a=n._tempRotation;this.getWorldTransform(o,a),i(t,e.Vector3)?this._pxActor.setKinematicTarget(t,a):this._pxActor.setKinematicTarget(o,t)},o.sleep=function(){return this._pxActor.putToSleep()},o.wakeUp=function(){return this._pxActor.wakeUp()},n}(M);w._tempTranslation=new e.Vector3,w._tempRotation=new e.Quaternion;var F=function(){this._eventMap={}},b=function(){function t(t,e,i,n,s,o){this._physXPhysics=t;var a=t._pxPhysics.createMaterial(e,i,n);a.setFrictionCombineMode(s),a.setRestitutionCombineMode(o),this._pxMaterial=a}var e=t.prototype;return e.setBounciness=function(t){this._pxMaterial.setRestitution(t)},e.setDynamicFriction=function(t){this._pxMaterial.setDynamicFriction(t)},e.setStaticFriction=function(t){this._pxMaterial.setStaticFriction(t)},e.setBounceCombine=function(t){this._pxMaterial.setRestitutionCombineMode(t)},e.setFrictionCombine=function(t){this._pxMaterial.setFrictionCombineMode(t)},e.destroy=function(){this._pxMaterial.release()},t}();(h=y||(y={}))[h.Average=0]="Average",h[h.Minimum=1]="Minimum",h[h.Multiply=2]="Multiply",h[h.Maximum=3]="Maximum";var R=function(){function t(t,e,i,n,s,o,a,r){var h=this;this._pxControllerManager=null,this._currentEvents=new S,this._eventPool=[],this._physXPhysics=t,this._physXManager=e;var l=t._physX;this._pxRaycastHit=new l.PxRaycastHit,this._pxFilterData=new l.PxQueryFilterData,this._pxFilterData.flags=new l.PxQueryFlags(7),this._onContactEnter=i,this._onContactExit=n,this._onContactStay=s,this._onTriggerEnter=o,this._onTriggerExit=a,this._onTriggerStay=r;var c=t._pxPhysics,_=l.PxSimulationEventCallback.implement({onContactBegin:function(t,e){h._onContactEnter(t,e)},onContactEnd:function(t,e){h._onContactExit(t,e)},onContactPersist:function(t,e){h._onContactStay(t,e)},onTriggerBegin:function(t,e){var i=t<e?h._getTrigger(t,e):h._getTrigger(e,t);i.state=0,h._currentEvents.add(i)},onTriggerEnd:function(t,e){var i;if(t<e){var n=h._physXManager._eventMap[t];i=n[e],n[e]=void 0}else{var s=h._physXManager._eventMap[e];i=s[t],s[t]=void 0}i.state=2}}),u=l.getDefaultSceneDesc(c.getTolerancesScale(),0,_);this._pxScene=c.createScene(u)}var e=t.prototype;return e.setGravity=function(t){this._pxScene.setGravity(t)},e.addColliderShape=function(t){this._physXManager._eventMap[t._id]={}},e.removeColliderShape=function(t){for(var e=this._eventPool,i=this._currentEvents,n=t._id,s=this._physXManager._eventMap,o=i.length-1;o>=0;o--){var a=i.get(o);a.index1==n?(i.deleteByIndex(o),e.push(a)):a.index2==n&&(i.deleteByIndex(o),e.push(a),s[a.index1][n]=void 0)}delete s[n]},e.addCollider=function(t){this._pxScene.addActor(t._pxActor,null)},e.removeCollider=function(t){this._pxScene.removeActor(t._pxActor,!0)},e.addCharacterController=function(t){if(!t._pxController){var e=t._shape;if(e){var i=t._pxManager;i!==this&&(i&&t._destroyPXController(),t._createPXController(this,e))}}t._pxManager=this},e.removeCharacterController=function(t){t._pxManager=null},e.update=function(t){this._simulate(t),this._fetchResults(),this._fireEvent()},e.raycast=function(e,i,n,s){var o=this._pxRaycastHit;i=Math.min(i,34e37);var a=this._pxScene.raycastSingle(e.origin,e.direction,i,o,this._pxFilterData,this._physXPhysics._physX.PxQueryFilterCallback.implement({preFilter:function(t,e,i){return n(e)?2:0},postFilter:function(t,e){}}));if(a&&void 0!=s){var r=t._tempPosition,h=t._tempNormal,l=o.position,c=o.normal;r.set(l.x,l.y,l.z),h.set(c.x,c.y,c.z),s(o.getShape().getUUID(),o.distance,r,h)}return a},e._getControllerManager=function(){var t=this._pxControllerManager;return null===t&&(this._pxControllerManager=t=this._pxScene.createControllerManager()),t},e._simulate=function(t){this._pxScene.simulate(t,!0)},e._fetchResults=function(t){void 0===t&&(t=!0),this._pxScene.fetchResults(t)},e._getTrigger=function(t,e){var i;return this._eventPool.length?((i=this._eventPool.pop()).index1=t,i.index2=e):i=new X(t,e),this._physXManager._eventMap[t][e]=i,i},e._fireEvent=function(){for(var t=this._eventPool,e=this._currentEvents,i=e.length-1;i>=0;i--){var n=e.get(i);0==n.state?(this._onTriggerEnter(n.index1,n.index2),n.state=1):1==n.state?this._onTriggerStay(n.index1,n.index2):2==n.state&&(this._onTriggerExit(n.index1,n.index2),e.deleteByIndex(i),t.push(n))}},t}();R._tempPosition=new e.Vector3,R._tempNormal=new e.Vector3,(l=d||(d={}))[l.STATIC=1]="STATIC",l[l.DYNAMIC=2]="DYNAMIC",l[l.PRE_FILTER=4]="PRE_FILTER",l[l.POST_FILTER=8]="POST_FILTER",l[l.ANY_HIT=16]="ANY_HIT",l[l.NO_BLOCK=32]="NO_BLOCK",(c=g||(g={}))[c.Enter=0]="Enter",c[c.Stay=1]="Stay",c[c.Exit=2]="Exit";var X=function(t,e){this.index1=t,this.index2=e},E=function(t){function e(e,i,n){var s;return(s=t.call(this,e)||this)._pxActor=e._pxPhysics.createRigidStatic(s._transform(i,n)),s}return s(e,t),e}(M);t.PhysXRuntimeMode=void 0,(_=t.PhysXRuntimeMode||(t.PhysXRuntimeMode={}))[_.Auto=0]="Auto",_[_.WebAssembly=1]="WebAssembly",_[_.JavaScript=2]="JavaScript";var T=function(){function t(t){this._connectedAnchor=new e.Vector3,this._breakForce=Number.MAX_VALUE,this._breakTorque=Number.MAX_VALUE,this._physXPhysics=t}var i=t.prototype;return i.setConnectedCollider=function(t){var e;this._pxJoint.setActors((null==t?void 0:t._pxActor)||null,(null==(e=this._collider)?void 0:e._pxActor)||null)},i.setConnectedAnchor=function(e){this._connectedAnchor.copyFrom(e),this._setLocalPose(0,e,t._defaultQuat)},i.setConnectedMassScale=function(t){this._pxJoint.setInvMassScale0(1/t)},i.setConnectedInertiaScale=function(t){this._pxJoint.setInvInertiaScale0(1/t)},i.setMassScale=function(t){this._pxJoint.setInvMassScale1(1/t)},i.setInertiaScale=function(t){this._pxJoint.setInvInertiaScale1(1/t)},i.setBreakForce=function(t){this._breakForce=t,this._pxJoint.setBreakForce(this._breakForce,this._breakTorque)},i.setBreakTorque=function(t){this._breakTorque=t,this._pxJoint.setBreakForce(this._breakForce,this._breakTorque)},i._setLocalPose=function(t,e,i){this._pxJoint.setLocalPose(t,e,i)},t}();T._xAxis=new e.Vector3(1,0,0),T._defaultVec=new e.Vector3,T._defaultQuat=new e.Quaternion;var z=function(t){function e(e,i){var n;return(n=t.call(this,e)||this)._collider=i,n._pxJoint=e._pxPhysics.createFixedJoint(null,T._defaultVec,T._defaultQuat,i._pxActor,T._defaultVec,T._defaultQuat),n}return s(e,t),e}(T),I=function(t){function i(i,n){var s;return(s=t.call(this,i)||this)._axisRotationQuaternion=new e.Quaternion,s._swingOffset=new e.Vector3,s._collider=n,s._pxJoint=i._pxPhysics.createRevoluteJoint(null,T._defaultVec,T._defaultQuat,n._pxActor,T._defaultVec,T._defaultQuat),s}s(i,t);var n=i.prototype;return n.setAxis=function(t){var i=T._xAxis,n=this._axisRotationQuaternion;i.set(1,0,0),t.normalize();var s=Math.acos(e.Vector3.dot(i,t));e.Vector3.cross(i,t,i),e.Quaternion.rotationAxisAngle(i,s,n),this._setLocalPose(0,this._swingOffset,n)},n.setSwingOffset=function(t){this._swingOffset.copyFrom(t),this._setLocalPose(1,this._swingOffset,this._axisRotationQuaternion)},n.getAngle=function(){return this._pxJoint.getAngle()},n.getVelocity=function(){return this._pxJoint.getVelocity()},n.setHardLimit=function(t,e,i){this._pxJoint.setHardLimit(t,e,i)},n.setSoftLimit=function(t,e,i,n){this._pxJoint.setSoftLimit(t,e,i,n)},n.setDriveVelocity=function(t,e){void 0===e&&(e=!0),this._pxJoint.setDriveVelocity(t,e)},n.setDriveForceLimit=function(t){this._pxJoint.setDriveForceLimit(t)},n.setDriveGearRatio=function(t){this._pxJoint.setDriveGearRatio(t)},n.setHingeJointFlag=function(t,e){this._pxJoint.setRevoluteJointFlag(t,e)},i}(T),D=function(t){function i(i,n){var s;return(s=t.call(this,i)||this)._swingOffset=new e.Vector3,s._collider=n,s._pxJoint=i._pxPhysics.createDistanceJoint(null,T._defaultVec,T._defaultQuat,n._pxActor,T._defaultVec,T._defaultQuat),s._pxJoint.setDistanceJointFlag(2,!0),s._pxJoint.setDistanceJointFlag(4,!0),s._pxJoint.setDistanceJointFlag(8,!0),s}s(i,t);var n=i.prototype;return n.setSwingOffset=function(t){this._swingOffset.copyFrom(t),this._setLocalPose(1,t,T._defaultQuat)},n.setMinDistance=function(t){this._pxJoint.setMinDistance(t)},n.setMaxDistance=function(t){this._pxJoint.setMaxDistance(t)},n.setTolerance=function(t){this._pxJoint.setTolerance(t)},n.setStiffness=function(t){this._pxJoint.setStiffness(t)},n.setDamping=function(t){this._pxJoint.setDamping(t)},i}(T),V=function(t){function i(i,n,s){var o;return(o=t.call(this,i)||this)._axis=new e.Quaternion(0,0,v.halfSqrt,v.halfSqrt),o._physXRotation.copyFrom(o._axis),o._pxGeometry=new i._physX.PxPlaneGeometry,o._initialize(s,n),o._setLocalPose(),o}return s(i,t),i}(v),G=function(t){function e(e,i,n,s){var o;return(o=t.call(this,e)||this)._maxScale=1,o._radius=n,o._pxGeometry=new e._physX.PxSphereGeometry(o._radius*o._maxScale),o._initialize(s,i),o._setLocalPose(),o}s(e,t);var i=e.prototype;return i.setRadius=function(t){this._radius=t,this._pxGeometry.radius=t*this._maxScale,this._pxShape.setGeometry(this._pxGeometry)},i.setWorldScale=function(e){t.prototype.setWorldScale.call(this,e),this._maxScale=Math.max(Math.abs(e.x),Math.abs(e.y),Math.abs(e.z)),this._pxGeometry.radius=this._radius*this._maxScale,this._pxShape.setGeometry(this._pxGeometry)},e}(v),L=function(){function e(e){void 0===e&&(e=t.PhysXRuntimeMode.Auto),this._initializeState=0,this._runTimeMode=e}var n=e.prototype;return n.initialize=function(){var e=this;if(2===this._initializeState)return Promise.resolve();if(1===this._initializeState)return this._initializePromise;var n=this._runTimeMode,s=new Promise(function(e,s){var o=document.createElement("script");document.body.appendChild(o),o.async=!0,o.onload=e,o.onerror=s,n==t.PhysXRuntimeMode.Auto&&(n=!function(){try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){var t=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(i(t,WebAssembly.Module))return i(new WebAssembly.Instance(t),WebAssembly.Instance)}}catch(t){}return!1}()?t.PhysXRuntimeMode.JavaScript:t.PhysXRuntimeMode.WebAssembly),n==t.PhysXRuntimeMode.JavaScript?o.src="https://mdn.alipayobjects.com/rms/afts/file/A*rnDeR58NNGoAAAAAAAAAAAAAARQnAQ/physx.release.js.js":n==t.PhysXRuntimeMode.WebAssembly&&(o.src="https://mdn.alipayobjects.com/rms/afts/file/A*nA97QLQehRMAAAAAAAAAAAAAARQnAQ/physx.release.js")}),o=new Promise(function(t,i){s.then(function(){return window.PHYSX().then(function(i){e._init(i),e._initializeState=2,e._initializePromise=null,console.log("PhysX loaded."),t()},i)},i).catch(i)});return this._initializePromise=o,o},n.destroy=function(){this._physX.PxCloseExtensions(),this._pxPhysics.release(),this._pxFoundation.release(),this._physX=null,this._pxFoundation=null,this._pxPhysics=null},n.createPhysicsManager=function(){return new F},n.createPhysicsScene=function(t,e,i,n,s,o,a){return new R(this,t,e,i,n,s,o,a)},n.createStaticCollider=function(t,e){return new E(this,t,e)},n.createDynamicCollider=function(t,e){return new w(this,t,e)},n.createCharacterController=function(){return new C(this)},n.createPhysicsMaterial=function(t,e,i,n,s){return new b(this,t,e,i,n,s)},n.createBoxColliderShape=function(t,e,i){return new P(this,t,e,i)},n.createSphereColliderShape=function(t,e,i){return new G(this,t,e,i)},n.createPlaneColliderShape=function(t,e){return new V(this,t,e)},n.createCapsuleColliderShape=function(t,e,i,n){return new A(this,t,e,i,n)},n.createFixedJoint=function(t){return new z(this,t)},n.createHingeJoint=function(t){return new I(this,t)},n.createSpringJoint=function(t){return new D(this,t)},n._init=function(t){var e=t.PX_PHYSICS_VERSION,i=new t.PxDefaultErrorCallback,n=new t.PxDefaultAllocator,s=t.PxCreateFoundation(e,n,i),o=t.PxCreatePhysics(e,s,new t.PxTolerancesScale,!1,null);t.PxInitExtensions(o,null),this._physX=t,this._pxFoundation=s,this._pxPhysics=o},e}();(u=m||(m={}))[u.Uninitialized=0]="Uninitialized",u[u.Initializing=1]="Initializing",u[u.Initialized=2]="Initialized";var H="1.2.0-beta.4";console.log("Galacean PhysX version: "+H),t.PhysXPhysics=L,t.version=H,Object.defineProperty(t,"__esModule",{value:!0})});
|
|
2
2
|
//# sourceMappingURL=browser.min.js.map
|
package/dist/browser.min.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.min.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"browser.min.js","sources":["../../../node_modules/.pnpm/@swc+helpers@0.5.1/node_modules/@swc/helpers/esm/_instanceof.js","../../../node_modules/.pnpm/@swc+helpers@0.5.1/node_modules/@swc/helpers/esm/_set_prototype_of.js","../../../node_modules/.pnpm/@swc+helpers@0.5.1/node_modules/@swc/helpers/esm/_inherits.js","../src/DisorderedArray.ts","../src/shape/PhysXColliderShape.ts","../src/shape/PhysXCapsuleColliderShape.ts","../src/PhysXDynamicCollider.ts","../src/PhysXPhysicsMaterial.ts","../src/PhysXPhysicsScene.ts","../src/enum/PhysXRuntimeMode.ts","../src/PhysXPhysics.ts","../src/shape/PhysXBoxColliderShape.ts","../src/PhysXCharacterController.ts","../src/PhysXCollider.ts","../src/PhysXPhysicsManager.ts","../src/PhysXStaticCollider.ts","../src/joint/PhysXJoint.ts","../src/joint/PhysXFixedJoint.ts","../src/joint/PhysXHingeJoint.ts","../src/joint/PhysXSpringJoint.ts","../src/shape/PhysXPlaneColliderShape.ts","../src/shape/PhysXSphereColliderShape.ts","../src/index.ts"],"sourcesContent":["export function _instanceof(left, right) {\n if (right != null && typeof Symbol !== \"undefined\" && right[Symbol.hasInstance]) {\n return !!right[Symbol.hasInstance](left);\n } else return left instanceof right;\n}\nexport { _instanceof as _ };\n","export function _set_prototype_of(o, p) {\n _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {\n o.__proto__ = p;\n\n return o;\n };\n\n return _set_prototype_of(o, p);\n}\nexport { _set_prototype_of as _ };\n","import { _set_prototype_of } from \"./_set_prototype_of.js\";\n\nexport function _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });\n\n if (superClass) _set_prototype_of(subClass, superClass);\n}\nexport { _inherits as _ };\n","/**\n * High-performance unordered array, delete uses exchange method to improve performance, internal capacity only increases.\n */\nexport class DisorderedArray<T> {\n _elements: T[];\n\n length: number = 0;\n\n constructor(count: number = 0) {\n this._elements = new Array<T>(count);\n }\n\n add(element: T): void {\n if (this.length === this._elements.length) this._elements.push(element);\n else this._elements[this.length] = element;\n this.length++;\n }\n\n delete(element: T): void {\n //TODO: It can be optimized for custom binary search and other algorithms, currently this._elements>=this.length wastes performance.\n const index = this._elements.indexOf(element);\n this.deleteByIndex(index);\n }\n\n get(index: number): T {\n if (index >= this.length) {\n throw \"Index is out of range.\";\n }\n return this._elements[index];\n }\n\n /**\n *\n * @param index\n * @returns The replaced item is used to reset its index.\n */\n deleteByIndex(index: number): T {\n var elements: T[] = this._elements;\n let end: T = null;\n const lastIndex = this.length - 1;\n if (index !== lastIndex) {\n end = elements[lastIndex];\n elements[index] = end;\n }\n this.length--;\n return end;\n }\n\n garbageCollection(): void {\n this._elements.length = this.length;\n }\n}\n","import { Quaternion, Vector3 } from \"@galacean/engine\";\nimport { IColliderShape } from \"@galacean/engine-design\";\nimport { DisorderedArray } from \"../DisorderedArray\";\nimport { PhysXCharacterController } from \"../PhysXCharacterController\";\nimport { PhysXPhysics } from \"../PhysXPhysics\";\nimport { PhysXPhysicsMaterial } from \"../PhysXPhysicsMaterial\";\n\n/**\n * Flags which affect the behavior of Shapes.\n */\nexport enum ShapeFlag {\n /** The shape will partake in collision in the physical simulation. */\n SIMULATION_SHAPE = 1 << 0,\n /** The shape will partake in scene queries (ray casts, overlap tests, sweeps, ...). */\n SCENE_QUERY_SHAPE = 1 << 1,\n /** The shape is a trigger which can send reports whenever other shapes enter/leave its volume. */\n TRIGGER_SHAPE = 1 << 2\n}\n\n/**\n * Abstract class for collider shapes.\n */\nexport abstract class PhysXColliderShape implements IColliderShape {\n static readonly halfSqrt: number = 0.70710678118655;\n static transform = {\n translation: new Vector3(),\n rotation: null\n };\n\n /** @internal */\n _controllers: DisorderedArray<PhysXCharacterController> = new DisorderedArray<PhysXCharacterController>();\n\n protected _physXPhysics: PhysXPhysics;\n protected _worldScale: Vector3 = new Vector3(1, 1, 1);\n protected _position: Vector3 = new Vector3();\n protected _rotation: Vector3 = null;\n protected _axis: Quaternion = null;\n protected _physXRotation: Quaternion = new Quaternion();\n\n private _shapeFlags: ShapeFlag = ShapeFlag.SCENE_QUERY_SHAPE | ShapeFlag.SIMULATION_SHAPE;\n\n /** @internal */\n _pxMaterial: any;\n /** @internal */\n _pxShape: any;\n /** @internal */\n _pxGeometry: any;\n /** @internal */\n _id: number;\n\n constructor(physXPhysics: PhysXPhysics) {\n this._physXPhysics = physXPhysics;\n }\n\n /**\n * {@inheritDoc IColliderShape.setRotation }\n */\n setRotation(value: Vector3): void {\n this._rotation = value;\n Quaternion.rotationYawPitchRoll(value.x, value.y, value.z, this._physXRotation);\n this._axis && Quaternion.multiply(this._physXRotation, this._axis, this._physXRotation);\n this._physXRotation.normalize();\n this._setLocalPose();\n }\n\n /**\n * {@inheritDoc IColliderShape.setPosition }\n */\n setPosition(value: Vector3): void {\n if (value !== this._position) {\n this._position.copyFrom(value);\n }\n const controllers = this._controllers;\n for (let i = 0, n = controllers.length; i < n; i++) {\n controllers.get(i)._updateShapePosition(this._position, this._worldScale);\n }\n\n this._setLocalPose();\n }\n\n /**\n * {@inheritDoc IColliderShape.setWorldScale }\n */\n setWorldScale(scale: Vector3): void {\n this._worldScale.copyFrom(scale);\n this._setLocalPose();\n\n const controllers = this._controllers;\n for (let i = 0, n = controllers.length; i < n; i++) {\n controllers.get(i)._updateShapePosition(this._position, this._worldScale);\n }\n }\n\n /**\n * {@inheritDoc IColliderShape.setContactOffset }\n * @default 0.02f * PxTolerancesScale::length\n */\n setContactOffset(offset: number): void {\n this._pxShape.setContactOffset(offset);\n\n const controllers = this._controllers;\n for (let i = 0, n = controllers.length; i < n; i++) {\n controllers.get(i)._pxController.setContactOffset(offset);\n }\n }\n\n /**\n * {@inheritDoc IColliderShape.setMaterial }\n */\n setMaterial(value: PhysXPhysicsMaterial): void {\n this._pxMaterial = value._pxMaterial;\n this._pxShape.setMaterial(this._pxMaterial);\n }\n\n /**\n * {@inheritDoc IColliderShape.setIsTrigger }\n */\n setIsTrigger(value: boolean): void {\n this._modifyFlag(ShapeFlag.SIMULATION_SHAPE, !value);\n this._modifyFlag(ShapeFlag.TRIGGER_SHAPE, value);\n this._setShapeFlags(this._shapeFlags);\n }\n\n /**\n * {@inheritDoc IColliderShape.destroy }\n */\n destroy(): void {\n this._pxShape.release();\n }\n\n /**\n * @internal\n */\n _setShapeFlags(flags: ShapeFlag) {\n this._shapeFlags = flags;\n this._pxShape.setFlags(new this._physXPhysics._physX.PxShapeFlags(this._shapeFlags));\n }\n\n protected _setLocalPose(): void {\n const transform = PhysXColliderShape.transform;\n Vector3.multiply(this._position, this._worldScale, transform.translation);\n transform.rotation = this._physXRotation;\n this._pxShape.setLocalPose(transform);\n }\n\n protected _initialize(material: PhysXPhysicsMaterial, id: number): void {\n this._id = id;\n this._pxMaterial = material._pxMaterial;\n this._pxShape = this._physXPhysics._pxPhysics.createShape(\n this._pxGeometry,\n material._pxMaterial,\n true,\n new this._physXPhysics._physX.PxShapeFlags(this._shapeFlags)\n );\n this._pxShape.setUUID(id);\n }\n\n private _modifyFlag(flag: ShapeFlag, value: boolean): void {\n this._shapeFlags = value ? this._shapeFlags | flag : this._shapeFlags & ~flag;\n }\n}\n","import { ICapsuleColliderShape } from \"@galacean/engine-design\";\nimport { Quaternion, Vector3 } from \"@galacean/engine\";\nimport { PhysXPhysics } from \"../PhysXPhysics\";\nimport { PhysXPhysicsMaterial } from \"../PhysXPhysicsMaterial\";\nimport { PhysXColliderShape } from \"./PhysXColliderShape\";\n\n/**\n * Capsule collider shape in PhysX.\n */\nexport class PhysXCapsuleColliderShape extends PhysXColliderShape implements ICapsuleColliderShape {\n /** @internal */\n _radius: number;\n /** @internal */\n _halfHeight: number;\n private _upAxis: ColliderShapeUpAxis = ColliderShapeUpAxis.Y;\n private _sizeScale: Vector3 = new Vector3(1, 1, 1);\n\n constructor(\n physXPhysics: PhysXPhysics,\n uniqueID: number,\n radius: number,\n height: number,\n material: PhysXPhysicsMaterial\n ) {\n super(physXPhysics);\n\n this._radius = radius;\n this._halfHeight = height * 0.5;\n this._axis = new Quaternion(0, 0, PhysXColliderShape.halfSqrt, PhysXColliderShape.halfSqrt);\n this._physXRotation.copyFrom(this._axis);\n\n this._pxGeometry = new physXPhysics._physX.PxCapsuleGeometry(this._radius, this._halfHeight);\n this._initialize(material, uniqueID);\n this._setLocalPose();\n }\n\n /**\n * {@inheritDoc ICapsuleColliderShape.setRadius }\n */\n setRadius(value: number): void {\n this._radius = value;\n const sizeScale = this._sizeScale;\n switch (this._upAxis) {\n case ColliderShapeUpAxis.X:\n this._pxGeometry.radius = this._radius * Math.max(sizeScale.y, sizeScale.z);\n break;\n case ColliderShapeUpAxis.Y:\n this._pxGeometry.radius = this._radius * Math.max(sizeScale.x, sizeScale.z);\n break;\n case ColliderShapeUpAxis.Z:\n this._pxGeometry.radius = this._radius * Math.max(sizeScale.x, sizeScale.y);\n break;\n }\n this._pxShape.setGeometry(this._pxGeometry);\n\n const radius = this._pxGeometry.radius;\n const controllers = this._controllers;\n for (let i = 0, n = controllers.length; i < n; i++) {\n controllers.get(i)._pxController.setRadius(radius);\n }\n }\n\n /**\n * {@inheritDoc ICapsuleColliderShape.setHeight }\n */\n setHeight(value: number): void {\n this._halfHeight = value * 0.5;\n const sizeScale = this._sizeScale;\n switch (this._upAxis) {\n case ColliderShapeUpAxis.X:\n this._pxGeometry.halfHeight = this._halfHeight * sizeScale.x;\n break;\n case ColliderShapeUpAxis.Y:\n this._pxGeometry.halfHeight = this._halfHeight * sizeScale.y;\n break;\n case ColliderShapeUpAxis.Z:\n this._pxGeometry.halfHeight = this._halfHeight * sizeScale.z;\n break;\n }\n this._pxShape.setGeometry(this._pxGeometry);\n\n const height = this._pxGeometry.halfHeight * 2;\n const controllers = this._controllers;\n for (let i = 0, n = controllers.length; i < n; i++) {\n controllers.get(i)._pxController.setHeight(height);\n }\n }\n\n /**\n * {@inheritDoc ICapsuleColliderShape.setUpAxis }\n */\n setUpAxis(upAxis: ColliderShapeUpAxis): void {\n const { _rotation: rotation, _axis: axis, _physXRotation: physXRotation } = this;\n\n this._upAxis = upAxis;\n switch (this._upAxis) {\n case ColliderShapeUpAxis.X:\n axis.set(0, 0, 0, 1);\n break;\n case ColliderShapeUpAxis.Y:\n axis.set(0, 0, PhysXColliderShape.halfSqrt, PhysXColliderShape.halfSqrt);\n break;\n case ColliderShapeUpAxis.Z:\n axis.set(0, PhysXColliderShape.halfSqrt, 0, PhysXColliderShape.halfSqrt);\n break;\n }\n if (rotation) {\n Quaternion.rotationYawPitchRoll(rotation.x, rotation.y, rotation.z, physXRotation);\n Quaternion.multiply(physXRotation, axis, physXRotation);\n } else {\n physXRotation.copyFrom(axis);\n }\n this._setLocalPose();\n }\n\n /**\n * {@inheritDoc IColliderShape.setWorldScale }\n */\n override setWorldScale(scale: Vector3): void {\n super.setWorldScale(scale);\n\n const sizeScale = this._sizeScale.set(Math.abs(scale.x), Math.abs(scale.y), Math.abs(scale.z));\n const geometry = this._pxGeometry;\n switch (this._upAxis) {\n case ColliderShapeUpAxis.X:\n geometry.radius = this._radius * Math.max(sizeScale.y, sizeScale.z);\n geometry.halfHeight = this._halfHeight * sizeScale.x;\n break;\n case ColliderShapeUpAxis.Y:\n geometry.radius = this._radius * Math.max(sizeScale.x, sizeScale.z);\n geometry.halfHeight = this._halfHeight * sizeScale.y;\n break;\n case ColliderShapeUpAxis.Z:\n geometry.radius = this._radius * Math.max(sizeScale.x, sizeScale.y);\n geometry.halfHeight = this._halfHeight * sizeScale.z;\n break;\n }\n this._pxShape.setGeometry(geometry);\n\n const radius = geometry.radius;\n const height = geometry.halfHeight * 2;\n const controllers = this._controllers;\n for (let i = 0, n = controllers.length; i < n; i++) {\n const pxController = controllers.get(i)._pxController;\n pxController.setRadius(radius);\n pxController.setHeight(height);\n }\n }\n}\n\n/**\n * The up axis of the collider shape.\n */\nenum ColliderShapeUpAxis {\n /** Up axis is X. */\n X,\n /** Up axis is Y. */\n Y,\n /** Up axis is Z. */\n Z\n}\n","import { IDynamicCollider } from \"@galacean/engine-design\";\nimport { Quaternion, Vector3 } from \"@galacean/engine\";\nimport { PhysXCollider } from \"./PhysXCollider\";\nimport { PhysXPhysics } from \"./PhysXPhysics\";\n\n/**\n * The collision detection mode constants used for PhysXDynamicCollider.collisionDetectionMode.\n * */\nexport enum CollisionDetectionMode {\n /** Continuous collision detection is off for this dynamic collider. */\n Discrete,\n /** Continuous collision detection is on for colliding with static mesh geometry. */\n Continuous,\n /** Continuous collision detection is on for colliding with static and dynamic geometry. */\n ContinuousDynamic,\n /** Speculative continuous collision detection is on for static and dynamic geometries */\n ContinuousSpeculative\n}\n\n/**\n * A dynamic collider can act with self-defined movement or physical force\n */\nexport class PhysXDynamicCollider extends PhysXCollider implements IDynamicCollider {\n private static _tempTranslation = new Vector3();\n private static _tempRotation = new Quaternion();\n\n constructor(physXPhysics: PhysXPhysics, position: Vector3, rotation: Quaternion) {\n super(physXPhysics);\n const transform = this._transform(position, rotation);\n this._pxActor = physXPhysics._pxPhysics.createRigidDynamic(transform);\n }\n\n /**\n * {@inheritDoc IDynamicCollider.setLinearDamping }\n */\n setLinearDamping(value: number): void {\n this._pxActor.setLinearDamping(value);\n }\n\n /**\n * {@inheritDoc IDynamicCollider.setAngularDamping }\n */\n setAngularDamping(value: number): void {\n this._pxActor.setAngularDamping(value);\n }\n\n /**\n * {@inheritDoc IDynamicCollider.setLinearVelocity }\n */\n setLinearVelocity(value: Vector3): void {\n this._pxActor.setLinearVelocity(value, true);\n }\n\n /**\n * {@inheritDoc IDynamicCollider.setAngularVelocity }\n */\n setAngularVelocity(value: Vector3): void {\n this._pxActor.setAngularVelocity(value, true);\n }\n\n /**\n * {@inheritDoc IDynamicCollider.setMass }\n */\n setMass(value: number): void {\n this._pxActor.setMass(value);\n }\n\n /**\n * {@inheritDoc IDynamicCollider.setCenterOfMass }\n */\n setCenterOfMass(position: Vector3): void {\n this._pxActor.setCMassLocalPose(position);\n }\n\n /**\n * {@inheritDoc IDynamicCollider.setInertiaTensor }\n */\n setInertiaTensor(value: Vector3): void {\n this._pxActor.setMassSpaceInertiaTensor(value);\n }\n\n /**\n * {@inheritDoc IDynamicCollider.setMaxAngularVelocity }\n */\n setMaxAngularVelocity(value: number): void {\n this._pxActor.setMaxAngularVelocity(value);\n }\n\n /**\n * {@inheritDoc IDynamicCollider.setMaxDepenetrationVelocity }\n */\n setMaxDepenetrationVelocity(value: number): void {\n this._pxActor.setMaxDepenetrationVelocity(value);\n }\n\n /**\n * {@inheritDoc IDynamicCollider.setSleepThreshold }\n * @default 1e-5f * PxTolerancesScale::speed * PxTolerancesScale::speed\n */\n setSleepThreshold(value: number): void {\n this._pxActor.setSleepThreshold(value);\n }\n\n /**\n * {@inheritDoc IDynamicCollider.setSolverIterations }\n */\n setSolverIterations(value: number): void {\n this._pxActor.setSolverIterationCounts(value, 1);\n }\n\n /**\n * {@inheritDoc IDynamicCollider.setCollisionDetectionMode }\n */\n setCollisionDetectionMode(value: number): void {\n switch (value) {\n case CollisionDetectionMode.Continuous:\n this._pxActor.setRigidBodyFlag(this._physXPhysics._physX.PxRigidBodyFlag.eENABLE_CCD, true);\n break;\n case CollisionDetectionMode.ContinuousDynamic:\n this._pxActor.setRigidBodyFlag(this._physXPhysics._physX.PxRigidBodyFlag.eENABLE_CCD_FRICTION, true);\n break;\n case CollisionDetectionMode.ContinuousSpeculative:\n this._pxActor.setRigidBodyFlag(this._physXPhysics._physX.PxRigidBodyFlag.eENABLE_SPECULATIVE_CCD, true);\n break;\n case CollisionDetectionMode.Discrete:\n const physX = this._physXPhysics._physX;\n this._pxActor.setRigidBodyFlag(physX.PxRigidBodyFlag.eENABLE_CCD, false);\n this._pxActor.setRigidBodyFlag(physX.PxRigidBodyFlag.eENABLE_CCD_FRICTION, false);\n this._pxActor.setRigidBodyFlag(physX.PxRigidBodyFlag.eENABLE_SPECULATIVE_CCD, false);\n break;\n }\n }\n\n /**\n * {@inheritDoc IDynamicCollider.setIsKinematic }\n */\n setIsKinematic(value: boolean): void {\n if (value) {\n this._pxActor.setRigidBodyFlag(this._physXPhysics._physX.PxRigidBodyFlag.eKINEMATIC, true);\n } else {\n this._pxActor.setRigidBodyFlag(this._physXPhysics._physX.PxRigidBodyFlag.eKINEMATIC, false);\n }\n }\n\n /**\n * {@inheritDoc IDynamicCollider.setConstraints }\n */\n setConstraints(flags: number): void {\n this._pxActor.setRigidDynamicLockFlags(flags);\n }\n\n /**\n * {@inheritDoc IDynamicCollider.addForce }\n */\n addForce(force: Vector3) {\n this._pxActor.addForce({ x: force.x, y: force.y, z: force.z });\n }\n\n /**\n * {@inheritDoc IDynamicCollider.addTorque }\n */\n addTorque(torque: Vector3) {\n this._pxActor.addTorque({ x: torque.x, y: torque.y, z: torque.z });\n }\n\n /**\n * {@inheritDoc IDynamicCollider.move }\n */\n move(positionOrRotation: Vector3 | Quaternion, rotation?: Quaternion): void {\n if (rotation) {\n this._pxActor.setKinematicTarget(positionOrRotation, rotation);\n return;\n }\n\n const tempTranslation = PhysXDynamicCollider._tempTranslation;\n const tempRotation = PhysXDynamicCollider._tempRotation;\n this.getWorldTransform(tempTranslation, tempRotation);\n if (positionOrRotation instanceof Vector3) {\n this._pxActor.setKinematicTarget(positionOrRotation, tempRotation);\n } else {\n this._pxActor.setKinematicTarget(tempTranslation, positionOrRotation);\n }\n }\n\n /**\n * {@inheritDoc IDynamicCollider.sleep }\n */\n sleep(): void {\n return this._pxActor.putToSleep();\n }\n\n /**\n * {@inheritDoc IDynamicCollider.wakeUp }\n */\n wakeUp(): void {\n return this._pxActor.wakeUp();\n }\n}\n","import { IPhysicsMaterial } from \"@galacean/engine-design\";\nimport { PhysXPhysics } from \"./PhysXPhysics\";\n\n/**\n * Physics material describes how to handle colliding objects (friction, bounciness).\n */\nexport class PhysXPhysicsMaterial implements IPhysicsMaterial {\n /** @internal */\n _pxMaterial: any;\n\n protected _physXPhysics: PhysXPhysics;\n\n constructor(\n physXPhysics: PhysXPhysics,\n staticFriction: number,\n dynamicFriction: number,\n bounciness: number,\n frictionCombine: CombineMode,\n bounceCombine: CombineMode\n ) {\n this._physXPhysics = physXPhysics;\n const pxMaterial = physXPhysics._pxPhysics.createMaterial(staticFriction, dynamicFriction, bounciness);\n pxMaterial.setFrictionCombineMode(frictionCombine);\n pxMaterial.setRestitutionCombineMode(bounceCombine);\n this._pxMaterial = pxMaterial;\n }\n\n /**\n * {@inheritDoc IPhysicsMaterial.setBounciness }\n */\n setBounciness(value: number) {\n this._pxMaterial.setRestitution(value);\n }\n\n /**\n * {@inheritDoc IPhysicsMaterial.setDynamicFriction }\n */\n setDynamicFriction(value: number) {\n this._pxMaterial.setDynamicFriction(value);\n }\n\n /**\n * {@inheritDoc IPhysicsMaterial.setStaticFriction }\n */\n setStaticFriction(value: number) {\n this._pxMaterial.setStaticFriction(value);\n }\n\n /**\n * {@inheritDoc IPhysicsMaterial.setBounceCombine }\n */\n setBounceCombine(value: CombineMode) {\n this._pxMaterial.setRestitutionCombineMode(value);\n }\n\n /**\n * {@inheritDoc IPhysicsMaterial.setFrictionCombine }\n */\n setFrictionCombine(value: CombineMode) {\n this._pxMaterial.setFrictionCombineMode(value);\n }\n\n /**\n * {@inheritDoc IPhysicsMaterial.destroy }\n */\n destroy(): void {\n this._pxMaterial.release();\n }\n}\n\n/**\n * Describes how physics materials of the colliding objects are combined.\n */\nenum CombineMode {\n /** Averages the friction/bounce of the two colliding materials. */\n Average,\n /** Uses the smaller friction/bounce of the two colliding materials. */\n Minimum,\n /** Multiplies the friction/bounce of the two colliding materials. */\n Multiply,\n /** Uses the larger friction/bounce of the two colliding materials. */\n Maximum\n}\n","import { Ray, Vector3 } from \"@galacean/engine\";\nimport { IPhysicsScene } from \"@galacean/engine-design\";\nimport { DisorderedArray } from \"./DisorderedArray\";\nimport { PhysXCharacterController } from \"./PhysXCharacterController\";\nimport { PhysXCollider } from \"./PhysXCollider\";\nimport { PhysXPhysics } from \"./PhysXPhysics\";\nimport { PhysXPhysicsManager } from \"./PhysXPhysicsManager\";\nimport { PhysXColliderShape } from \"./shape/PhysXColliderShape\";\n\n/**\n * A manager is a collection of colliders and constraints which can interact.\n */\nexport class PhysXPhysicsScene implements IPhysicsScene {\n /** @internal */\n _pxControllerManager: any = null;\n\n private static _tempPosition: Vector3 = new Vector3();\n private static _tempNormal: Vector3 = new Vector3();\n\n private _physXPhysics: PhysXPhysics;\n private _physXManager: PhysXPhysicsManager;\n private _pxRaycastHit: any;\n private _pxFilterData: any;\n\n private _pxScene: any;\n\n private readonly _onContactEnter?: (obj1: number, obj2: number) => void;\n private readonly _onContactExit?: (obj1: number, obj2: number) => void;\n private readonly _onContactStay?: (obj1: number, obj2: number) => void;\n private readonly _onTriggerEnter?: (obj1: number, obj2: number) => void;\n private readonly _onTriggerExit?: (obj1: number, obj2: number) => void;\n private readonly _onTriggerStay?: (obj1: number, obj2: number) => void;\n\n private _currentEvents: DisorderedArray<TriggerEvent> = new DisorderedArray<TriggerEvent>();\n\n private _eventPool: TriggerEvent[] = [];\n\n constructor(\n physXPhysics: PhysXPhysics,\n physicsManager: PhysXPhysicsManager,\n onContactEnter?: (obj1: number, obj2: number) => void,\n onContactExit?: (obj1: number, obj2: number) => void,\n onContactStay?: (obj1: number, obj2: number) => void,\n onTriggerEnter?: (obj1: number, obj2: number) => void,\n onTriggerExit?: (obj1: number, obj2: number) => void,\n onTriggerStay?: (obj1: number, obj2: number) => void\n ) {\n this._physXPhysics = physXPhysics;\n this._physXManager = physicsManager;\n\n const physX = physXPhysics._physX;\n\n this._pxRaycastHit = new physX.PxRaycastHit();\n this._pxFilterData = new physX.PxQueryFilterData();\n this._pxFilterData.flags = new physX.PxQueryFlags(QueryFlag.STATIC | QueryFlag.DYNAMIC | QueryFlag.PRE_FILTER);\n\n this._onContactEnter = onContactEnter;\n this._onContactExit = onContactExit;\n this._onContactStay = onContactStay;\n this._onTriggerEnter = onTriggerEnter;\n this._onTriggerExit = onTriggerExit;\n this._onTriggerStay = onTriggerStay;\n\n const triggerCallback = {\n onContactBegin: (index1, index2) => {\n this._onContactEnter(index1, index2);\n },\n onContactEnd: (index1, index2) => {\n this._onContactExit(index1, index2);\n },\n onContactPersist: (index1, index2) => {\n this._onContactStay(index1, index2);\n },\n onTriggerBegin: (index1, index2) => {\n const event = index1 < index2 ? this._getTrigger(index1, index2) : this._getTrigger(index2, index1);\n event.state = TriggerEventState.Enter;\n this._currentEvents.add(event);\n },\n onTriggerEnd: (index1, index2) => {\n let event: TriggerEvent;\n if (index1 < index2) {\n const subMap = this._physXManager._eventMap[index1];\n event = subMap[index2];\n subMap[index2] = undefined;\n } else {\n const subMap = this._physXManager._eventMap[index2];\n event = subMap[index1];\n subMap[index1] = undefined;\n }\n event.state = TriggerEventState.Exit;\n }\n };\n\n const pxPhysics = physXPhysics._pxPhysics;\n const physXSimulationCallbackInstance = physX.PxSimulationEventCallback.implement(triggerCallback);\n const sceneDesc = physX.getDefaultSceneDesc(pxPhysics.getTolerancesScale(), 0, physXSimulationCallbackInstance);\n this._pxScene = pxPhysics.createScene(sceneDesc);\n }\n\n /**\n * {@inheritDoc IPhysicsManager.setGravity }\n */\n setGravity(value: Vector3) {\n this._pxScene.setGravity(value);\n }\n\n /**\n * {@inheritDoc IPhysicsManager.addColliderShape }\n */\n addColliderShape(colliderShape: PhysXColliderShape) {\n this._physXManager._eventMap[colliderShape._id] = {};\n }\n\n /**\n * {@inheritDoc IPhysicsManager.removeColliderShape }\n */\n removeColliderShape(colliderShape: PhysXColliderShape) {\n const { _eventPool: eventPool, _currentEvents: currentEvents } = this;\n const { _id: id } = colliderShape;\n const { _eventMap: eventMap } = this._physXManager;\n for (let i = currentEvents.length - 1; i >= 0; i--) {\n const event = currentEvents.get(i);\n if (event.index1 == id) {\n currentEvents.deleteByIndex(i);\n eventPool.push(event);\n } else if (event.index2 == id) {\n currentEvents.deleteByIndex(i);\n eventPool.push(event);\n // If the shape is big index, should clear from the small index shape subMap\n eventMap[event.index1][id] = undefined;\n }\n }\n delete eventMap[id];\n }\n\n /**\n * {@inheritDoc IPhysicsManager.addCollider }\n */\n addCollider(collider: PhysXCollider): void {\n this._pxScene.addActor(collider._pxActor, null);\n }\n\n /**\n * {@inheritDoc IPhysicsManager.removeCollider }\n */\n removeCollider(collider: PhysXCollider): void {\n this._pxScene.removeActor(collider._pxActor, true);\n }\n\n /**\n * {@inheritDoc IPhysicsManager.addCharacterController }\n */\n addCharacterController(characterController: PhysXCharacterController): void {\n // Physx have no API to remove/readd cct into scene.\n if (!characterController._pxController) {\n const shape = characterController._shape;\n if (shape) {\n const lastPXManager = characterController._pxManager;\n if (lastPXManager !== this) {\n lastPXManager && characterController._destroyPXController();\n characterController._createPXController(this, shape);\n }\n }\n }\n characterController._pxManager = this;\n }\n\n /**\n * {@inheritDoc IPhysicsManager.removeCharacterController }\n */\n removeCharacterController(characterController: PhysXCharacterController): void {\n characterController._pxManager = null;\n }\n\n /**\n * {@inheritDoc IPhysicsManager.update }\n */\n update(elapsedTime: number): void {\n this._simulate(elapsedTime);\n this._fetchResults();\n this._fireEvent();\n }\n\n /**\n * {@inheritDoc IPhysicsManager.raycast }\n */\n raycast(\n ray: Ray,\n distance: number,\n onRaycast: (obj: number) => boolean,\n hit?: (shapeUniqueID: number, distance: number, position: Vector3, normal: Vector3) => void\n ): boolean {\n const { _pxRaycastHit: pxHitResult } = this;\n distance = Math.min(distance, 3.4e38); // float32 max value limit in physx raycast.\n\n const raycastCallback = {\n preFilter: (filterData, index, actor) => {\n if (onRaycast(index)) {\n return 2; // eBLOCK\n } else {\n return 0; // eNONE\n }\n },\n postFilter: (filterData, hit) => {}\n };\n\n const result = this._pxScene.raycastSingle(\n ray.origin,\n ray.direction,\n distance,\n pxHitResult,\n this._pxFilterData,\n this._physXPhysics._physX.PxQueryFilterCallback.implement(raycastCallback)\n );\n\n if (result && hit != undefined) {\n const { _tempPosition: position, _tempNormal: normal } = PhysXPhysicsScene;\n const { position: pxPosition, normal: pxNormal } = pxHitResult;\n position.set(pxPosition.x, pxPosition.y, pxPosition.z);\n normal.set(pxNormal.x, pxNormal.y, pxNormal.z);\n\n hit(pxHitResult.getShape().getUUID(), pxHitResult.distance, position, normal);\n }\n return result;\n }\n\n /**\n * @internal\n */\n _getControllerManager(): any {\n let pxControllerManager = this._pxControllerManager;\n if (pxControllerManager === null) {\n this._pxControllerManager = pxControllerManager = this._pxScene.createControllerManager();\n }\n return pxControllerManager;\n }\n\n private _simulate(elapsedTime: number): void {\n this._pxScene.simulate(elapsedTime, true);\n }\n\n private _fetchResults(block: boolean = true): void {\n this._pxScene.fetchResults(block);\n }\n\n private _getTrigger(index1: number, index2: number): TriggerEvent {\n let event: TriggerEvent;\n if (this._eventPool.length) {\n event = this._eventPool.pop();\n event.index1 = index1;\n event.index2 = index2;\n } else {\n event = new TriggerEvent(index1, index2);\n }\n this._physXManager._eventMap[index1][index2] = event;\n return event;\n }\n\n private _fireEvent(): void {\n const { _eventPool: eventPool, _currentEvents: currentEvents } = this;\n for (let i = currentEvents.length - 1; i >= 0; i--) {\n const event = currentEvents.get(i);\n if (event.state == TriggerEventState.Enter) {\n this._onTriggerEnter(event.index1, event.index2);\n event.state = TriggerEventState.Stay;\n } else if (event.state == TriggerEventState.Stay) {\n this._onTriggerStay(event.index1, event.index2);\n } else if (event.state == TriggerEventState.Exit) {\n this._onTriggerExit(event.index1, event.index2);\n currentEvents.deleteByIndex(i);\n eventPool.push(event);\n }\n }\n }\n}\n\n/**\n * Filtering flags for scene queries.\n */\nenum QueryFlag {\n STATIC = 1 << 0,\n DYNAMIC = 1 << 1,\n PRE_FILTER = 1 << 2,\n POST_FILTER = 1 << 3,\n ANY_HIT = 1 << 4,\n NO_BLOCK = 1 << 5\n}\n\n/**\n * Physics state\n */\nenum TriggerEventState {\n Enter,\n Stay,\n Exit\n}\n\n/**\n * Trigger event to store interactive object ids and state.\n */\nexport class TriggerEvent {\n state: TriggerEventState;\n index1: number;\n index2: number;\n\n constructor(index1: number, index2: number) {\n this.index1 = index1;\n this.index2 = index2;\n }\n}\n","/**\n * PhysX runtime mode.\n */\nexport enum PhysXRuntimeMode {\n /** Use webAssembly mode first, if WebAssembly mode is not supported, roll back to JavaScript mode. */\n Auto,\n /** WebAssembly mode. */\n WebAssembly,\n /** JavaScript mode. */\n JavaScript\n}\n","import { Quaternion, Vector3, version } from \"@galacean/engine\";\nimport {\n IBoxColliderShape,\n ICapsuleColliderShape,\n ICharacterController,\n IDynamicCollider,\n IFixedJoint,\n IHingeJoint,\n IPhysics,\n IPhysicsManager,\n IPhysicsMaterial,\n IPhysicsScene,\n IPlaneColliderShape,\n ISphereColliderShape,\n ISpringJoint,\n IStaticCollider\n} from \"@galacean/engine-design\";\nimport { PhysXCharacterController } from \"./PhysXCharacterController\";\nimport { PhysXCollider } from \"./PhysXCollider\";\nimport { PhysXDynamicCollider } from \"./PhysXDynamicCollider\";\nimport { PhysXPhysicsManager } from \"./PhysXPhysicsManager\";\nimport { PhysXPhysicsMaterial } from \"./PhysXPhysicsMaterial\";\nimport { PhysXPhysicsScene } from \"./PhysXPhysicsScene\";\nimport { PhysXStaticCollider } from \"./PhysXStaticCollider\";\nimport { PhysXRuntimeMode } from \"./enum/PhysXRuntimeMode\";\nimport { PhysXFixedJoint } from \"./joint/PhysXFixedJoint\";\nimport { PhysXHingeJoint } from \"./joint/PhysXHingeJoint\";\nimport { PhysXSpringJoint } from \"./joint/PhysXSpringJoint\";\nimport { PhysXBoxColliderShape } from \"./shape/PhysXBoxColliderShape\";\nimport { PhysXCapsuleColliderShape } from \"./shape/PhysXCapsuleColliderShape\";\nimport { PhysXPlaneColliderShape } from \"./shape/PhysXPlaneColliderShape\";\nimport { PhysXSphereColliderShape } from \"./shape/PhysXSphereColliderShape\";\n\n/**\n * PhysX object creation.\n */\n\nexport class PhysXPhysics implements IPhysics {\n /** @internal PhysX wasm object */\n _physX: any;\n /** @internal PhysX Foundation SDK singleton class */\n _pxFoundation: any;\n /** @internal PhysX physics object */\n _pxPhysics: any;\n\n private _runTimeMode: PhysXRuntimeMode;\n private _initializeState: InitializeState = InitializeState.Uninitialized;\n private _initializePromise: Promise<void>;\n\n constructor(runtimeMode: PhysXRuntimeMode = PhysXRuntimeMode.Auto) {\n this._runTimeMode = runtimeMode;\n }\n\n /**\n * Initialize PhysXPhysics.\n * @param runtimeMode - Runtime mode\n * @returns Promise object\n */\n initialize(): Promise<void> {\n if (this._initializeState === InitializeState.Initialized) {\n return Promise.resolve();\n } else if (this._initializeState === InitializeState.Initializing) {\n return this._initializePromise;\n }\n\n let runtimeMode = this._runTimeMode;\n const scriptPromise = new Promise((resolve, reject) => {\n const script = document.createElement(\"script\");\n document.body.appendChild(script);\n script.async = true;\n script.onload = resolve;\n script.onerror = reject;\n if (runtimeMode == PhysXRuntimeMode.Auto) {\n const supported = (() => {\n try {\n if (typeof WebAssembly === \"object\" && typeof WebAssembly.instantiate === \"function\") {\n const module = new WebAssembly.Module(Uint8Array.of(0x0, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00));\n if (module instanceof WebAssembly.Module)\n return new WebAssembly.Instance(module) instanceof WebAssembly.Instance;\n }\n } catch (e) {}\n return false;\n })();\n if (supported) {\n runtimeMode = PhysXRuntimeMode.WebAssembly;\n } else {\n runtimeMode = PhysXRuntimeMode.JavaScript;\n }\n }\n\n if (runtimeMode == PhysXRuntimeMode.JavaScript) {\n script.src = `https://mdn.alipayobjects.com/rms/afts/file/A*rnDeR58NNGoAAAAAAAAAAAAAARQnAQ/physx.release.js.js`;\n } else if (runtimeMode == PhysXRuntimeMode.WebAssembly) {\n script.src = `https://mdn.alipayobjects.com/rms/afts/file/A*nA97QLQehRMAAAAAAAAAAAAAARQnAQ/physx.release.js`;\n }\n });\n\n const initializePromise = new Promise<void>((resolve, reject) => {\n scriptPromise\n .then(\n () =>\n (<any>window).PHYSX().then((PHYSX) => {\n this._init(PHYSX);\n this._initializeState = InitializeState.Initialized;\n this._initializePromise = null;\n console.log(\"PhysX loaded.\");\n resolve();\n }, reject),\n reject\n )\n .catch(reject);\n });\n\n this._initializePromise = initializePromise;\n return initializePromise;\n }\n\n /**\n * Destroy PhysXPhysics.\n */\n public destroy(): void {\n this._physX.PxCloseExtensions();\n this._pxPhysics.release();\n this._pxFoundation.release();\n this._physX = null;\n this._pxFoundation = null;\n this._pxPhysics = null;\n }\n\n /**\n * {@inheritDoc IPhysics.createPhysicsManager }\n */\n createPhysicsManager(): IPhysicsManager {\n return new PhysXPhysicsManager();\n }\n\n /**\n * {@inheritDoc IPhysics.createPhysicsScene }\n */\n createPhysicsScene(\n physicsManager: PhysXPhysicsManager,\n onContactBegin?: (obj1: number, obj2: number) => void,\n onContactEnd?: (obj1: number, obj2: number) => void,\n onContactStay?: (obj1: number, obj2: number) => void,\n onTriggerBegin?: (obj1: number, obj2: number) => void,\n onTriggerEnd?: (obj1: number, obj2: number) => void,\n onTriggerStay?: (obj1: number, obj2: number) => void\n ): IPhysicsScene {\n const manager = new PhysXPhysicsScene(\n this,\n physicsManager,\n onContactBegin,\n onContactEnd,\n onContactStay,\n onTriggerBegin,\n onTriggerEnd,\n onTriggerStay\n );\n return manager;\n }\n\n /**\n * {@inheritDoc IPhysics.createStaticCollider }\n */\n createStaticCollider(position: Vector3, rotation: Quaternion): IStaticCollider {\n return new PhysXStaticCollider(this, position, rotation);\n }\n\n /**\n * {@inheritDoc IPhysics.createDynamicCollider }\n */\n createDynamicCollider(position: Vector3, rotation: Quaternion): IDynamicCollider {\n return new PhysXDynamicCollider(this, position, rotation);\n }\n\n /**\n * {@inheritDoc IPhysics.createCharacterController }\n */\n createCharacterController(): ICharacterController {\n return new PhysXCharacterController(this);\n }\n\n /**\n * {@inheritDoc IPhysics.createPhysicsMaterial }\n */\n createPhysicsMaterial(\n staticFriction: number,\n dynamicFriction: number,\n bounciness: number,\n frictionCombine: number,\n bounceCombine: number\n ): IPhysicsMaterial {\n return new PhysXPhysicsMaterial(this, staticFriction, dynamicFriction, bounciness, frictionCombine, bounceCombine);\n }\n\n /**\n * {@inheritDoc IPhysics.createBoxColliderShape }\n */\n createBoxColliderShape(uniqueID: number, size: Vector3, material: PhysXPhysicsMaterial): IBoxColliderShape {\n return new PhysXBoxColliderShape(this, uniqueID, size, material);\n }\n\n /**\n * {@inheritDoc IPhysics.createSphereColliderShape }\n */\n createSphereColliderShape(uniqueID: number, radius: number, material: PhysXPhysicsMaterial): ISphereColliderShape {\n return new PhysXSphereColliderShape(this, uniqueID, radius, material);\n }\n\n /**\n * {@inheritDoc IPhysics.createPlaneColliderShape }\n */\n createPlaneColliderShape(uniqueID: number, material: PhysXPhysicsMaterial): IPlaneColliderShape {\n return new PhysXPlaneColliderShape(this, uniqueID, material);\n }\n\n /**\n * {@inheritDoc IPhysics.createCapsuleColliderShape }\n */\n createCapsuleColliderShape(\n uniqueID: number,\n radius: number,\n height: number,\n material: PhysXPhysicsMaterial\n ): ICapsuleColliderShape {\n return new PhysXCapsuleColliderShape(this, uniqueID, radius, height, material);\n }\n\n /**\n * {@inheritDoc IPhysics.createFixedJoint }\n */\n createFixedJoint(collider: PhysXCollider): IFixedJoint {\n return new PhysXFixedJoint(this, collider);\n }\n\n /**\n * {@inheritDoc IPhysics.createHingeJoint }\n */\n createHingeJoint(collider: PhysXCollider): IHingeJoint {\n return new PhysXHingeJoint(this, collider);\n }\n\n /**\n * {@inheritDoc IPhysics.createSpringJoint }\n */\n createSpringJoint(collider: PhysXCollider): ISpringJoint {\n return new PhysXSpringJoint(this, collider);\n }\n\n private _init(physX: any): void {\n const version = physX.PX_PHYSICS_VERSION;\n const defaultErrorCallback = new physX.PxDefaultErrorCallback();\n const allocator = new physX.PxDefaultAllocator();\n const pxFoundation = physX.PxCreateFoundation(version, allocator, defaultErrorCallback);\n const pxPhysics = physX.PxCreatePhysics(version, pxFoundation, new physX.PxTolerancesScale(), false, null);\n\n physX.PxInitExtensions(pxPhysics, null);\n this._physX = physX;\n this._pxFoundation = pxFoundation;\n this._pxPhysics = pxPhysics;\n }\n}\n\nenum InitializeState {\n Uninitialized,\n Initializing,\n Initialized\n}\n","import { Vector3 } from \"@galacean/engine\";\nimport { IBoxColliderShape } from \"@galacean/engine-design\";\nimport { PhysXPhysics } from \"../PhysXPhysics\";\nimport { PhysXPhysicsMaterial } from \"../PhysXPhysicsMaterial\";\nimport { PhysXColliderShape } from \"./PhysXColliderShape\";\n\n/**\n * Box collider shape in PhysX.\n */\nexport class PhysXBoxColliderShape extends PhysXColliderShape implements IBoxColliderShape {\n private static _tempHalfExtents = new Vector3();\n /** @internal */\n _halfSize: Vector3 = new Vector3();\n private _sizeScale: Vector3 = new Vector3(1, 1, 1);\n\n constructor(physXPhysics: PhysXPhysics, uniqueID: number, size: Vector3, material: PhysXPhysicsMaterial) {\n super(physXPhysics);\n const halfSize = this._halfSize;\n halfSize.set(size.x * 0.5, size.y * 0.5, size.z * 0.5);\n this._pxGeometry = new physXPhysics._physX.PxBoxGeometry(halfSize.x, halfSize.y, halfSize.z);\n this._initialize(material, uniqueID);\n this._setLocalPose();\n }\n\n /**\n * {@inheritDoc IBoxColliderShape.setSize }\n */\n setSize(value: Vector3): void {\n const halfSize = this._halfSize;\n const tempExtents = PhysXBoxColliderShape._tempHalfExtents;\n halfSize.set(value.x * 0.5, value.y * 0.5, value.z * 0.5);\n Vector3.multiply(halfSize, this._sizeScale, tempExtents);\n this._pxGeometry.halfExtents = tempExtents;\n this._pxShape.setGeometry(this._pxGeometry);\n\n this._updateController(tempExtents);\n }\n\n /**\n * {@inheritDoc IColliderShape.setWorldScale }\n */\n override setWorldScale(scale: Vector3): void {\n super.setWorldScale(scale);\n this._sizeScale.set(Math.abs(scale.x), Math.abs(scale.y), Math.abs(scale.z));\n const tempExtents = PhysXBoxColliderShape._tempHalfExtents;\n Vector3.multiply(this._halfSize, this._sizeScale, tempExtents);\n this._pxGeometry.halfExtents = tempExtents;\n this._pxShape.setGeometry(this._pxGeometry);\n\n this._updateController(tempExtents);\n }\n\n private _updateController(extents: Vector3) {\n const controllers = this._controllers;\n for (let i = 0, n = controllers.length; i < n; i++) {\n const pxController = controllers.get(i)._pxController;\n pxController.setHalfHeight(extents.x);\n pxController.setHalfSideExtent(extents.y);\n pxController.setHalfForwardExtent(extents.z);\n }\n }\n}\n","import { ICharacterController } from \"@galacean/engine-design\";\nimport { Vector3 } from \"@galacean/engine\";\nimport { PhysXPhysics } from \"./PhysXPhysics\";\nimport { PhysXPhysicsScene } from \"./PhysXPhysicsScene\";\nimport { PhysXBoxColliderShape } from \"./shape/PhysXBoxColliderShape\";\nimport { PhysXCapsuleColliderShape } from \"./shape/PhysXCapsuleColliderShape\";\nimport { PhysXColliderShape } from \"./shape/PhysXColliderShape\";\n\n/**\n * Base class for character controllers.\n */\nexport class PhysXCharacterController implements ICharacterController {\n private static _tempVec = new Vector3();\n\n /** @internal */\n _id: number;\n /** @internal */\n _pxController: any;\n /** @internal */\n _pxManager: PhysXPhysicsScene;\n /** @internal */\n _shape: PhysXColliderShape;\n private _shapeScaledPosition = new Vector3();\n private _worldPosition: Vector3 = null;\n\n private _physXPhysics: PhysXPhysics;\n\n constructor(physXPhysics: PhysXPhysics) {\n this._physXPhysics = physXPhysics;\n }\n\n /**\n * {@inheritDoc ICharacterController.move }\n */\n move(disp: Vector3, minDist: number, elapsedTime: number): number {\n return this._pxController?.move(disp, minDist, elapsedTime) ?? 0;\n }\n\n /**\n * {@inheritDoc ICharacterController.setWorldPosition }\n */\n setWorldPosition(position: Vector3): void {\n this._worldPosition = position;\n this._updateNativePosition();\n }\n\n /**\n * {@inheritDoc ICharacterController.getWorldPosition }\n */\n getWorldPosition(position: Vector3): void {\n if (this._pxController) {\n position.copyFrom(this._pxController.getPosition());\n position.subtract(this._shapeScaledPosition);\n }\n }\n\n /**\n * {@inheritDoc ICharacterController.setStepOffset }\n */\n setStepOffset(offset: number): void {\n this._pxController?.setStepOffset(offset);\n }\n\n /**\n * {@inheritDoc ICharacterController.setNonWalkableMode }\n */\n setNonWalkableMode(flag: number): void {\n this._pxController?.setNonWalkableMode(flag);\n }\n\n /**\n * {@inheritDoc ICharacterController.setUpDirection }\n */\n setUpDirection(up: Vector3): void {\n this._pxController?.setUpDirection(up);\n }\n\n /**\n * {@inheritDoc ICharacterController.setSlopeLimit }\n */\n setSlopeLimit(slopeLimit: number): void {\n this._pxController?.setSlopeLimit(slopeLimit);\n }\n\n /**\n * {@inheritDoc ICharacterController.addShape }\n */\n addShape(shape: PhysXColliderShape): void {\n this._pxManager && this._createPXController(this._pxManager, shape);\n this._shape = shape;\n shape._controllers.add(this);\n }\n\n /**\n * {@inheritDoc ICharacterController.removeShape }\n */\n removeShape(shape: PhysXColliderShape): void {\n this._destroyPXController();\n this._shape = null;\n shape._controllers.delete(this);\n }\n\n /**\n * {@inheritDoc ICharacterController.destroy }\n */\n destroy(): void {\n this._destroyPXController();\n }\n\n /**\n * @internal\n */\n _createPXController(pxManager: PhysXPhysicsScene, shape: PhysXColliderShape): void {\n let desc: any;\n if (shape instanceof PhysXBoxColliderShape) {\n desc = new this._physXPhysics._physX.PxBoxControllerDesc();\n desc.halfHeight = shape._halfSize.x;\n desc.halfSideExtent = shape._halfSize.y;\n desc.halfForwardExtent = shape._halfSize.z;\n } else if (shape instanceof PhysXCapsuleColliderShape) {\n desc = new this._physXPhysics._physX.PxCapsuleControllerDesc();\n desc.radius = shape._radius;\n desc.height = shape._halfHeight * 2;\n desc.climbingMode = 1; // constraint mode\n } else {\n throw \"unsupported shape type\";\n }\n\n desc.setMaterial(shape._pxMaterial);\n\n this._pxController = pxManager._getControllerManager().createController(desc);\n this._pxController.setUUID(shape._id);\n }\n\n /**\n * @internal\n */\n _destroyPXController(): void {\n if (this._pxController) {\n this._pxController.release();\n this._pxController = null;\n }\n }\n\n /**\n * @internal\n */\n _updateShapePosition(shapePosition: Vector3, worldScale: Vector3): void {\n Vector3.multiply(shapePosition, worldScale, this._shapeScaledPosition);\n this._updateNativePosition();\n }\n\n private _updateNativePosition() {\n const worldPosition = this._worldPosition;\n if (this._pxController && worldPosition) {\n Vector3.add(worldPosition, this._shapeScaledPosition, PhysXCharacterController._tempVec);\n this._pxController.setPosition(PhysXCharacterController._tempVec);\n }\n }\n}\n","import { ICollider } from \"@galacean/engine-design\";\nimport { Quaternion, Vector3 } from \"@galacean/engine\";\nimport { PhysXPhysics } from \"./PhysXPhysics\";\nimport { PhysXColliderShape } from \"./shape/PhysXColliderShape\";\n\n/**\n * Abstract class of physical collider.\n */\nexport abstract class PhysXCollider implements ICollider {\n private static _tempTransform: {\n translation: Vector3;\n rotation: Quaternion;\n } = { translation: null, rotation: null };\n\n /** @internal */\n _pxActor: any;\n\n protected _physXPhysics: PhysXPhysics;\n\n constructor(physXPhysics: PhysXPhysics) {\n this._physXPhysics = physXPhysics;\n }\n\n /**\n * {@inheritDoc ICollider.addShape }\n */\n addShape(shape: PhysXColliderShape): void {\n this._pxActor.attachShape(shape._pxShape);\n }\n\n /**\n * {@inheritDoc ICollider.removeShape }\n */\n removeShape(shape: PhysXColliderShape): void {\n this._pxActor.detachShape(shape._pxShape, true);\n }\n\n /**\n * {@inheritDoc ICollider.setWorldTransform }\n */\n setWorldTransform(position: Vector3, rotation: Quaternion): void {\n this._pxActor.setGlobalPose(this._transform(position, rotation), true);\n }\n\n /**\n * {@inheritDoc ICollider.getWorldTransform }\n */\n getWorldTransform(outPosition: Vector3, outRotation: Quaternion): void {\n const transform = this._pxActor.getGlobalPose();\n outPosition.set(transform.translation.x, transform.translation.y, transform.translation.z);\n outRotation.set(transform.rotation.x, transform.rotation.y, transform.rotation.z, transform.rotation.w);\n }\n\n /**\n * {@inheritDoc ICollider.destroy }\n */\n destroy(): void {\n this._pxActor.release();\n }\n\n /**\n * @internal\n */\n _transform(pos: Vector3, rot: Quaternion): { translation: Vector3; rotation: Quaternion } {\n const transform = PhysXCollider._tempTransform;\n transform.translation = pos;\n transform.rotation = rot.normalize();\n return transform;\n }\n}\n","import { IPhysicsManager } from \"@galacean/engine-design\";\nimport { TriggerEvent } from \"./PhysXPhysicsScene\";\n\nexport class PhysXPhysicsManager implements IPhysicsManager {\n /** @internal */\n _eventMap: Record<number, Record<number, TriggerEvent>> = {};\n}\n","import { IStaticCollider } from \"@galacean/engine-design\";\nimport { Quaternion, Vector3 } from \"@galacean/engine\";\nimport { PhysXCollider } from \"./PhysXCollider\";\nimport { PhysXPhysics } from \"./PhysXPhysics\";\n\n/**\n * A static collider component that will not move.\n * @remarks Mostly used for object which always stays at the same place and never moves around.\n */\nexport class PhysXStaticCollider extends PhysXCollider implements IStaticCollider {\n constructor(physXPhysics: PhysXPhysics, position: Vector3, rotation: Quaternion) {\n super(physXPhysics);\n this._pxActor = physXPhysics._pxPhysics.createRigidStatic(this._transform(position, rotation));\n }\n}\n","import { IJoint } from \"@galacean/engine-design\";\nimport { Quaternion, Vector3 } from \"@galacean/engine\";\nimport { PhysXCollider } from \"../PhysXCollider\";\nimport { PhysXPhysics } from \"../PhysXPhysics\";\n\n/**\n * a base interface providing common functionality for PhysX joints\n */\nexport class PhysXJoint implements IJoint {\n protected static _xAxis = new Vector3(1, 0, 0);\n protected static _defaultVec = new Vector3();\n protected static _defaultQuat = new Quaternion();\n\n protected _pxJoint: any;\n protected _collider: PhysXCollider;\n private _connectedAnchor = new Vector3();\n private _breakForce: number = Number.MAX_VALUE;\n private _breakTorque: number = Number.MAX_VALUE;\n\n protected _physXPhysics: PhysXPhysics;\n\n constructor(physXPhysics: PhysXPhysics) {\n this._physXPhysics = physXPhysics;\n }\n\n /**\n * {@inheritDoc IJoint.setConnectedCollider }\n */\n setConnectedCollider(value: PhysXCollider): void {\n this._pxJoint.setActors(value?._pxActor || null, this._collider?._pxActor || null);\n }\n\n /**\n * {@inheritDoc IJoint.setConnectedAnchor }\n */\n setConnectedAnchor(value: Vector3): void {\n this._connectedAnchor.copyFrom(value);\n this._setLocalPose(0, value, PhysXJoint._defaultQuat);\n }\n\n /**\n * {@inheritDoc IJoint.setConnectedMassScale }\n */\n setConnectedMassScale(value: number): void {\n this._pxJoint.setInvMassScale0(1 / value);\n }\n\n /**\n * {@inheritDoc IJoint.setConnectedInertiaScale }\n */\n setConnectedInertiaScale(value: number): void {\n this._pxJoint.setInvInertiaScale0(1 / value);\n }\n\n /**\n * {@inheritDoc IJoint.setMassScale }\n */\n setMassScale(value: number): void {\n this._pxJoint.setInvMassScale1(1 / value);\n }\n\n /**\n * {@inheritDoc IJoint.setInertiaScale }\n */\n setInertiaScale(value: number): void {\n this._pxJoint.setInvInertiaScale1(1 / value);\n }\n\n /**\n * {@inheritDoc IJoint.setBreakForce }\n */\n setBreakForce(value: number): void {\n this._breakForce = value;\n this._pxJoint.setBreakForce(this._breakForce, this._breakTorque);\n }\n\n /**\n * {@inheritDoc IJoint.setBreakTorque }\n */\n setBreakTorque(value: number): void {\n this._breakTorque = value;\n this._pxJoint.setBreakForce(this._breakForce, this._breakTorque);\n }\n\n /**\n * Set the joint local pose for an actor.\n * @param actor 0 for the first actor, 1 for the second actor.\n * @param position the local position for the actor this joint\n * @param rotation the local rotation for the actor this joint\n */\n protected _setLocalPose(actor: number, position: Vector3, rotation: Quaternion): void {\n this._pxJoint.setLocalPose(actor, position, rotation);\n }\n}\n","import { IFixedJoint } from \"@galacean/engine-design\";\nimport { PhysXCollider } from \"../PhysXCollider\";\nimport { PhysXPhysics } from \"../PhysXPhysics\";\nimport { PhysXJoint } from \"./PhysXJoint\";\n\n/**\n * A fixed joint permits no relative movement between two colliders. ie the bodies are glued together.\n */\nexport class PhysXFixedJoint extends PhysXJoint implements IFixedJoint {\n constructor(physXPhysics: PhysXPhysics, collider: PhysXCollider) {\n super(physXPhysics);\n this._collider = collider;\n this._pxJoint = physXPhysics._pxPhysics.createFixedJoint(\n null,\n PhysXJoint._defaultVec,\n PhysXJoint._defaultQuat,\n collider._pxActor,\n PhysXJoint._defaultVec,\n PhysXJoint._defaultQuat\n );\n }\n}\n","import { IHingeJoint } from \"@galacean/engine-design\";\nimport { Quaternion, Vector3 } from \"@galacean/engine\";\nimport { PhysXCollider } from \"../PhysXCollider\";\nimport { PhysXPhysics } from \"../PhysXPhysics\";\nimport { PhysXJoint } from \"./PhysXJoint\";\n\n/**\n * A joint which behaves in a similar way to a hinge or axle.\n */\nexport class PhysXHingeJoint extends PhysXJoint implements IHingeJoint {\n private _axisRotationQuaternion = new Quaternion();\n private _swingOffset = new Vector3();\n\n constructor(physXPhysics: PhysXPhysics, collider: PhysXCollider) {\n super(physXPhysics);\n this._collider = collider;\n this._pxJoint = physXPhysics._pxPhysics.createRevoluteJoint(\n null,\n PhysXJoint._defaultVec,\n PhysXJoint._defaultQuat,\n collider._pxActor,\n PhysXJoint._defaultVec,\n PhysXJoint._defaultQuat\n );\n }\n\n /**\n * {@inheritDoc IHingeJoint.setAxis }\n */\n setAxis(value: Vector3): void {\n const xAxis = PhysXJoint._xAxis;\n const axisRotationQuaternion = this._axisRotationQuaternion;\n xAxis.set(1, 0, 0);\n value.normalize();\n const angle = Math.acos(Vector3.dot(xAxis, value));\n Vector3.cross(xAxis, value, xAxis);\n Quaternion.rotationAxisAngle(xAxis, angle, axisRotationQuaternion);\n\n this._setLocalPose(0, this._swingOffset, axisRotationQuaternion);\n }\n\n /**\n * {@inheritDoc IHingeJoint.setSwingOffset }\n */\n setSwingOffset(value: Vector3): void {\n this._swingOffset.copyFrom(value);\n this._setLocalPose(1, this._swingOffset, this._axisRotationQuaternion);\n }\n\n /**\n * {@inheritDoc IHingeJoint.getAngle }\n */\n getAngle(): number {\n return this._pxJoint.getAngle();\n }\n\n /**\n * {@inheritDoc IHingeJoint.getVelocity }\n */\n getVelocity(): Readonly<number> {\n return this._pxJoint.getVelocity();\n }\n\n /**\n * {@inheritDoc IHingeJoint.setHardLimitCone }\n */\n setHardLimit(lowerLimit: number, upperLimit: number, contactDist: number): void {\n this._pxJoint.setHardLimit(lowerLimit, upperLimit, contactDist);\n }\n\n /**\n * {@inheritDoc IHingeJoint.setHardLimitCone }\n */\n setSoftLimit(lowerLimit: number, upperLimit: number, stiffness: number, damping: number): void {\n this._pxJoint.setSoftLimit(lowerLimit, upperLimit, stiffness, damping);\n }\n\n /**\n * {@inheritDoc IHingeJoint.setDriveVelocity }\n */\n setDriveVelocity(velocity: number, autowake: boolean = true): void {\n this._pxJoint.setDriveVelocity(velocity, autowake);\n }\n\n /**\n * {@inheritDoc IHingeJoint.setDriveForceLimit }\n */\n setDriveForceLimit(limit: number): void {\n this._pxJoint.setDriveForceLimit(limit);\n }\n\n /**\n * {@inheritDoc IHingeJoint.setDriveGearRatio }\n */\n setDriveGearRatio(ratio: number): void {\n this._pxJoint.setDriveGearRatio(ratio);\n }\n\n /**\n * {@inheritDoc IHingeJoint.setHingeJointFlag }\n */\n setHingeJointFlag(flag: number, value: boolean): void {\n this._pxJoint.setRevoluteJointFlag(flag, value);\n }\n}\n","import { PhysXPhysics } from \"../PhysXPhysics\";\nimport { PhysXJoint } from \"./PhysXJoint\";\nimport { ISpringJoint } from \"@galacean/engine-design\";\nimport { PhysXCollider } from \"../PhysXCollider\";\nimport { Vector3 } from \"@galacean/engine\";\n\n/**\n * a joint that maintains an upper or lower bound (or both) on the distance between two points on different objects\n */\nexport class PhysXSpringJoint extends PhysXJoint implements ISpringJoint {\n private _swingOffset = new Vector3();\n\n constructor(physXPhysics: PhysXPhysics, collider: PhysXCollider) {\n super(physXPhysics);\n this._collider = collider;\n this._pxJoint = physXPhysics._pxPhysics.createDistanceJoint(\n null,\n PhysXJoint._defaultVec,\n PhysXJoint._defaultQuat,\n collider._pxActor,\n PhysXJoint._defaultVec,\n PhysXJoint._defaultQuat\n );\n this._pxJoint.setDistanceJointFlag(2, true); // enable max distance;\n this._pxJoint.setDistanceJointFlag(4, true); // enable min distance;\n this._pxJoint.setDistanceJointFlag(8, true); // enable spring;\n }\n\n /**\n * {@inheritDoc ISpringJoint.setSwingOffset }\n */\n setSwingOffset(value: Vector3): void {\n this._swingOffset.copyFrom(value);\n this._setLocalPose(1, value, PhysXJoint._defaultQuat);\n }\n\n /**\n * {@inheritDoc ISpringJoint.setMinDistance }\n */\n setMinDistance(distance: number): void {\n this._pxJoint.setMinDistance(distance);\n }\n\n /**\n * {@inheritDoc ISpringJoint.setMaxDistance }\n */\n setMaxDistance(distance: number): void {\n this._pxJoint.setMaxDistance(distance);\n }\n\n /**\n * {@inheritDoc ISpringJoint.setTolerance }\n */\n setTolerance(tolerance: number): void {\n this._pxJoint.setTolerance(tolerance);\n }\n\n /**\n * {@inheritDoc ISpringJoint.setStiffness }\n */\n setStiffness(stiffness: number): void {\n this._pxJoint.setStiffness(stiffness);\n }\n\n /**\n * {@inheritDoc ISpringJoint.setDamping }\n */\n setDamping(damping: number): void {\n this._pxJoint.setDamping(damping);\n }\n}\n","import { IPlaneColliderShape } from \"@galacean/engine-design\";\nimport { Quaternion, Vector3 } from \"@galacean/engine\";\nimport { PhysXPhysics } from \"../PhysXPhysics\";\nimport { PhysXPhysicsMaterial } from \"../PhysXPhysicsMaterial\";\nimport { PhysXColliderShape } from \"./PhysXColliderShape\";\n\n/**\n * Plane collider shape in PhysX.\n */\nexport class PhysXPlaneColliderShape extends PhysXColliderShape implements IPlaneColliderShape {\n constructor(physXPhysics: PhysXPhysics, uniqueID: number, material: PhysXPhysicsMaterial) {\n super(physXPhysics);\n this._axis = new Quaternion(0, 0, PhysXColliderShape.halfSqrt, PhysXColliderShape.halfSqrt);\n this._physXRotation.copyFrom(this._axis);\n\n this._pxGeometry = new physXPhysics._physX.PxPlaneGeometry();\n this._initialize(material, uniqueID);\n this._setLocalPose();\n }\n}\n","import { Vector3 } from \"@galacean/engine\";\nimport { ISphereColliderShape } from \"@galacean/engine-design\";\nimport { PhysXPhysics } from \"../PhysXPhysics\";\nimport { PhysXPhysicsMaterial } from \"../PhysXPhysicsMaterial\";\nimport { PhysXColliderShape } from \"./PhysXColliderShape\";\n\n/**\n * Sphere collider shape in PhysX.\n */\nexport class PhysXSphereColliderShape extends PhysXColliderShape implements ISphereColliderShape {\n private _radius: number;\n private _maxScale: number = 1;\n\n constructor(physXPhysics: PhysXPhysics, uniqueID: number, radius: number, material: PhysXPhysicsMaterial) {\n super(physXPhysics);\n\n this._radius = radius;\n\n this._pxGeometry = new physXPhysics._physX.PxSphereGeometry(this._radius * this._maxScale);\n this._initialize(material, uniqueID);\n this._setLocalPose();\n }\n\n /**\n * {@inheritDoc ISphereColliderShape.setRadius }\n */\n setRadius(value: number): void {\n this._radius = value;\n this._pxGeometry.radius = value * this._maxScale;\n this._pxShape.setGeometry(this._pxGeometry);\n }\n\n /**\n * {@inheritDoc IColliderShape.setWorldScale }\n */\n override setWorldScale(scale: Vector3): void {\n super.setWorldScale(scale);\n\n this._maxScale = Math.max(Math.abs(scale.x), Math.abs(scale.y), Math.abs(scale.z));\n this._pxGeometry.radius = this._radius * this._maxScale;\n this._pxShape.setGeometry(this._pxGeometry);\n }\n}\n","export { PhysXPhysics } from \"./PhysXPhysics\";\nexport { PhysXRuntimeMode } from \"./enum/PhysXRuntimeMode\";\n\n//@ts-ignore\nexport const version = `__buildVersion`;\n\nconsole.log(`Galacean PhysX version: ${version}`);\n"],"names":["_instanceof","left","right","Symbol","hasInstance","_set_prototype_of","o","p","Object","setPrototypeOf","__proto__","_inherits","subClass","superClass","TypeError","prototype","create","constructor","value","writable","configurable","ShapeFlag","ColliderShapeUpAxis","CollisionDetectionMode","CombineMode","QueryFlag","TriggerEventState","PhysXRuntimeMode","InitializeState","DisorderedArray","count","length","_elements","Array","add","element","push","delete","index","indexOf","deleteByIndex","get","elements","end","lastIndex","garbageCollection","SIMULATION_SHAPE","SCENE_QUERY_SHAPE","TRIGGER_SHAPE","PhysXColliderShape","physXPhysics","_controllers","_worldScale","Vector3","_position","_rotation","_axis","_physXRotation","Quaternion","_shapeFlags","_physXPhysics","setRotation","rotationYawPitchRoll","x","y","z","multiply","normalize","_setLocalPose","setPosition","copyFrom","controllers","i","n","_updateShapePosition","setWorldScale","scale","setContactOffset","offset","_pxShape","_pxController","setMaterial","_pxMaterial","setIsTrigger","_modifyFlag","_setShapeFlags","destroy","release","flags","setFlags","_physX","PxShapeFlags","_proto","transform","translation","rotation","setLocalPose","_initialize","material","id","_id","_pxPhysics","createShape","_pxGeometry","setUUID","flag","halfSqrt","PhysXBoxColliderShape","PhysXColliderShape1","uniqueID","size","_this","_halfSize","_sizeScale","halfSize","set","PxBoxGeometry","setSize","tempExtents","_tempHalfExtents","halfExtents","setGeometry","_updateController","Math","abs","extents","pxController","setHalfHeight","setHalfSideExtent","setHalfForwardExtent","PhysXCapsuleColliderShape","radius","height","_upAxis","Y","_radius","_halfHeight","PxCapsuleGeometry","setRadius","sizeScale","X","max","Z","setHeight","halfHeight","setUpAxis","upAxis","axis","physXRotation","geometry","PhysXCharacterController","_shapeScaledPosition","_worldPosition","move","disp","minDist","elapsedTime","_this__pxController","_this__pxController_move","setWorldPosition","position","_updateNativePosition","getWorldPosition","getPosition","subtract","setStepOffset","setNonWalkableMode","setUpDirection","up","setSlopeLimit","slopeLimit","addShape","shape","_pxManager","_createPXController","_shape","removeShape","_destroyPXController","pxManager","desc","PxBoxControllerDesc","halfSideExtent","halfForwardExtent","PxCapsuleControllerDesc","climbingMode","_getControllerManager","createController","shapePosition","worldScale","worldPosition","_tempVec","PhysXCollider","_pxActor","attachShape","detachShape","setWorldTransform","setGlobalPose","_transform","getWorldTransform","outPosition","outRotation","getGlobalPose","w","pos","rot","_tempTransform","Discrete","Continuous","ContinuousDynamic","ContinuousSpeculative","PhysXDynamicCollider","PhysXCollider1","createRigidDynamic","setLinearDamping","setAngularDamping","setLinearVelocity","setAngularVelocity","setMass","setCenterOfMass","setCMassLocalPose","setInertiaTensor","setMassSpaceInertiaTensor","setMaxAngularVelocity","setMaxDepenetrationVelocity","setSleepThreshold","setSolverIterations","setSolverIterationCounts","setCollisionDetectionMode","setRigidBodyFlag","PxRigidBodyFlag","eENABLE_CCD","eENABLE_CCD_FRICTION","eENABLE_SPECULATIVE_CCD","physX","setIsKinematic","eKINEMATIC","setConstraints","setRigidDynamicLockFlags","addForce","force","addTorque","torque","positionOrRotation","setKinematicTarget","tempTranslation","_tempTranslation","tempRotation","_tempRotation","sleep","putToSleep","wakeUp","PhysXPhysicsManager","_eventMap","PhysXPhysicsMaterial","staticFriction","dynamicFriction","bounciness","frictionCombine","bounceCombine","pxMaterial","createMaterial","setFrictionCombineMode","setRestitutionCombineMode","setBounciness","setRestitution","setDynamicFriction","setStaticFriction","setBounceCombine","setFrictionCombine","Average","Minimum","Multiply","Maximum","PhysXPhysicsScene","physicsManager","onContactEnter","onContactExit","onContactStay","onTriggerEnter","onTriggerExit","onTriggerStay","_pxControllerManager","_currentEvents","_eventPool","_physXManager","_pxRaycastHit","PxRaycastHit","_pxFilterData","PxQueryFilterData","PxQueryFlags","_onContactEnter","_onContactExit","_onContactStay","_onTriggerEnter","_onTriggerExit","_onTriggerStay","pxPhysics","physXSimulationCallbackInstance","PxSimulationEventCallback","implement","onContactBegin","index1","index2","onContactEnd","onContactPersist","onTriggerBegin","event","_getTrigger","state","Enter","onTriggerEnd","subMap","undefined","Exit","sceneDesc","getDefaultSceneDesc","getTolerancesScale","_pxScene","createScene","setGravity","addColliderShape","colliderShape","removeColliderShape","eventPool","eventMap","_this__physXManager","currentEvents","addCollider","collider","addActor","removeCollider","removeActor","addCharacterController","characterController","lastPXManager","removeCharacterController","update","_simulate","_fetchResults","_fireEvent","raycast","ray","distance","onRaycast","hit","pxHitResult","min","result","raycastSingle","origin","direction","PxQueryFilterCallback","preFilter","filterData","actor","postFilter","_tempPosition","_tempNormal","normal","pxNormal","pxPosition","getShape","getUUID","pxControllerManager","createControllerManager","simulate","block","fetchResults","pop","TriggerEvent","Stay","STATIC","DYNAMIC","PRE_FILTER","POST_FILTER","ANY_HIT","NO_BLOCK","PhysXStaticCollider","createRigidStatic","Auto","WebAssembly","JavaScript","PhysXJoint","_connectedAnchor","_breakForce","Number","MAX_VALUE","_breakTorque","setConnectedCollider","_this__collider","_pxJoint","setActors","_collider","setConnectedAnchor","_defaultQuat","setConnectedMassScale","setInvMassScale0","setConnectedInertiaScale","setInvInertiaScale0","setMassScale","setInvMassScale1","setInertiaScale","setInvInertiaScale1","setBreakForce","setBreakTorque","_xAxis","_defaultVec","PhysXFixedJoint","PhysXJoint1","createFixedJoint","PhysXHingeJoint","_axisRotationQuaternion","_swingOffset","createRevoluteJoint","setAxis","xAxis","axisRotationQuaternion","angle","acos","dot","cross","rotationAxisAngle","setSwingOffset","getAngle","getVelocity","setHardLimit","lowerLimit","upperLimit","contactDist","setSoftLimit","stiffness","damping","setDriveVelocity","velocity","autowake","setDriveForceLimit","limit","setDriveGearRatio","ratio","setHingeJointFlag","setRevoluteJointFlag","PhysXSpringJoint","createDistanceJoint","setDistanceJointFlag","setMinDistance","setMaxDistance","setTolerance","tolerance","setStiffness","setDamping","PhysXPlaneColliderShape","PxPlaneGeometry","PhysXSphereColliderShape","_maxScale","PxSphereGeometry","PhysXPhysics","runtimeMode","_initializeState","Uninitialized","_runTimeMode","initialize","Initialized","Promise","resolve","Initializing","_initializePromise","scriptPromise","reject","script","document","createElement","body","appendChild","async","onload","onerror","instantiate","module","Module","Uint8Array","of","Instance","e","src","initializePromise","then","window","PHYSX","_init","console","log","catch","PxCloseExtensions","_pxFoundation","createPhysicsManager","createPhysicsScene","createStaticCollider","createDynamicCollider","createCharacterController","createPhysicsMaterial","createBoxColliderShape","createSphereColliderShape","createPlaneColliderShape","createCapsuleColliderShape","createHingeJoint","createSpringJoint","version","PX_PHYSICS_VERSION","defaultErrorCallback","PxDefaultErrorCallback","allocator","PxDefaultAllocator","pxFoundation","PxCreateFoundation","PxCreatePhysics","PxTolerancesScale","PxInitExtensions"],"mappings":"oVAAO,SAASA,EAAYC,CAAI,CAAEC,CAAK,SACnC,AAAIA,AAAS,MAATA,GAAiB,AAAkB,aAAlB,OAAOC,QAA0BD,CAAK,CAACC,OAAOC,WAAW,CAAC,CACpE,CAAC,CAACF,CAAK,CAACC,OAAOC,WAAW,CAAC,CAACH,GACzBA,aAAgBC,CAClC,CCJO,SAASG,EAAkBC,CAAC,CAAEC,CAAC,EAOlC,MAAOF,AANPA,CAAAA,EAAoBG,OAAOC,cAAc,EAAI,SAAwBH,CAAC,CAAEC,CAAC,EAGrE,OAFAD,EAAEI,SAAS,CAAGH,E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IAAI,CAAEjH,EACpC,EAEA5O,EAAQ4Y,KAWP,CAXD,SAAc/P,CAAU,EACtB,IAAMiR,EAAUjR,EAAMkR,kBAAkB,CAClCC,EAAuB,IAAInR,EAAMoR,sBAAsB,CACvDC,EAAY,IAAIrR,EAAMsR,kBAAkB,CACxCC,EAAevR,EAAMwR,kBAAkB,CAACP,EAASI,EAAWF,GAC5DpN,EAAY/D,EAAMyR,eAAe,CAACR,EAASM,EAAc,IAAIvR,EAAM0R,iBAAiB,CAAI,CAAA,EAAO,MAErG1R,EAAM2R,gBAAgB,CAAC5N,EAAW,MAClC,IAAI,CAAC9M,MAAM,CAAG+I,EACd,IAAI,CAACoQ,aAAa,CAAGmB,EACrB,IAAI,CAAC3Z,UAAU,CAAGmM,CACpB,EA/NW+J,CAgOZ,GAEI3a,EAAAA,EAAAA,GAAAA,CAAAA,EAAAA,CAAAA,CAAAA,EAAAA,CAAAA,EACH8a,cAAAA,EAAAA,CAAAA,gBADG9a,CAAAA,CAAAA,EAEHob,aAAAA,EAAAA,CAAAA,eAFGpb,CAAAA,CAAAA,EAGHib,YAAAA,EAAAA,CAAAA,cYtQW6C,IAAAA,EAAW,eAExBjB,QAAQC,GAAG,CAAE,2BAA0BgB"}
|
package/dist/main.js
CHANGED
|
@@ -1437,7 +1437,7 @@ var InitializeState;
|
|
|
1437
1437
|
})(InitializeState || (InitializeState = {}));
|
|
1438
1438
|
|
|
1439
1439
|
//@ts-ignore
|
|
1440
|
-
var version = "1.2.0-beta.
|
|
1440
|
+
var version = "1.2.0-beta.4";
|
|
1441
1441
|
console.log("Galacean PhysX version: " + version);
|
|
1442
1442
|
|
|
1443
1443
|
exports.PhysXPhysics = PhysXPhysics;
|