@galacean/engine-physics-physx 0.9.21 → 0.9.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.js +1359 -1292
- package/dist/browser.min.js +1 -1
- package/dist/main.js +102 -38
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +32444 -31558
- package/dist/module.js +88 -21
- package/dist/module.js.map +1 -1
- package/package.json +4 -4
package/dist/browser.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@swc/helpers/src/_instanceof.mjs"),require("@swc/helpers/src/_ts_decorate.mjs"),require("@swc/helpers/src/_inherits.mjs"),require("@galacean/engine")):"function"==typeof define&&define.amd?define(["exports","@swc/helpers/src/_instanceof.mjs","@swc/helpers/src/_ts_decorate.mjs","@swc/helpers/src/_inherits.mjs","@galacean/engine"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).Galacean=t.Galacean||{},t.Galacean.PhysicsPhysX={}),t._instanceof,t._ts_decorate,t._inherits,t.Galacean)}(this,function(t,e,i,s,n){"use strict";function o(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var a,r,h,l,c,_,u,p,f,y,x,d,g,m=o(e),P=o(i),S=o(s);(a=t.PhysXRuntimeMode||(t.PhysXRuntimeMode={}))[a.Auto=0]="Auto",a[a.WebAssembly=1]="WebAssembly",a[a.JavaScript=2]="JavaScript";var v=function(){function t(){this._connectedAnchor=new n.Vector3,this._breakForce=Number.MAX_VALUE,this._breakTorque=Number.MAX_VALUE}var e=t.prototype;return e.setConnectedCollider=function(t){var e;this._pxJoint.setActors((null==t?void 0:t._pxActor)||null,(null==(e=this._collider)?void 0:e._pxActor)||null)},e.setConnectedAnchor=function(e){this._connectedAnchor.copyFrom(e),this._setLocalPose(0,e,t._defaultQuat)},e.setConnectedMassScale=function(t){this._pxJoint.setInvMassScale0(1/t)},e.setConnectedInertiaScale=function(t){this._pxJoint.setInvInertiaScale0(1/t)},e.setMassScale=function(t){this._pxJoint.setInvMassScale1(1/t)},e.setInertiaScale=function(t){this._pxJoint.setInvInertiaScale1(1/t)},e.setBreakForce=function(t){this._breakForce=t,this._pxJoint.setBreakForce(this._breakForce,this._breakTorque)},e.setBreakTorque=function(t){this._breakTorque=t,this._pxJoint.setBreakForce(this._breakForce,this._breakTorque)},e._setLocalPose=function(t,e,i){this._pxJoint.setLocalPose(t,e,i)},t}();v._xAxis=new n.Vector3(1,0,0),v._defaultVec=new n.Vector3,v._defaultQuat=new n.Quaternion;var C=function(e){function i(i){var s;return(s=e.call(this)||this)._collider=i,s._pxJoint=t.PhysXPhysics._pxPhysics.createFixedJoint(null,v._defaultVec,v._defaultQuat,i._pxActor,v._defaultVec,v._defaultQuat),s}return S.default(i,e),i}(v),A=function(e){function i(i){var s;return(s=e.call(this)||this)._axisRotationQuaternion=new n.Quaternion,s._swingOffset=new n.Vector3,s._velocity=new n.Vector3,s._collider=i,s._pxJoint=t.PhysXPhysics._pxPhysics.createRevoluteJoint(null,v._defaultVec,v._defaultQuat,i._pxActor,v._defaultVec,v._defaultQuat),s}S.default(i,e);var s=i.prototype;return s.setAxis=function(t){var e=v._xAxis,i=this._axisRotationQuaternion;e.set(1,0,0),t.normalize();var s=Math.acos(n.Vector3.dot(e,t));n.Vector3.cross(e,t,e),n.Quaternion.rotationAxisAngle(e,s,i),this._setLocalPose(0,this._swingOffset,i)},s.setSwingOffset=function(t){this._swingOffset.copyFrom(t),this._setLocalPose(1,this._swingOffset,this._axisRotationQuaternion)},s.getAngle=function(){return this._pxJoint.getAngle()},s.getVelocity=function(){var t=this._velocity;return t.copyFrom(this._pxJoint.getVelocity()),t},s.setHardLimit=function(t,e,i){this._pxJoint.setHardLimit(t,e,i)},s.setSoftLimit=function(t,e,i,s){this._pxJoint.setSoftLimit(t,e,i,s)},s.setDriveVelocity=function(t){this._pxJoint.setDriveVelocity(t)},s.setDriveForceLimit=function(t){this._pxJoint.setDriveForceLimit(t)},s.setDriveGearRatio=function(t){this._pxJoint.setDriveGearRatio(t)},s.setHingeJointFlag=function(t,e){this._pxJoint.setRevoluteJointFlag(t,e)},i}(v),F=function(e){function i(i){var s;return(s=e.call(this)||this)._swingOffset=new n.Vector3,s._collider=i,s._pxJoint=t.PhysXPhysics._pxPhysics.createDistanceJoint(null,v._defaultVec,v._defaultQuat,i._pxActor,v._defaultVec,v._defaultQuat),s._pxJoint.setDistanceJointFlag(2,!0),s._pxJoint.setDistanceJointFlag(4,!0),s._pxJoint.setDistanceJointFlag(8,!0),s}S.default(i,e);var s=i.prototype;return s.setSwingOffset=function(t){this._swingOffset.copyFrom(t),this._setLocalPose(1,t,v._defaultQuat)},s.setMinDistance=function(t){this._pxJoint.setMinDistance(t)},s.setMaxDistance=function(t){this._pxJoint.setMaxDistance(t)},s.setTolerance=function(t){this._pxJoint.setTolerance(t)},s.setStiffness=function(t){this._pxJoint.setStiffness(t)},s.setDamping=function(t){this._pxJoint.setDamping(t)},i}(v),w=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,s=this.length-1;return t!==s&&(i=e[s],e[t]=i),this.length--,i},e.garbageCollection=function(){this._elements.length=this.length},t}();(r=p||(p={}))[r.SIMULATION_SHAPE=1]="SIMULATION_SHAPE",r[r.SCENE_QUERY_SHAPE=2]="SCENE_QUERY_SHAPE",r[r.TRIGGER_SHAPE=4]="TRIGGER_SHAPE";var M=function(){function e(){this._controllers=new w,this._scale=new n.Vector3(1,1,1),this._position=new n.Vector3,this._rotation=null,this._axis=null,this._physxRotation=new n.Quaternion,this._shapeFlags=3,this._pxMaterials=[,]}var i=e.prototype;return i.setRotation=function(t){this._rotation=t,n.Quaternion.rotationYawPitchRoll(t.x,t.y,t.z,this._physxRotation),this._axis&&n.Quaternion.multiply(this._physxRotation,this._axis,this._physxRotation),this._physxRotation.normalize(),this._setLocalPose()},i.setPosition=function(t){t!==this._position&&this._position.copyFrom(t),this._setLocalPose()},i.setContactOffset=function(t){this._pxShape.setContactOffset(t);for(var e=this._controllers,i=0,s=e.length;i<s;i++)e.get(i)._pxController.setContactOffset(t)},i.setMaterial=function(t){this._pxMaterials[0]=t._pxMaterial,this._pxShape.setMaterials(this._pxMaterials)},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(e){this._shapeFlags=e,this._pxShape.setFlags(new t.PhysXPhysics._physX.PxShapeFlags(this._shapeFlags))},i._setLocalPose=function(){var t=e.transform;n.Vector3.multiply(this._position,this._scale,t.translation),t.rotation=this._physxRotation,this._pxShape.setLocalPose(t)},i._initialize=function(e,i){this._id=i,this._pxMaterials[0]=e._pxMaterial,this._pxShape=t.PhysXPhysics._pxPhysics.createShape(this._pxGeometry,e._pxMaterial,!0,new t.PhysXPhysics._physX.PxShapeFlags(this._shapeFlags)),this._pxShape.setQueryFilterData(new t.PhysXPhysics._physX.PxFilterData(i,0,0,0))},i._modifyFlag=function(t,e){this._shapeFlags=e?this._shapeFlags|t:this._shapeFlags&~t},e}();M.halfSqrt=.70710678118655,M.transform={translation:new n.Vector3,rotation:null};var X=function(e){function i(i,s,o){var a;return(a=e.call(this)||this)._halfSize=new n.Vector3,a._halfSize.set(.5*s.x,.5*s.y,.5*s.z),a._pxGeometry=new t.PhysXPhysics._physX.PxBoxGeometry(a._halfSize.x*a._scale.x,a._halfSize.y*a._scale.y,a._halfSize.z*a._scale.z),a._initialize(o,i),a._setLocalPose(),a}S.default(i,e);var s=i.prototype;return s.setSize=function(t){this._halfSize.set(.5*t.x,.5*t.y,.5*t.z),n.Vector3.multiply(this._halfSize,this._scale,i._tempHalfExtents),this._pxGeometry.halfExtents=i._tempHalfExtents,this._pxShape.setGeometry(this._pxGeometry);for(var e=this._controllers,s=0,o=e.length;s<o;s++){var a=e.get(s)._pxController;a.setHalfHeight(this._halfSize.x),a.setHalfSideExtent(this._halfSize.y),a.setHalfForwardExtent(this._halfSize.z)}},s.setWorldScale=function(t){this._scale.copyFrom(t),this._setLocalPose(),n.Vector3.multiply(this._halfSize,this._scale,i._tempHalfExtents),this._pxGeometry.halfExtents=i._tempHalfExtents,this._pxShape.setGeometry(this._pxGeometry)},i}(M);X._tempHalfExtents=new n.Vector3;var E=function(e){function i(i,s,o,a){var r;return(r=e.call(this)||this)._upAxis=1,r._radius=s,r._halfHeight=.5*o,r._axis=new n.Quaternion(0,0,M.halfSqrt,M.halfSqrt),r._physxRotation.copyFrom(r._axis),r._pxGeometry=new t.PhysXPhysics._physX.PxCapsuleGeometry(r._radius,r._halfHeight),r._initialize(a,i),r._setLocalPose(),r}S.default(i,e);var s=i.prototype;return s.setRadius=function(t){switch(this._radius=t,this._upAxis){case 0:this._pxGeometry.radius=this._radius*Math.max(this._scale.y,this._scale.z);break;case 1:this._pxGeometry.radius=this._radius*Math.max(this._scale.x,this._scale.z);break;case 2:this._pxGeometry.radius=this._radius*Math.max(this._scale.x,this._scale.y)}this._pxShape.setGeometry(this._pxGeometry);for(var e=this._controllers,i=0,s=e.length;i<s;i++)e.get(i)._pxController.setRadius(t)},s.setHeight=function(t){switch(this._halfHeight=.5*t,this._upAxis){case 0:this._pxGeometry.halfHeight=this._halfHeight*this._scale.x;break;case 1:this._pxGeometry.halfHeight=this._halfHeight*this._scale.y;break;case 2:this._pxGeometry.halfHeight=this._halfHeight*this._scale.z}this._pxShape.setGeometry(this._pxGeometry);for(var e=this._controllers,i=0,s=e.length;i<s;i++)e.get(i)._pxController.setHeight(t)},s.setUpAxis=function(t){var e=this._rotation,i=this._axis,s=this._physxRotation;switch(this._upAxis=t,this._upAxis){case 0:i.set(0,0,0,1);break;case 1:i.set(0,0,M.halfSqrt,M.halfSqrt);break;case 2:i.set(0,M.halfSqrt,0,M.halfSqrt)}e?(n.Quaternion.rotationYawPitchRoll(e.x,e.y,e.z,s),n.Quaternion.multiply(s,i,s)):s.copyFrom(i),this._setLocalPose()},s.setWorldScale=function(t){switch(this._scale.copyFrom(t),this._setLocalPose(),this._upAxis){case 0:this._pxGeometry.radius=this._radius*Math.max(t.y,t.z),this._pxGeometry.halfHeight=this._halfHeight*t.x;break;case 1:this._pxGeometry.radius=this._radius*Math.max(t.x,t.z),this._pxGeometry.halfHeight=this._halfHeight*t.y;break;case 2:this._pxGeometry.radius=this._radius*Math.max(t.x,t.y),this._pxGeometry.halfHeight=this._halfHeight*t.z}this._pxShape.setGeometry(this._pxGeometry)},i}(M);(h=f||(f={}))[h.X=0]="X",h[h.Y=1]="Y",h[h.Z=2]="Z";var R=function(){function e(){}var i=e.prototype;return i.move=function(t,e,i){return this._pxController.move(t,e,i)},i.setWorldPosition=function(t){this._pxController&&this._pxController.setPosition(t)},i.getWorldPosition=function(t){t.copyFrom(this._pxController.getPosition())},i.setStepOffset=function(t){this._pxController.setStepOffset(t)},i.setNonWalkableMode=function(t){this._pxController.setNonWalkableMode(t)},i.setUpDirection=function(t){this._pxController.setUpDirection(t)},i.setSlopeLimit=function(t){this._pxController.setSlopeLimit(t)},i.addShape=function(t){this._pxManager&&this._createPXController(this._pxManager,t),this._shape=t,t._controllers.add(this)},i.removeShape=function(t){this._destroyPXController(),this._shape=null,t._controllers.delete(this)},i.destroy=function(){this._destroyPXController()},i._createPXController=function(e,i){var s;if(m.default(i,X))(s=new t.PhysXPhysics._physX.PxBoxControllerDesc).halfHeight=i._halfSize.x,s.halfSideExtent=i._halfSize.y,s.halfForwardExtent=i._halfSize.z;else if(m.default(i,E))(s=new t.PhysXPhysics._physX.PxCapsuleControllerDesc).radius=i._radius,s.height=2*i._halfHeight,s.climbingMode=1;else throw"unsupported shape type";s.setMaterial(i._pxMaterials[0]),this._pxController=e._getControllerManager().createController(s),this._pxController.setQueryFilterData(new t.PhysXPhysics._physX.PxFilterData(i._id,0,0,0))},i._destroyPXController=function(){this._pxController&&(this._pxController.release(),this._pxController=null)},e}(),b=function(){function 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 s=t._tempTransform;return s.translation=e,s.rotation=i.normalize(),s},t}();b._tempTransform={translation:null,rotation:null},(l=y||(y={}))[l.Discrete=0]="Discrete",l[l.Continuous=1]="Continuous",l[l.ContinuousDynamic=2]="ContinuousDynamic",l[l.ContinuousSpeculative=3]="ContinuousSpeculative";var D=function(e){function i(i,s){var n,o=(n=e.call(this)||this)._transform(i,s);return n._pxActor=t.PhysXPhysics._pxPhysics.createRigidDynamic(o),n}S.default(i,e);var s=i.prototype;return s.setLinearDamping=function(t){this._pxActor.setLinearDamping(t)},s.setAngularDamping=function(t){this._pxActor.setAngularDamping(t)},s.setLinearVelocity=function(t){this._pxActor.setLinearVelocity(t,!0)},s.setAngularVelocity=function(t){this._pxActor.setAngularVelocity(t,!0)},s.setMass=function(t){this._pxActor.setMass(t)},s.setCenterOfMass=function(t){this._pxActor.setCMassLocalPose(t)},s.setInertiaTensor=function(t){this._pxActor.setMassSpaceInertiaTensor(t)},s.setMaxAngularVelocity=function(t){this._pxActor.setMaxAngularVelocity(t)},s.setMaxDepenetrationVelocity=function(t){this._pxActor.setMaxDepenetrationVelocity(t)},s.setSleepThreshold=function(t){this._pxActor.setSleepThreshold(t)},s.setSolverIterations=function(t){this._pxActor.setSolverIterationCounts(t,1)},s.setCollisionDetectionMode=function(e){switch(e){case 1:this._pxActor.setRigidBodyFlag(t.PhysXPhysics._physX.PxRigidBodyFlag.eENABLE_CCD,!0);break;case 2:this._pxActor.setRigidBodyFlag(t.PhysXPhysics._physX.PxRigidBodyFlag.eENABLE_CCD_FRICTION,!0);break;case 3:this._pxActor.setRigidBodyFlag(t.PhysXPhysics._physX.PxRigidBodyFlag.eENABLE_SPECULATIVE_CCD,!0);break;case 0:this._pxActor.setRigidBodyFlag(t.PhysXPhysics._physX.PxRigidBodyFlag.eENABLE_CCD,!1),this._pxActor.setRigidBodyFlag(t.PhysXPhysics._physX.PxRigidBodyFlag.eENABLE_CCD_FRICTION,!1),this._pxActor.setRigidBodyFlag(t.PhysXPhysics._physX.PxRigidBodyFlag.eENABLE_SPECULATIVE_CCD,!1)}},s.setIsKinematic=function(e){e?this._pxActor.setRigidBodyFlag(t.PhysXPhysics._physX.PxRigidBodyFlag.eKINEMATIC,!0):this._pxActor.setRigidBodyFlag(t.PhysXPhysics._physX.PxRigidBodyFlag.eKINEMATIC,!1)},s.setConstraints=function(t){this._pxActor.setRigidDynamicLockFlags(t)},s.addForce=function(t){this._pxActor.addForce({x:t.x,y:t.y,z:t.z})},s.addTorque=function(t){this._pxActor.addTorque({x:t.x,y:t.y,z:t.z})},s.move=function(t,e){if(e){this._pxActor.setKinematicTarget(t,e);return}var s=i._tempTranslation,o=i._tempRotation;this.getWorldTransform(s,o),m.default(t,n.Vector3)?this._pxActor.setKinematicTarget(t,o):this._pxActor.setKinematicTarget(s,t)},s.sleep=function(){return this._pxActor.putToSleep()},s.wakeUp=function(){return this._pxActor.wakeUp()},i}(b);D._tempTranslation=new n.Vector3,D._tempRotation=new n.Quaternion;var T=function(){function e(e,i,s,n,o,a){var r=this;this._pxControllerManager=null,this._currentEvents=new w,this._eventMap={},this._eventPool=[],this._onContactEnter=e,this._onContactExit=i,this._onContactStay=s,this._onTriggerEnter=n,this._onTriggerExit=o,this._onTriggerStay=a;var h=t.PhysXPhysics._physX.PxSimulationEventCallback.implement({onContactBegin:function(t,e){var i=t.getQueryFilterData().word0,s=e.getQueryFilterData().word0;r._onContactEnter(i,s)},onContactEnd:function(t,e){var i=t.getQueryFilterData().word0,s=e.getQueryFilterData().word0;r._onContactExit(i,s)},onContactPersist:function(t,e){var i=t.getQueryFilterData().word0,s=e.getQueryFilterData().word0;r._onContactStay(i,s)},onTriggerBegin:function(t,e){var i=t.getQueryFilterData().word0,s=e.getQueryFilterData().word0,n=i<s?r._getTrigger(i,s):r._getTrigger(s,i);n.state=0,r._currentEvents.add(n)},onTriggerEnd:function(t,e){var i,s=t.getQueryFilterData().word0,n=e.getQueryFilterData().word0;if(s<n){var o=r._eventMap[s];i=o[n],o[n]=void 0}else{var a=r._eventMap[n];i=a[s],a[s]=void 0}i.state=2}}),l=t.PhysXPhysics._physX.getDefaultSceneDesc(t.PhysXPhysics._pxPhysics.getTolerancesScale(),0,h);this._pxScene=t.PhysXPhysics._pxPhysics.createScene(l)}var i=e.prototype;return i.setGravity=function(t){this._pxScene.setGravity(t)},i.addColliderShape=function(t){this._eventMap[t._id]={}},i.removeColliderShape=function(t){for(var e=this._eventPool,i=this._currentEvents,s=t._id,n=i.length-1;n>=0;n--){var o=i.get(n);(o.index1==s||o.index2==s)&&(i.deleteByIndex(n),e.push(o))}delete this._eventMap[s]},i.addCollider=function(t){this._pxScene.addActor(t._pxActor,null)},i.removeCollider=function(t){this._pxScene.removeActor(t._pxActor,!0)},i.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},i.removeCharacterController=function(t){t._pxManager=null},i.update=function(t){this._simulate(t),this._fetchResults(),this._fireEvent()},i.raycast=function(i,s,n,o){var a=e._pxRaycastHit;s=Math.min(s,34e37);var r=this._pxScene.raycastSingle(i.origin,i.direction,s,a,e._pxFilterData,t.PhysXPhysics._physX.PxQueryFilterCallback.implement({preFilter:function(t,e,i){return n(e.getQueryFilterData().word0)?2:0},postFilter:function(t,e){}}));if(r&&void 0!=o){var h=e._tempPosition,l=e._tempNormal,c=a.position,_=a.normal;h.set(c.x,c.y,c.z),l.set(_.x,_.y,_.z),o(a.getShape().getQueryFilterData().word0,a.distance,h,l)}return r},i._getControllerManager=function(){var t=this._pxControllerManager;return null===t&&(this._pxControllerManager=t=this._pxScene.createControllerManager()),t},i._simulate=function(t){this._pxScene.simulate(t,!0)},i._fetchResults=function(t){void 0===t&&(t=!0),this._pxScene.fetchResults(t)},i._getTrigger=function(t,e){var i;return this._eventPool.length?((i=this._eventPool.pop()).index1=t,i.index2=e):i=new G(t,e),this._eventMap[t][e]=i,i},i._fireEvent=function(){for(var t=this._eventPool,e=this._currentEvents,i=e.length-1;i>=0;i--){var s=e.get(i);0==s.state?(this._onTriggerEnter(s.index1,s.index2),s.state=1):1==s.state?this._onTriggerStay(s.index1,s.index2):2==s.state&&(this._onTriggerExit(s.index1,s.index2),e.deleteByIndex(i),t.push(s))}},e._init=function(){e._pxRaycastHit=new t.PhysXPhysics._physX.PxRaycastHit,e._pxFilterData=new t.PhysXPhysics._physX.PxQueryFilterData,e._pxFilterData.flags=new t.PhysXPhysics._physX.PxQueryFlags(7)},e}();T._tempPosition=new n.Vector3,T._tempNormal=new n.Vector3,(c=x||(x={}))[c.STATIC=1]="STATIC",c[c.DYNAMIC=2]="DYNAMIC",c[c.PRE_FILTER=4]="PRE_FILTER",c[c.POST_FILTER=8]="POST_FILTER",c[c.ANY_HIT=16]="ANY_HIT",c[c.NO_BLOCK=32]="NO_BLOCK",(_=d||(d={}))[_.Enter=0]="Enter",_[_.Stay=1]="Stay",_[_.Exit=2]="Exit";var G=function(t,e){this.index1=t,this.index2=e},L=function(){function e(e,i,s,n,o){var a=t.PhysXPhysics._pxPhysics.createMaterial(e,i,s);a.setFrictionCombineMode(n),a.setRestitutionCombineMode(o),this._pxMaterial=a}var i=e.prototype;return i.setBounciness=function(t){this._pxMaterial.setRestitution(t)},i.setDynamicFriction=function(t){this._pxMaterial.setDynamicFriction(t)},i.setStaticFriction=function(t){this._pxMaterial.setStaticFriction(t)},i.setBounceCombine=function(t){this._pxMaterial.setRestitutionCombineMode(t)},i.setFrictionCombine=function(t){this._pxMaterial.setFrictionCombineMode(t)},i.destroy=function(){this._pxMaterial.release()},e}();(u=g||(g={}))[u.Average=0]="Average",u[u.Minimum=1]="Minimum",u[u.Multiply=2]="Multiply",u[u.Maximum=3]="Maximum";var I=function(e){function i(i,s){var n;return(n=e.call(this)||this)._pxActor=t.PhysXPhysics._pxPhysics.createRigidStatic(n._transform(i,s)),n}return S.default(i,e),i}(b),z=function(e){function i(i,s){var o;return(o=e.call(this)||this)._axis=new n.Quaternion(0,0,M.halfSqrt,M.halfSqrt),o._physxRotation.copyFrom(o._axis),o._pxGeometry=new t.PhysXPhysics._physX.PxPlaneGeometry,o._initialize(s,i),o._setLocalPose(),o}return S.default(i,e),i.prototype.setWorldScale=function(t){this._scale.copyFrom(t),this._setLocalPose()},i}(M),H=function(e){function i(i,s,n){var o;return(o=e.call(this)||this)._maxScale=1,o._radius=s,o._pxGeometry=new t.PhysXPhysics._physX.PxSphereGeometry(o._radius*o._maxScale),o._initialize(n,i),o._setLocalPose(),o}S.default(i,e);var s=i.prototype;return s.setRadius=function(t){this._radius=t,this._pxGeometry.radius=t*this._maxScale,this._pxShape.setGeometry(this._pxGeometry)},s.setWorldScale=function(t){this._scale.copyFrom(t),this._setLocalPose(),this._maxScale=Math.max(t.x,Math.max(t.x,t.y)),this._pxGeometry.radius=this._radius*this._maxScale,this._pxShape.setGeometry(this._pxGeometry)},i}(M);t.PhysXPhysics=function(){function e(){}return e.initialize=function(e){void 0===e&&(e=t.PhysXRuntimeMode.Auto);var i=new Promise(function(i,s){var n=document.createElement("script");document.body.appendChild(n),n.async=!0,n.onload=i,n.onerror=s,e==t.PhysXRuntimeMode.Auto&&(e=!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(m.default(t,WebAssembly.Module))return m.default(new WebAssembly.Instance(t),WebAssembly.Instance)}}catch(t){}return!1}()?t.PhysXRuntimeMode.JavaScript:t.PhysXRuntimeMode.WebAssembly),e==t.PhysXRuntimeMode.JavaScript?n.src="https://gw.alipayobjects.com/os/lib/oasis-engine/physics-physx/0.9.0-beta.56/libs/physx.release.js.js":e==t.PhysXRuntimeMode.WebAssembly&&(n.src="https://gw.alipayobjects.com/os/lib/oasis-engine/physics-physx/0.9.0-beta.56/libs/physx.release.js")});return new Promise(function(e,s){i.then(function(){return window.PHYSX().then(function(i){t.PhysXPhysics._init(i),console.log("PhysX loaded."),e()},s)},s).catch(s)})},e.destroy=function(){this._pxFoundation.release(),this._pxPhysics.release(),this._physX=null,this._pxFoundation=null,this._pxPhysics=null},e.createPhysicsManager=function(t,e,i,s,n,o){return new T(t,e,i,s,n,o)},e.createStaticCollider=function(t,e){return new I(t,e)},e.createDynamicCollider=function(t,e){return new D(t,e)},e.createCharacterController=function(){return new R},e.createPhysicsMaterial=function(t,e,i,s,n){return new L(t,e,i,s,n)},e.createBoxColliderShape=function(t,e,i){return new X(t,e,i)},e.createSphereColliderShape=function(t,e,i){return new H(t,e,i)},e.createPlaneColliderShape=function(t,e){return new z(t,e)},e.createCapsuleColliderShape=function(t,e,i,s){return new E(t,e,i,s)},e.createFixedJoint=function(t){return new C(t)},e.createHingeJoint=function(t){return new A(t)},e.createSpringJoint=function(t){return new F(t)},e._init=function(e){var i=e.PX_PHYSICS_VERSION,s=new e.PxDefaultErrorCallback,n=new e.PxDefaultAllocator,o=e.PxCreateFoundation(i,n,s),a=e.PxCreatePhysics(i,o,new e.PxTolerancesScale,!1,null);e.PxInitExtensions(a,null),t.PhysXPhysics._physX=e,t.PhysXPhysics._pxFoundation=o,t.PhysXPhysics._pxPhysics=a,T._init()},e}(),t.PhysXPhysics=P.default([function(t){}],t.PhysXPhysics),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 s(t,e){return(s=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function n(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&&s(t,e)}t.PhysXRuntimeMode=void 0,(_=t.PhysXRuntimeMode||(t.PhysXRuntimeMode={}))[_.Auto=0]="Auto",_[_.WebAssembly=1]="WebAssembly",_[_.JavaScript=2]="JavaScript";var o,r,a,h,c,l,_,u,p,y,f,x,d,g=function(){function t(){this._connectedAnchor=new e.Vector3,this._breakForce=Number.MAX_VALUE,this._breakTorque=Number.MAX_VALUE}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}();g._xAxis=new e.Vector3(1,0,0),g._defaultVec=new e.Vector3,g._defaultQuat=new e.Quaternion;var m=function(e){function i(i){var s;return(s=e.call(this)||this)._collider=i,s._pxJoint=t.PhysXPhysics._pxPhysics.createFixedJoint(null,g._defaultVec,g._defaultQuat,i._pxActor,g._defaultVec,g._defaultQuat),s}return n(i,e),i}(g),P=function(i){function s(s){var n;return(n=i.call(this)||this)._axisRotationQuaternion=new e.Quaternion,n._swingOffset=new e.Vector3,n._velocity=new e.Vector3,n._collider=s,n._pxJoint=t.PhysXPhysics._pxPhysics.createRevoluteJoint(null,g._defaultVec,g._defaultQuat,s._pxActor,g._defaultVec,g._defaultQuat),n}n(s,i);var o=s.prototype;return o.setAxis=function(t){var i=g._xAxis,s=this._axisRotationQuaternion;i.set(1,0,0),t.normalize();var n=Math.acos(e.Vector3.dot(i,t));e.Vector3.cross(i,t,i),e.Quaternion.rotationAxisAngle(i,n,s),this._setLocalPose(0,this._swingOffset,s)},o.setSwingOffset=function(t){this._swingOffset.copyFrom(t),this._setLocalPose(1,this._swingOffset,this._axisRotationQuaternion)},o.getAngle=function(){return this._pxJoint.getAngle()},o.getVelocity=function(){var t=this._velocity;return t.copyFrom(this._pxJoint.getVelocity()),t},o.setHardLimit=function(t,e,i){this._pxJoint.setHardLimit(t,e,i)},o.setSoftLimit=function(t,e,i,s){this._pxJoint.setSoftLimit(t,e,i,s)},o.setDriveVelocity=function(t){this._pxJoint.setDriveVelocity(t)},o.setDriveForceLimit=function(t){this._pxJoint.setDriveForceLimit(t)},o.setDriveGearRatio=function(t){this._pxJoint.setDriveGearRatio(t)},o.setHingeJointFlag=function(t,e){this._pxJoint.setRevoluteJointFlag(t,e)},s}(g),S=function(i){function s(s){var n;return(n=i.call(this)||this)._swingOffset=new e.Vector3,n._collider=s,n._pxJoint=t.PhysXPhysics._pxPhysics.createDistanceJoint(null,g._defaultVec,g._defaultQuat,s._pxActor,g._defaultVec,g._defaultQuat),n._pxJoint.setDistanceJointFlag(2,!0),n._pxJoint.setDistanceJointFlag(4,!0),n._pxJoint.setDistanceJointFlag(8,!0),n}n(s,i);var o=s.prototype;return o.setSwingOffset=function(t){this._swingOffset.copyFrom(t),this._setLocalPose(1,t,g._defaultQuat)},o.setMinDistance=function(t){this._pxJoint.setMinDistance(t)},o.setMaxDistance=function(t){this._pxJoint.setMaxDistance(t)},o.setTolerance=function(t){this._pxJoint.setTolerance(t)},o.setStiffness=function(t){this._pxJoint.setStiffness(t)},o.setDamping=function(t){this._pxJoint.setDamping(t)},s}(g),v=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,s=this.length-1;return t!==s&&(i=e[s],e[t]=i),this.length--,i},e.garbageCollection=function(){this._elements.length=this.length},t}();(o=u||(u={}))[o.SIMULATION_SHAPE=1]="SIMULATION_SHAPE",o[o.SCENE_QUERY_SHAPE=2]="SCENE_QUERY_SHAPE",o[o.TRIGGER_SHAPE=4]="TRIGGER_SHAPE";var C=function(){function i(){this._controllers=new v,this._scale=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._pxMaterials=[,]}var s=i.prototype;return s.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()},s.setPosition=function(t){t!==this._position&&this._position.copyFrom(t),this._setLocalPose()},s.setContactOffset=function(t){this._pxShape.setContactOffset(t);for(var e=this._controllers,i=0,s=e.length;i<s;i++)e.get(i)._pxController.setContactOffset(t)},s.setMaterial=function(t){this._pxMaterials[0]=t._pxMaterial,this._pxShape.setMaterials(this._pxMaterials)},s.setIsTrigger=function(t){this._modifyFlag(1,!t),this._modifyFlag(4,t),this._setShapeFlags(this._shapeFlags)},s.destroy=function(){this._pxShape.release()},s._setShapeFlags=function(e){this._shapeFlags=e,this._pxShape.setFlags(new t.PhysXPhysics._physX.PxShapeFlags(this._shapeFlags))},s._setLocalPose=function(){var t=i.transform;e.Vector3.multiply(this._position,this._scale,t.translation),t.rotation=this._physxRotation,this._pxShape.setLocalPose(t)},s._initialize=function(e,i){this._id=i,this._pxMaterials[0]=e._pxMaterial,this._pxShape=t.PhysXPhysics._pxPhysics.createShape(this._pxGeometry,e._pxMaterial,!0,new t.PhysXPhysics._physX.PxShapeFlags(this._shapeFlags)),this._pxShape.setQueryFilterData(new t.PhysXPhysics._physX.PxFilterData(i,0,0,0))},s._modifyFlag=function(t,e){this._shapeFlags=e?this._shapeFlags|t:this._shapeFlags&~t},i}();C.halfSqrt=.70710678118655,C.transform={translation:new e.Vector3,rotation:null};var A=function(i){function s(s,n,o){var r;return(r=i.call(this)||this)._halfSize=new e.Vector3,r._halfSize.set(.5*n.x,.5*n.y,.5*n.z),r._pxGeometry=new t.PhysXPhysics._physX.PxBoxGeometry(r._halfSize.x*r._scale.x,r._halfSize.y*r._scale.y,r._halfSize.z*r._scale.z),r._initialize(o,s),r._setLocalPose(),r}n(s,i);var o=s.prototype;return o.setSize=function(t){this._halfSize.set(.5*t.x,.5*t.y,.5*t.z),e.Vector3.multiply(this._halfSize,this._scale,s._tempHalfExtents),this._pxGeometry.halfExtents=s._tempHalfExtents,this._pxShape.setGeometry(this._pxGeometry);for(var i=this._controllers,n=0,o=i.length;n<o;n++){var r=i.get(n)._pxController;r.setHalfHeight(this._halfSize.x),r.setHalfSideExtent(this._halfSize.y),r.setHalfForwardExtent(this._halfSize.z)}},o.setWorldScale=function(t){this._scale.copyFrom(t),this._setLocalPose(),e.Vector3.multiply(this._halfSize,this._scale,s._tempHalfExtents),this._pxGeometry.halfExtents=s._tempHalfExtents,this._pxShape.setGeometry(this._pxGeometry)},s}(C);A._tempHalfExtents=new e.Vector3;var F=function(i){function s(s,n,o,r){var a;return(a=i.call(this)||this)._upAxis=1,a._radius=n,a._halfHeight=.5*o,a._axis=new e.Quaternion(0,0,C.halfSqrt,C.halfSqrt),a._physxRotation.copyFrom(a._axis),a._pxGeometry=new t.PhysXPhysics._physX.PxCapsuleGeometry(a._radius,a._halfHeight),a._initialize(r,s),a._setLocalPose(),a}n(s,i);var o=s.prototype;return o.setRadius=function(t){switch(this._radius=t,this._upAxis){case 0:this._pxGeometry.radius=this._radius*Math.max(this._scale.y,this._scale.z);break;case 1:this._pxGeometry.radius=this._radius*Math.max(this._scale.x,this._scale.z);break;case 2:this._pxGeometry.radius=this._radius*Math.max(this._scale.x,this._scale.y)}this._pxShape.setGeometry(this._pxGeometry);for(var e=this._controllers,i=0,s=e.length;i<s;i++)e.get(i)._pxController.setRadius(t)},o.setHeight=function(t){switch(this._halfHeight=.5*t,this._upAxis){case 0:this._pxGeometry.halfHeight=this._halfHeight*this._scale.x;break;case 1:this._pxGeometry.halfHeight=this._halfHeight*this._scale.y;break;case 2:this._pxGeometry.halfHeight=this._halfHeight*this._scale.z}this._pxShape.setGeometry(this._pxGeometry);for(var e=this._controllers,i=0,s=e.length;i<s;i++)e.get(i)._pxController.setHeight(t)},o.setUpAxis=function(t){var i=this._rotation,s=this._axis,n=this._physxRotation;switch(this._upAxis=t,this._upAxis){case 0:s.set(0,0,0,1);break;case 1:s.set(0,0,C.halfSqrt,C.halfSqrt);break;case 2:s.set(0,C.halfSqrt,0,C.halfSqrt)}i?(e.Quaternion.rotationYawPitchRoll(i.x,i.y,i.z,n),e.Quaternion.multiply(n,s,n)):n.copyFrom(s),this._setLocalPose()},o.setWorldScale=function(t){switch(this._scale.copyFrom(t),this._setLocalPose(),this._upAxis){case 0:this._pxGeometry.radius=this._radius*Math.max(t.y,t.z),this._pxGeometry.halfHeight=this._halfHeight*t.x;break;case 1:this._pxGeometry.radius=this._radius*Math.max(t.x,t.z),this._pxGeometry.halfHeight=this._halfHeight*t.y;break;case 2:this._pxGeometry.radius=this._radius*Math.max(t.x,t.y),this._pxGeometry.halfHeight=this._halfHeight*t.z}this._pxShape.setGeometry(this._pxGeometry)},s}(C);(r=p||(p={}))[r.X=0]="X",r[r.Y=1]="Y",r[r.Z=2]="Z";var M=function(){function e(){}var s=e.prototype;return s.move=function(t,e,i){return this._pxController.move(t,e,i)},s.setWorldPosition=function(t){this._pxController&&this._pxController.setPosition(t)},s.getWorldPosition=function(t){t.copyFrom(this._pxController.getPosition())},s.setStepOffset=function(t){this._pxController.setStepOffset(t)},s.setNonWalkableMode=function(t){this._pxController.setNonWalkableMode(t)},s.setUpDirection=function(t){this._pxController.setUpDirection(t)},s.setSlopeLimit=function(t){this._pxController.setSlopeLimit(t)},s.addShape=function(t){this._pxManager&&this._createPXController(this._pxManager,t),this._shape=t,t._controllers.add(this)},s.removeShape=function(t){this._destroyPXController(),this._shape=null,t._controllers.delete(this)},s.destroy=function(){this._destroyPXController()},s._createPXController=function(e,s){var n;if(i(s,A))(n=new t.PhysXPhysics._physX.PxBoxControllerDesc).halfHeight=s._halfSize.x,n.halfSideExtent=s._halfSize.y,n.halfForwardExtent=s._halfSize.z;else if(i(s,F))(n=new t.PhysXPhysics._physX.PxCapsuleControllerDesc).radius=s._radius,n.height=2*s._halfHeight,n.climbingMode=1;else throw"unsupported shape type";n.setMaterial(s._pxMaterials[0]),this._pxController=e._getControllerManager().createController(n),this._pxController.setQueryFilterData(new t.PhysXPhysics._physX.PxFilterData(s._id,0,0,0))},s._destroyPXController=function(){this._pxController&&(this._pxController.release(),this._pxController=null)},e}(),w=function(){function 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 s=t._tempTransform;return s.translation=e,s.rotation=i.normalize(),s},t}();w._tempTransform={translation:null,rotation:null},(a=y||(y={}))[a.Discrete=0]="Discrete",a[a.Continuous=1]="Continuous",a[a.ContinuousDynamic=2]="ContinuousDynamic",a[a.ContinuousSpeculative=3]="ContinuousSpeculative";var X=function(s){function o(e,i){var n,o=(n=s.call(this)||this)._transform(e,i);return n._pxActor=t.PhysXPhysics._pxPhysics.createRigidDynamic(o),n}n(o,s);var r=o.prototype;return r.setLinearDamping=function(t){this._pxActor.setLinearDamping(t)},r.setAngularDamping=function(t){this._pxActor.setAngularDamping(t)},r.setLinearVelocity=function(t){this._pxActor.setLinearVelocity(t,!0)},r.setAngularVelocity=function(t){this._pxActor.setAngularVelocity(t,!0)},r.setMass=function(t){this._pxActor.setMass(t)},r.setCenterOfMass=function(t){this._pxActor.setCMassLocalPose(t)},r.setInertiaTensor=function(t){this._pxActor.setMassSpaceInertiaTensor(t)},r.setMaxAngularVelocity=function(t){this._pxActor.setMaxAngularVelocity(t)},r.setMaxDepenetrationVelocity=function(t){this._pxActor.setMaxDepenetrationVelocity(t)},r.setSleepThreshold=function(t){this._pxActor.setSleepThreshold(t)},r.setSolverIterations=function(t){this._pxActor.setSolverIterationCounts(t,1)},r.setCollisionDetectionMode=function(e){switch(e){case 1:this._pxActor.setRigidBodyFlag(t.PhysXPhysics._physX.PxRigidBodyFlag.eENABLE_CCD,!0);break;case 2:this._pxActor.setRigidBodyFlag(t.PhysXPhysics._physX.PxRigidBodyFlag.eENABLE_CCD_FRICTION,!0);break;case 3:this._pxActor.setRigidBodyFlag(t.PhysXPhysics._physX.PxRigidBodyFlag.eENABLE_SPECULATIVE_CCD,!0);break;case 0:this._pxActor.setRigidBodyFlag(t.PhysXPhysics._physX.PxRigidBodyFlag.eENABLE_CCD,!1),this._pxActor.setRigidBodyFlag(t.PhysXPhysics._physX.PxRigidBodyFlag.eENABLE_CCD_FRICTION,!1),this._pxActor.setRigidBodyFlag(t.PhysXPhysics._physX.PxRigidBodyFlag.eENABLE_SPECULATIVE_CCD,!1)}},r.setIsKinematic=function(e){e?this._pxActor.setRigidBodyFlag(t.PhysXPhysics._physX.PxRigidBodyFlag.eKINEMATIC,!0):this._pxActor.setRigidBodyFlag(t.PhysXPhysics._physX.PxRigidBodyFlag.eKINEMATIC,!1)},r.setConstraints=function(t){this._pxActor.setRigidDynamicLockFlags(t)},r.addForce=function(t){this._pxActor.addForce({x:t.x,y:t.y,z:t.z})},r.addTorque=function(t){this._pxActor.addTorque({x:t.x,y:t.y,z:t.z})},r.move=function(t,s){if(s){this._pxActor.setKinematicTarget(t,s);return}var n=o._tempTranslation,r=o._tempRotation;this.getWorldTransform(n,r),i(t,e.Vector3)?this._pxActor.setKinematicTarget(t,r):this._pxActor.setKinematicTarget(n,t)},r.sleep=function(){return this._pxActor.putToSleep()},r.wakeUp=function(){return this._pxActor.wakeUp()},o}(w);X._tempTranslation=new e.Vector3,X._tempRotation=new e.Quaternion;var b=function(){function e(e,i,s,n,o,r){var a=this;this._pxControllerManager=null,this._currentEvents=new v,this._eventMap={},this._eventPool=[],this._onContactEnter=e,this._onContactExit=i,this._onContactStay=s,this._onTriggerEnter=n,this._onTriggerExit=o,this._onTriggerStay=r;var h=t.PhysXPhysics._physX.PxSimulationEventCallback.implement({onContactBegin:function(t,e){var i=t.getQueryFilterData().word0,s=e.getQueryFilterData().word0;a._onContactEnter(i,s)},onContactEnd:function(t,e){var i=t.getQueryFilterData().word0,s=e.getQueryFilterData().word0;a._onContactExit(i,s)},onContactPersist:function(t,e){var i=t.getQueryFilterData().word0,s=e.getQueryFilterData().word0;a._onContactStay(i,s)},onTriggerBegin:function(t,e){var i=t.getQueryFilterData().word0,s=e.getQueryFilterData().word0,n=i<s?a._getTrigger(i,s):a._getTrigger(s,i);n.state=0,a._currentEvents.add(n)},onTriggerEnd:function(t,e){var i,s=t.getQueryFilterData().word0,n=e.getQueryFilterData().word0;if(s<n){var o=a._eventMap[s];i=o[n],o[n]=void 0}else{var r=a._eventMap[n];i=r[s],r[s]=void 0}i.state=2}}),c=t.PhysXPhysics._physX.getDefaultSceneDesc(t.PhysXPhysics._pxPhysics.getTolerancesScale(),0,h);this._pxScene=t.PhysXPhysics._pxPhysics.createScene(c)}var i=e.prototype;return i.setGravity=function(t){this._pxScene.setGravity(t)},i.addColliderShape=function(t){this._eventMap[t._id]={}},i.removeColliderShape=function(t){for(var e=this._eventPool,i=this._currentEvents,s=t._id,n=i.length-1;n>=0;n--){var o=i.get(n);(o.index1==s||o.index2==s)&&(i.deleteByIndex(n),e.push(o))}delete this._eventMap[s]},i.addCollider=function(t){this._pxScene.addActor(t._pxActor,null)},i.removeCollider=function(t){this._pxScene.removeActor(t._pxActor,!0)},i.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},i.removeCharacterController=function(t){t._pxManager=null},i.update=function(t){this._simulate(t),this._fetchResults(),this._fireEvent()},i.raycast=function(i,s,n,o){var r=e._pxRaycastHit;s=Math.min(s,34e37);var a=this._pxScene.raycastSingle(i.origin,i.direction,s,r,e._pxFilterData,t.PhysXPhysics._physX.PxQueryFilterCallback.implement({preFilter:function(t,e,i){return n(e.getQueryFilterData().word0)?2:0},postFilter:function(t,e){}}));if(a&&void 0!=o){var h=e._tempPosition,c=e._tempNormal,l=r.position,_=r.normal;h.set(l.x,l.y,l.z),c.set(_.x,_.y,_.z),o(r.getShape().getQueryFilterData().word0,r.distance,h,c)}return a},i._getControllerManager=function(){var t=this._pxControllerManager;return null===t&&(this._pxControllerManager=t=this._pxScene.createControllerManager()),t},i._simulate=function(t){this._pxScene.simulate(t,!0)},i._fetchResults=function(t){void 0===t&&(t=!0),this._pxScene.fetchResults(t)},i._getTrigger=function(t,e){var i;return this._eventPool.length?((i=this._eventPool.pop()).index1=t,i.index2=e):i=new R(t,e),this._eventMap[t][e]=i,i},i._fireEvent=function(){for(var t=this._eventPool,e=this._currentEvents,i=e.length-1;i>=0;i--){var s=e.get(i);0==s.state?(this._onTriggerEnter(s.index1,s.index2),s.state=1):1==s.state?this._onTriggerStay(s.index1,s.index2):2==s.state&&(this._onTriggerExit(s.index1,s.index2),e.deleteByIndex(i),t.push(s))}},e._init=function(){e._pxRaycastHit=new t.PhysXPhysics._physX.PxRaycastHit,e._pxFilterData=new t.PhysXPhysics._physX.PxQueryFilterData,e._pxFilterData.flags=new t.PhysXPhysics._physX.PxQueryFlags(7)},e}();b._tempPosition=new e.Vector3,b._tempNormal=new e.Vector3,(h=f||(f={}))[h.STATIC=1]="STATIC",h[h.DYNAMIC=2]="DYNAMIC",h[h.PRE_FILTER=4]="PRE_FILTER",h[h.POST_FILTER=8]="POST_FILTER",h[h.ANY_HIT=16]="ANY_HIT",h[h.NO_BLOCK=32]="NO_BLOCK",(c=x||(x={}))[c.Enter=0]="Enter",c[c.Stay=1]="Stay",c[c.Exit=2]="Exit";var R=function(t,e){this.index1=t,this.index2=e},E=function(){function e(e,i,s,n,o){var r=t.PhysXPhysics._pxPhysics.createMaterial(e,i,s);r.setFrictionCombineMode(n),r.setRestitutionCombineMode(o),this._pxMaterial=r}var i=e.prototype;return i.setBounciness=function(t){this._pxMaterial.setRestitution(t)},i.setDynamicFriction=function(t){this._pxMaterial.setDynamicFriction(t)},i.setStaticFriction=function(t){this._pxMaterial.setStaticFriction(t)},i.setBounceCombine=function(t){this._pxMaterial.setRestitutionCombineMode(t)},i.setFrictionCombine=function(t){this._pxMaterial.setFrictionCombineMode(t)},i.destroy=function(){this._pxMaterial.release()},e}();(l=d||(d={}))[l.Average=0]="Average",l[l.Minimum=1]="Minimum",l[l.Multiply=2]="Multiply",l[l.Maximum=3]="Maximum";var D=function(e){function i(i,s){var n;return(n=e.call(this)||this)._pxActor=t.PhysXPhysics._pxPhysics.createRigidStatic(n._transform(i,s)),n}return n(i,e),i}(w),T=function(i){function s(s,n){var o;return(o=i.call(this)||this)._axis=new e.Quaternion(0,0,C.halfSqrt,C.halfSqrt),o._physxRotation.copyFrom(o._axis),o._pxGeometry=new t.PhysXPhysics._physX.PxPlaneGeometry,o._initialize(n,s),o._setLocalPose(),o}return n(s,i),s.prototype.setWorldScale=function(t){this._scale.copyFrom(t),this._setLocalPose()},s}(C),G=function(e){function i(i,s,n){var o;return(o=e.call(this)||this)._maxScale=1,o._radius=s,o._pxGeometry=new t.PhysXPhysics._physX.PxSphereGeometry(o._radius*o._maxScale),o._initialize(n,i),o._setLocalPose(),o}n(i,e);var s=i.prototype;return s.setRadius=function(t){this._radius=t,this._pxGeometry.radius=t*this._maxScale,this._pxShape.setGeometry(this._pxGeometry)},s.setWorldScale=function(t){this._scale.copyFrom(t),this._setLocalPose(),this._maxScale=Math.max(t.x,Math.max(t.x,t.y)),this._pxGeometry.radius=this._radius*this._maxScale,this._pxShape.setGeometry(this._pxGeometry)},i}(C);t.PhysXPhysics=function(){function e(){}return e.initialize=function(e){void 0===e&&(e=t.PhysXRuntimeMode.Auto);var s=new Promise(function(s,n){var o=document.createElement("script");document.body.appendChild(o),o.async=!0,o.onload=s,o.onerror=n,e==t.PhysXRuntimeMode.Auto&&(e=!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),e==t.PhysXRuntimeMode.JavaScript?o.src="https://gw.alipayobjects.com/os/lib/oasis-engine/physics-physx/0.9.0-beta.56/libs/physx.release.js.js":e==t.PhysXRuntimeMode.WebAssembly&&(o.src="https://gw.alipayobjects.com/os/lib/oasis-engine/physics-physx/0.9.0-beta.56/libs/physx.release.js")});return new Promise(function(e,i){s.then(function(){return window.PHYSX().then(function(i){t.PhysXPhysics._init(i),console.log("PhysX loaded."),e()},i)},i).catch(i)})},e.destroy=function(){this._pxFoundation.release(),this._pxPhysics.release(),this._physX=null,this._pxFoundation=null,this._pxPhysics=null},e.createPhysicsManager=function(t,e,i,s,n,o){return new b(t,e,i,s,n,o)},e.createStaticCollider=function(t,e){return new D(t,e)},e.createDynamicCollider=function(t,e){return new X(t,e)},e.createCharacterController=function(){return new M},e.createPhysicsMaterial=function(t,e,i,s,n){return new E(t,e,i,s,n)},e.createBoxColliderShape=function(t,e,i){return new A(t,e,i)},e.createSphereColliderShape=function(t,e,i){return new G(t,e,i)},e.createPlaneColliderShape=function(t,e){return new T(t,e)},e.createCapsuleColliderShape=function(t,e,i,s){return new F(t,e,i,s)},e.createFixedJoint=function(t){return new m(t)},e.createHingeJoint=function(t){return new P(t)},e.createSpringJoint=function(t){return new S(t)},e._init=function(e){var i=e.PX_PHYSICS_VERSION,s=new e.PxDefaultErrorCallback,n=new e.PxDefaultAllocator,o=e.PxCreateFoundation(i,n,s),r=e.PxCreatePhysics(i,o,new e.PxTolerancesScale,!1,null);e.PxInitExtensions(r,null),t.PhysXPhysics._physX=e,t.PhysXPhysics._pxFoundation=o,t.PhysXPhysics._pxPhysics=r,b._init()},e}(),t.PhysXPhysics=function(t,e,i,s){var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r}([function(t){}],t.PhysXPhysics),Object.defineProperty(t,"__esModule",{value:!0})});
|
package/dist/main.js
CHANGED
|
@@ -2,23 +2,65 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var _instanceof = require('@swc/helpers/src/_instanceof.mjs');
|
|
6
|
-
var _ts_decorate = require('@swc/helpers/src/_ts_decorate.mjs');
|
|
7
|
-
var _inherits = require('@swc/helpers/src/_inherits.mjs');
|
|
8
5
|
var engine = require('@galacean/engine');
|
|
9
6
|
|
|
10
|
-
function
|
|
7
|
+
function _instanceof(left, right) {
|
|
8
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
9
|
+
return !!right[Symbol.hasInstance](left);
|
|
10
|
+
} else return left instanceof right;
|
|
11
|
+
}
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
/******************************************************************************
|
|
14
|
+
Copyright (c) Microsoft Corporation.
|
|
15
|
+
|
|
16
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
17
|
+
purpose with or without fee is hereby granted.
|
|
18
|
+
|
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
20
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
21
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
22
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
23
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
24
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
25
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
26
|
+
***************************************************************************** */
|
|
27
|
+
|
|
28
|
+
function __decorate(decorators, target, key, desc) {
|
|
29
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
30
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
31
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
32
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
33
|
+
}
|
|
15
34
|
|
|
35
|
+
/**
|
|
36
|
+
* PhysX runtime mode.
|
|
37
|
+
*/ exports.PhysXRuntimeMode = void 0;
|
|
16
38
|
(function(PhysXRuntimeMode) {
|
|
17
39
|
PhysXRuntimeMode[PhysXRuntimeMode[/** Use webAssembly mode first, if WebAssembly mode is not supported, roll back to JavaScript mode. */ "Auto"] = 0] = "Auto";
|
|
18
40
|
PhysXRuntimeMode[PhysXRuntimeMode[/** WebAssembly mode. */ "WebAssembly"] = 1] = "WebAssembly";
|
|
19
41
|
PhysXRuntimeMode[PhysXRuntimeMode[/** JavaScript mode. */ "JavaScript"] = 2] = "JavaScript";
|
|
20
42
|
})(exports.PhysXRuntimeMode || (exports.PhysXRuntimeMode = {}));
|
|
21
43
|
|
|
44
|
+
function _set_prototype_of(o, p) {
|
|
45
|
+
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
46
|
+
o.__proto__ = p;
|
|
47
|
+
|
|
48
|
+
return o;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
return _set_prototype_of(o, p);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function _inherits(subClass, superClass) {
|
|
55
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
56
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
|
|
60
|
+
|
|
61
|
+
if (superClass) _set_prototype_of(subClass, superClass);
|
|
62
|
+
}
|
|
63
|
+
|
|
22
64
|
/**
|
|
23
65
|
* a base interface providing common functionality for PhysX joints
|
|
24
66
|
*/ var PhysXJoint = /*#__PURE__*/ function() {
|
|
@@ -82,14 +124,20 @@ var _inherits__default = /*#__PURE__*/_interopDefaultLegacy(_inherits);
|
|
|
82
124
|
};
|
|
83
125
|
return PhysXJoint;
|
|
84
126
|
}();
|
|
85
|
-
|
|
86
|
-
PhysXJoint.
|
|
87
|
-
|
|
127
|
+
(function() {
|
|
128
|
+
PhysXJoint._xAxis = new engine.Vector3(1, 0, 0);
|
|
129
|
+
})();
|
|
130
|
+
(function() {
|
|
131
|
+
PhysXJoint._defaultVec = new engine.Vector3();
|
|
132
|
+
})();
|
|
133
|
+
(function() {
|
|
134
|
+
PhysXJoint._defaultQuat = new engine.Quaternion();
|
|
135
|
+
})();
|
|
88
136
|
|
|
89
137
|
/**
|
|
90
138
|
* A fixed joint permits no relative movement between two colliders. ie the bodies are glued together.
|
|
91
139
|
*/ var PhysXFixedJoint = /*#__PURE__*/ function(PhysXJoint1) {
|
|
92
|
-
|
|
140
|
+
_inherits(PhysXFixedJoint, PhysXJoint1);
|
|
93
141
|
function PhysXFixedJoint(collider) {
|
|
94
142
|
var _this;
|
|
95
143
|
_this = PhysXJoint1.call(this) || this;
|
|
@@ -103,7 +151,7 @@ PhysXJoint._defaultQuat = new engine.Quaternion();
|
|
|
103
151
|
/**
|
|
104
152
|
* A joint which behaves in a similar way to a hinge or axle.
|
|
105
153
|
*/ var PhysXHingeJoint = /*#__PURE__*/ function(PhysXJoint1) {
|
|
106
|
-
|
|
154
|
+
_inherits(PhysXHingeJoint, PhysXJoint1);
|
|
107
155
|
function PhysXHingeJoint(collider) {
|
|
108
156
|
var _this;
|
|
109
157
|
_this = PhysXJoint1.call(this) || this;
|
|
@@ -181,7 +229,7 @@ PhysXJoint._defaultQuat = new engine.Quaternion();
|
|
|
181
229
|
/**
|
|
182
230
|
* a joint that maintains an upper or lower bound (or both) on the distance between two points on different objects
|
|
183
231
|
*/ var PhysXSpringJoint = /*#__PURE__*/ function(PhysXJoint1) {
|
|
184
|
-
|
|
232
|
+
_inherits(PhysXSpringJoint, PhysXJoint1);
|
|
185
233
|
function PhysXSpringJoint(collider) {
|
|
186
234
|
var _this;
|
|
187
235
|
_this = PhysXJoint1.call(this) || this;
|
|
@@ -362,16 +410,20 @@ var ShapeFlag;
|
|
|
362
410
|
};
|
|
363
411
|
return PhysXColliderShape;
|
|
364
412
|
}();
|
|
365
|
-
|
|
366
|
-
PhysXColliderShape.
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
413
|
+
(function() {
|
|
414
|
+
PhysXColliderShape.halfSqrt = 0.70710678118655;
|
|
415
|
+
})();
|
|
416
|
+
(function() {
|
|
417
|
+
PhysXColliderShape.transform = {
|
|
418
|
+
translation: new engine.Vector3(),
|
|
419
|
+
rotation: null
|
|
420
|
+
};
|
|
421
|
+
})();
|
|
370
422
|
|
|
371
423
|
/**
|
|
372
424
|
* Box collider shape in PhysX.
|
|
373
425
|
*/ var PhysXBoxColliderShape = /*#__PURE__*/ function(PhysXColliderShape) {
|
|
374
|
-
|
|
426
|
+
_inherits(PhysXBoxColliderShape, PhysXColliderShape);
|
|
375
427
|
function PhysXBoxColliderShape(uniqueID, size, material) {
|
|
376
428
|
var _this;
|
|
377
429
|
_this = PhysXColliderShape.call(this) || this;
|
|
@@ -409,12 +461,14 @@ PhysXColliderShape.transform = {
|
|
|
409
461
|
};
|
|
410
462
|
return PhysXBoxColliderShape;
|
|
411
463
|
}(PhysXColliderShape);
|
|
412
|
-
|
|
464
|
+
(function() {
|
|
465
|
+
PhysXBoxColliderShape._tempHalfExtents = new engine.Vector3();
|
|
466
|
+
})();
|
|
413
467
|
|
|
414
468
|
/**
|
|
415
469
|
* Capsule collider shape in PhysX.
|
|
416
470
|
*/ var PhysXCapsuleColliderShape = /*#__PURE__*/ function(PhysXColliderShape1) {
|
|
417
|
-
|
|
471
|
+
_inherits(PhysXCapsuleColliderShape, PhysXColliderShape1);
|
|
418
472
|
function PhysXCapsuleColliderShape(uniqueID, radius, height, material) {
|
|
419
473
|
var _this;
|
|
420
474
|
_this = PhysXColliderShape1.call(this) || this;
|
|
@@ -590,12 +644,12 @@ var /**
|
|
|
590
644
|
* @internal
|
|
591
645
|
*/ _proto._createPXController = function _createPXController(pxManager, shape) {
|
|
592
646
|
var desc;
|
|
593
|
-
if (
|
|
647
|
+
if (_instanceof(shape, PhysXBoxColliderShape)) {
|
|
594
648
|
desc = new exports.PhysXPhysics._physX.PxBoxControllerDesc();
|
|
595
649
|
desc.halfHeight = shape._halfSize.x;
|
|
596
650
|
desc.halfSideExtent = shape._halfSize.y;
|
|
597
651
|
desc.halfForwardExtent = shape._halfSize.z;
|
|
598
|
-
} else if (
|
|
652
|
+
} else if (_instanceof(shape, PhysXCapsuleColliderShape)) {
|
|
599
653
|
desc = new exports.PhysXPhysics._physX.PxCapsuleControllerDesc();
|
|
600
654
|
desc.radius = shape._radius;
|
|
601
655
|
desc.height = shape._halfHeight * 2;
|
|
@@ -660,10 +714,12 @@ var /**
|
|
|
660
714
|
};
|
|
661
715
|
return PhysXCollider;
|
|
662
716
|
}();
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
717
|
+
(function() {
|
|
718
|
+
PhysXCollider._tempTransform = {
|
|
719
|
+
translation: null,
|
|
720
|
+
rotation: null
|
|
721
|
+
};
|
|
722
|
+
})();
|
|
667
723
|
|
|
668
724
|
var CollisionDetectionMode;
|
|
669
725
|
(function(CollisionDetectionMode) {
|
|
@@ -675,7 +731,7 @@ var CollisionDetectionMode;
|
|
|
675
731
|
/**
|
|
676
732
|
* A dynamic collider can act with self-defined movement or physical force
|
|
677
733
|
*/ var PhysXDynamicCollider = /*#__PURE__*/ function(PhysXCollider) {
|
|
678
|
-
|
|
734
|
+
_inherits(PhysXDynamicCollider, PhysXCollider);
|
|
679
735
|
function PhysXDynamicCollider(position, rotation) {
|
|
680
736
|
var _this;
|
|
681
737
|
_this = PhysXCollider.call(this) || this;
|
|
@@ -802,7 +858,7 @@ var CollisionDetectionMode;
|
|
|
802
858
|
var tempTranslation = PhysXDynamicCollider._tempTranslation;
|
|
803
859
|
var tempRotation = PhysXDynamicCollider._tempRotation;
|
|
804
860
|
this.getWorldTransform(tempTranslation, tempRotation);
|
|
805
|
-
if (
|
|
861
|
+
if (_instanceof(positionOrRotation, engine.Vector3)) {
|
|
806
862
|
this._pxActor.setKinematicTarget(positionOrRotation, tempRotation);
|
|
807
863
|
} else {
|
|
808
864
|
this._pxActor.setKinematicTarget(tempTranslation, positionOrRotation);
|
|
@@ -820,8 +876,12 @@ var CollisionDetectionMode;
|
|
|
820
876
|
};
|
|
821
877
|
return PhysXDynamicCollider;
|
|
822
878
|
}(PhysXCollider);
|
|
823
|
-
|
|
824
|
-
PhysXDynamicCollider.
|
|
879
|
+
(function() {
|
|
880
|
+
PhysXDynamicCollider._tempTranslation = new engine.Vector3();
|
|
881
|
+
})();
|
|
882
|
+
(function() {
|
|
883
|
+
PhysXDynamicCollider._tempRotation = new engine.Quaternion();
|
|
884
|
+
})();
|
|
825
885
|
|
|
826
886
|
/**
|
|
827
887
|
* A manager is a collection of colliders and constraints which can interact.
|
|
@@ -1021,8 +1081,12 @@ PhysXDynamicCollider._tempRotation = new engine.Quaternion();
|
|
|
1021
1081
|
};
|
|
1022
1082
|
return PhysXPhysicsManager;
|
|
1023
1083
|
}();
|
|
1024
|
-
|
|
1025
|
-
PhysXPhysicsManager.
|
|
1084
|
+
(function() {
|
|
1085
|
+
PhysXPhysicsManager._tempPosition = new engine.Vector3();
|
|
1086
|
+
})();
|
|
1087
|
+
(function() {
|
|
1088
|
+
PhysXPhysicsManager._tempNormal = new engine.Vector3();
|
|
1089
|
+
})();
|
|
1026
1090
|
var /**
|
|
1027
1091
|
* Filtering flags for scene queries.
|
|
1028
1092
|
*/ QueryFlag;
|
|
@@ -1105,7 +1169,7 @@ var /**
|
|
|
1105
1169
|
* A static collider component that will not move.
|
|
1106
1170
|
* @remarks Mostly used for object which always stays at the same place and never moves around.
|
|
1107
1171
|
*/ var PhysXStaticCollider = /*#__PURE__*/ function(PhysXCollider) {
|
|
1108
|
-
|
|
1172
|
+
_inherits(PhysXStaticCollider, PhysXCollider);
|
|
1109
1173
|
function PhysXStaticCollider(position, rotation) {
|
|
1110
1174
|
var _this;
|
|
1111
1175
|
_this = PhysXCollider.call(this) || this;
|
|
@@ -1118,7 +1182,7 @@ var /**
|
|
|
1118
1182
|
/**
|
|
1119
1183
|
* Plane collider shape in PhysX.
|
|
1120
1184
|
*/ var PhysXPlaneColliderShape = /*#__PURE__*/ function(PhysXColliderShape1) {
|
|
1121
|
-
|
|
1185
|
+
_inherits(PhysXPlaneColliderShape, PhysXColliderShape1);
|
|
1122
1186
|
function PhysXPlaneColliderShape(uniqueID, material) {
|
|
1123
1187
|
var _this;
|
|
1124
1188
|
_this = PhysXColliderShape1.call(this) || this;
|
|
@@ -1142,7 +1206,7 @@ var /**
|
|
|
1142
1206
|
/**
|
|
1143
1207
|
* Sphere collider shape in PhysX.
|
|
1144
1208
|
*/ var PhysXSphereColliderShape = /*#__PURE__*/ function(PhysXColliderShape) {
|
|
1145
|
-
|
|
1209
|
+
_inherits(PhysXSphereColliderShape, PhysXColliderShape);
|
|
1146
1210
|
function PhysXSphereColliderShape(uniqueID, radius, material) {
|
|
1147
1211
|
var _this;
|
|
1148
1212
|
_this = PhysXColliderShape.call(this) || this;
|
|
@@ -1200,7 +1264,7 @@ exports.PhysXPhysics = /*#__PURE__*/ function() {
|
|
|
1200
1264
|
try {
|
|
1201
1265
|
if (typeof WebAssembly === "object" && typeof WebAssembly.instantiate === "function") {
|
|
1202
1266
|
var module = new WebAssembly.Module(Uint8Array.of(0x0, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00));
|
|
1203
|
-
if (
|
|
1267
|
+
if (_instanceof(module, WebAssembly.Module)) return _instanceof(new WebAssembly.Instance(module), WebAssembly.Instance);
|
|
1204
1268
|
}
|
|
1205
1269
|
} catch (e) {}
|
|
1206
1270
|
return false;
|
|
@@ -1310,7 +1374,7 @@ exports.PhysXPhysics = /*#__PURE__*/ function() {
|
|
|
1310
1374
|
};
|
|
1311
1375
|
return PhysXPhysics1;
|
|
1312
1376
|
}();
|
|
1313
|
-
exports.PhysXPhysics =
|
|
1377
|
+
exports.PhysXPhysics = __decorate([
|
|
1314
1378
|
StaticInterfaceImplement()
|
|
1315
1379
|
], exports.PhysXPhysics);
|
|
1316
1380
|
//# sourceMappingURL=main.js.map
|