@galacean/engine-physics-physx 1.6.2 → 1.6.3
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 +1 -1
- package/dist/browser.min.js +1 -1
- package/dist/main.js +1 -1
- package/dist/module.js +1 -1
- package/package.json +4 -4
package/dist/browser.js
CHANGED
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 s(t,e){return(s=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function o(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)}var n,r,a=/*#__PURE__*/function(){function t(t){this._controllers=new e.DisorderedArray,this._contractOffset=.02,this._worldScale=new e.Vector3(1,1,1),this._position=new e.Vector3,this._rotation=new e.Vector3,this._axis=null,this._physXRotation=new e.Quaternion,this._shapeFlags=3,this._physXPhysics=t}var i=t.prototype;return i.setRotation=function(t){var i=this._rotation.set(e.MathUtil.degreeToRadian(t.x),e.MathUtil.degreeToRadian(t.y),e.MathUtil.degreeToRadian(t.z));e.Quaternion.rotationYawPitchRoll(i.y,i.x,i.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,s=e.length;i<s;i++)e.get(i)._updateShapePosition(this._position,this._worldScale);this._setLocalPose()},i.setWorldScale=function(t){this._worldScale.set(Math.abs(t.x),Math.abs(t.y),Math.abs(t.z)),this._setLocalPose();for(var e=this._controllers,i=0,s=e.length;i<s;i++)e.get(i)._updateShapePosition(this._position,this._worldScale)},i.setContactOffset=function(t){this._contractOffset=t;var e=this._controllers;if(e.length)for(var i,s=0,o=e.length;s<o;s++)null==(i=e.get(s)._pxController)||i.setContactOffset(t);else this._pxShape.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.pointDistance=function(e){var i=this._pxGeometry.pointDistance(this._pxShape.getGlobalPose(),e),s=i.closestPoint,o=t._tempVector4;return o.set(s.x,s.y,s.z,i.distance),o},i.destroy=function(){this._pxShape.release(),this._pxGeometry.delete()},i._setShapeFlags=function(t){this._shapeFlags=t;var e=new this._physXPhysics._physX.PxShapeFlags(this._shapeFlags);this._pxShape.setFlags(e),e.delete()},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;var i=new this._physXPhysics._physX.PxShapeFlags(this._shapeFlags);this._pxShape=this._physXPhysics._pxPhysics.createShape(this._pxGeometry,t._pxMaterial,!0,i),i.delete(),this._pxShape.setUUID(e)},i._modifyFlag=function(t,e){this._shapeFlags=e?this._shapeFlags|t:this._shapeFlags&~t},t}();a.halfSqrt=.70710678118655,a.transform={translation:new e.Vector3,rotation:null},a._tempVector4=new e.Vector4;var l=/*#__PURE__*/function(t){function i(i,s,o,n){(r=t.call(this,i)||this)._halfSize=new e.Vector3;var r,a=r._halfSize;return a.set(.5*o.x,.5*o.y,.5*o.z),r._pxGeometry=new i._physX.PxBoxGeometry(a.x,a.y,a.z),r._initialize(n,s),r._setLocalPose(),r}o(i,t);var s=i.prototype;return s.setSize=function(t){var s=this._halfSize,o=i._tempHalfExtents;s.set(.5*t.x,.5*t.y,.5*t.z),e.Vector3.multiply(s,this._worldScale,o),this._pxGeometry.halfExtents=o,this._pxShape.setGeometry(this._pxGeometry),this._updateController(o)},s.setRotation=function(e){t.prototype.setRotation.call(this,e),this._controllers.length>0&&console.warn("Box character controller `rotation` is not supported in PhysX and will be ignored")},s.setWorldScale=function(s){t.prototype.setWorldScale.call(this,s);var o=i._tempHalfExtents;e.Vector3.multiply(this._halfSize,this._worldScale,o),this._pxGeometry.halfExtents=o,this._pxShape.setGeometry(this._pxGeometry),this._updateController(o)},s._updateController=function(t){for(var e=this._controllers,i=0,s=e.length;i<s;i++){var o=e.get(i)._pxController;o&&(o.setHalfHeight(t.y),o.setHalfSideExtent(t.x),o.setHalfForwardExtent(t.z))}},i}(a);l._tempHalfExtents=new e.Vector3;var h=/*#__PURE__*/function(t){function i(i,s,o,n,r){var l;return(l=t.call(this,i)||this)._upAxis=1,l._radius=o,l._halfHeight=.5*n,l._axis=new e.Quaternion(0,0,a.halfSqrt,a.halfSqrt),l._physXRotation.copyFrom(l._axis),l._pxGeometry=new i._physX.PxCapsuleGeometry(o,l._halfHeight),l._initialize(r,s),l._setLocalPose(),l}o(i,t);var s=i.prototype;return s.setRadius=function(t){this._radius=t;var e,i=this._worldScale;switch(this._upAxis){case 0:this._pxGeometry.radius=this._radius*Math.max(i.y,i.z);break;case 1:this._pxGeometry.radius=this._radius*Math.max(i.x,i.z);break;case 2:this._pxGeometry.radius=this._radius*Math.max(i.x,i.y)}this._pxShape.setGeometry(this._pxGeometry);for(var s=this._pxGeometry.radius,o=this._controllers,n=0,r=o.length;n<r;n++)null==(e=o.get(n)._pxController)||e.setRadius(s)},s.setHeight=function(t){this._halfHeight=.5*t;var e,i=this._worldScale;switch(this._upAxis){case 0:this._pxGeometry.halfHeight=this._halfHeight*i.x;break;case 1:this._pxGeometry.halfHeight=this._halfHeight*i.y;break;case 2:this._pxGeometry.halfHeight=this._halfHeight*i.z}this._pxShape.setGeometry(this._pxGeometry);for(var s=2*this._pxGeometry.halfHeight,o=this._controllers,n=0,r=o.length;n<r;n++)null==(e=o.get(n)._pxController)||e.setHeight(s)},s.setRotation=function(e){t.prototype.setRotation.call(this,e),this._controllers.length>0&&console.warn("Capsule character controller `rotation` is not supported in PhysX and will be ignored")},s.setUpAxis=function(t){var i=this._rotation,s=this._axis,o=this._physXRotation;switch(this._upAxis=t,this._upAxis){case 0:s.set(0,0,0,1);break;case 1:s.set(0,0,a.halfSqrt,a.halfSqrt);break;case 2:s.set(0,a.halfSqrt,0,a.halfSqrt)}i?(e.Quaternion.rotationYawPitchRoll(i.y,i.x,i.z,o),e.Quaternion.multiply(o,s,o)):o.copyFrom(s),this._setLocalPose(),this._controllers.length>0&&console.warn("Capsule character controller `upAxis` is not supported in PhysX and will be ignored")},s.setWorldScale=function(e){t.prototype.setWorldScale.call(this,e);var i=this._worldScale,s=this._pxGeometry;switch(this._upAxis){case 0:s.radius=this._radius*Math.max(i.y,i.z),s.halfHeight=this._halfHeight*i.x;break;case 1:s.radius=this._radius*Math.max(i.x,i.z),s.halfHeight=this._halfHeight*i.y;break;case 2:s.radius=this._radius*Math.max(i.x,i.y),s.halfHeight=this._halfHeight*i.z}this._pxShape.setGeometry(s);for(var o=s.radius,n=2*s.halfHeight,r=this._controllers,a=0,l=r.length;a<l;a++){var h=r.get(a)._pxController;h&&(h.setRadius(o),h.setHeight(n))}},i}(a),c=((n={})[n.X=0]="X",n[n.Y=1]="Y",n[n.Z=2]="Z",n),_=/*#__PURE__*/function(){function t(t){this._scene=null,this._shapeScaledPosition=new e.Vector3,this._worldPosition=null,this._physXPhysics=t}var s=t.prototype;return s.move=function(t,e,i){var s,o;return null!=(o=null==(s=this._pxController)?void 0:s.move(t,e,i))?o:0},s.setWorldPosition=function(t){this._worldPosition=t,this._updateNativePosition()},s.getWorldPosition=function(t){this._pxController&&(t.copyFrom(this._pxController.getPosition()),t.subtract(this._shapeScaledPosition))},s.setStepOffset=function(t){var e;null==(e=this._pxController)||e.setStepOffset(t)},s.setNonWalkableMode=function(t){var e;null==(e=this._pxController)||e.setNonWalkableMode(t)},s.setUpDirection=function(t){var e;null==(e=this._pxController)||e.setUpDirection(t)},s.setSlopeLimit=function(t){var e;null==(e=this._pxController)||e.setSlopeLimit(Math.cos(t*Math.PI/180))},s.addShape=function(t){var e,i;this._updateShapePosition(t._position,t._worldScale),this._pxManager&&this._createPXController(this._pxManager,t),this._shape=t,t._controllers.add(this),null==(e=this._pxController)||e.setContactOffset(t._contractOffset),null==(i=this._scene)||i._addColliderShape(t._id)},s.removeShape=function(t){var e;this._destroyPXController(),this._shape=null,t._controllers.delete(this),null==(e=this._scene)||e._removeColliderShape(t._id)},s.setCollisionLayer=function(t){var e,i=null==(e=this._pxController)?void 0:e.getActor();i&&this._physXPhysics._physX.setGroup(i,t)},s.destroy=function(){this._destroyPXController()},s._createPXController=function(t,e){var s;if(i(e,l))(s=new this._physXPhysics._physX.PxBoxControllerDesc).halfHeight=e._halfSize.y,s.halfSideExtent=e._halfSize.x,s.halfForwardExtent=e._halfSize.z,e._rotation.lengthSquared()>0&&console.warn("Box character controller `rotation` is not supported in PhysX and will be ignored");else if(i(e,h))(s=new this._physXPhysics._physX.PxCapsuleControllerDesc).radius=e._radius,s.height=2*e._halfHeight,s.climbingMode=1,e._rotation.lengthSquared()>0&&console.warn("Capsule character controller `rotation` is not supported in PhysX and will be ignored"),e._upAxis!==c.Y&&console.warn("Capsule character controller `upAxis` is not supported in PhysX and will be ignored");else throw"unsupported shape type";s.setMaterial(e._pxMaterial),this._pxController=t._getControllerManager().createController(s),s.delete(),this._pxController.setUUID(e._id),this._updateNativePosition()},s._destroyPXController=function(){this._pxController&&(this._pxController.release(),this._pxController=null)},s._updateShapePosition=function(t,i){e.Vector3.multiply(t,i,this._shapeScaledPosition),this._updateNativePosition()},s._updateNativePosition=function(){var i=this._worldPosition;this._pxController&&i&&(e.Vector3.add(i,this._shapeScaledPosition,t._tempVec),this._pxController.setPosition(t._tempVec))},t}();_._tempVec=new e.Vector3;var p=/*#__PURE__*/function(){function t(t){this._scene=null,this._shapes=[],this._physXPhysics=t}var e=t.prototype;return e.addShape=function(t){var e;this._pxActor.attachShape(t._pxShape),this._shapes.push(t),null==(e=this._scene)||e._addColliderShape(t._id)},e.removeShape=function(t){this._pxActor.detachShape(t._pxShape,!0);var e,i=this._shapes;i.splice(i.indexOf(t),1),null==(e=this._scene)||e._removeColliderShape(t._id)},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.setCollisionLayer=function(t){this._physXPhysics._physX.setGroup(this._pxActor,t)},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}();p._tempTransform={translation:null,rotation:null};var u=/*#__PURE__*/function(t){function s(e,i,s){var o,n=(o=t.call(this,e)||this)._transform(i,s);return o._pxActor=e._pxPhysics.createRigidDynamic(n),o}o(s,t);var n=s.prototype;return n.setLinearDamping=function(t){this._pxActor.setLinearDamping(t)},n.setAngularDamping=function(t){this._pxActor.setAngularDamping(t)},n.getLinearVelocity=function(t){var e=this._pxActor.getLinearVelocity();return t.set(e.x,e.y,e.z)},n.setLinearVelocity=function(t){this._pxActor.setLinearVelocity(t,!0)},n.getAngularVelocity=function(t){var i=this._pxActor.getAngularVelocity();return t.set(e.MathUtil.radianToDegree(i.x),e.MathUtil.radianToDegree(i.y),e.MathUtil.radianToDegree(i.z))},n.setAngularVelocity=function(t){s._tempTranslation.set(e.MathUtil.degreeToRadian(t.x),e.MathUtil.degreeToRadian(t.y),e.MathUtil.degreeToRadian(t.z)),this._pxActor.setAngularVelocity(s._tempTranslation,!0)},n.setMass=function(t){this._pxActor.setMass(t)},n.getCenterOfMass=function(t){var e=this._pxActor.getCMassLocalPose().translation;return t.set(e.x,e.y,e.z)},n.setCenterOfMass=function(t){this._pxActor.setCMassLocalPose(t)},n.setInertiaTensor=function(t){this._pxActor.setMassSpaceInertiaTensor(t)},n.getInertiaTensor=function(t){var e=this._pxActor.getMassSpaceInertiaTensor();return t.set(e.x,e.y,e.z)},n.setMassAndUpdateInertia=function(t){this._pxActor.setMassAndUpdateInertia(t)},n.setMaxAngularVelocity=function(t){this._pxActor.setMaxAngularVelocity(e.MathUtil.degreeToRadian(t))},n.setMaxDepenetrationVelocity=function(t){this._pxActor.setMaxDepenetrationVelocity(t)},n.setSleepThreshold=function(t){this._pxActor.setSleepThreshold(t)},n.setSolverIterations=function(t){this._pxActor.setSolverIterationCounts(t,1)},n.setCollisionDetectionMode=function(t){var e=this._physXPhysics._physX;switch(t){case 1:this._pxActor.setRigidBodyFlag(e.PxRigidBodyFlag.eENABLE_CCD,!0);break;case 2:this._pxActor.setRigidBodyFlag(e.PxRigidBodyFlag.eENABLE_CCD,!1),this._pxActor.setRigidBodyFlag(e.PxRigidBodyFlag.eENABLE_CCD_FRICTION,!0);break;case 3:this._pxActor.setRigidBodyFlag(e.PxRigidBodyFlag.eENABLE_CCD,!1),this._pxActor.setRigidBodyFlag(e.PxRigidBodyFlag.eENABLE_SPECULATIVE_CCD,!0);break;case 0: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)}},n.setUseGravity=function(t){this._pxActor.setActorFlag(this._physXPhysics._physX.PxActorFlag.eDISABLE_GRAVITY,!t)},n.setIsKinematic=function(t){t?this._pxActor.setRigidBodyFlag(this._physXPhysics._physX.PxRigidBodyFlag.eKINEMATIC,!0):this._pxActor.setRigidBodyFlag(this._physXPhysics._physX.PxRigidBodyFlag.eKINEMATIC,!1)},n.setConstraints=function(t){this._pxActor.setRigidDynamicLockFlags(t)},n.addForce=function(t){this._pxActor.addForce({x:t.x,y:t.y,z:t.z})},n.addTorque=function(t){this._pxActor.addTorque({x:t.x,y:t.y,z:t.z})},n.move=function(t,o){if(o){this._pxActor.setKinematicTarget(t,o);return}var n=s._tempTranslation,r=s._tempRotation;this.getWorldTransform(n,r),i(t,e.Vector3)?this._pxActor.setKinematicTarget(t,r):this._pxActor.setKinematicTarget(n,t)},n.sleep=function(){return this._pxActor.putToSleep()},n.isSleeping=function(){return this._pxActor.isSleeping()},n.wakeUp=function(){return this._pxActor.wakeUp()},s}(p);u._tempTranslation=new e.Vector3,u._tempRotation=new e.Quaternion;var d=function(){this._eventMap={}},y=/*#__PURE__*/function(){function t(t,e,i,s,o,n){this._physXPhysics=t;var r=t._pxPhysics.createMaterial(e,i,s);r.setFrictionCombineMode(o),r.setRestitutionCombineMode(n),this._pxMaterial=r}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}(),x=/*#__PURE__*/function(){function t(t,i,s,o,n,r,a,l){var h=this;this._pxControllerManager=null,this._boxGeometry=null,this._sphereGeometry=null,this._capsuleGeometry=null,this._currentEvents=new e.DisorderedArray,this._eventPool=[],this._physXPhysics=t,this._physXManager=i;var c=t._physX;this._pxRaycastHit=new c.PxRaycastHit,this._pxFilterData=new c.PxQueryFilterData,this._pxFilterData.flags=new c.PxQueryFlags(7),this._onContactEnter=s,this._onContactExit=o,this._onContactStay=n,this._onTriggerEnter=r,this._onTriggerExit=a,this._onTriggerStay=l;var _=t._pxPhysics;this._physXSimulationCallbackInstance=c.PxSimulationEventCallback.implement({onContactBegin:function(t){h._onContactEnter(t)},onContactEnd:function(t){h._onContactExit(t)},onContactPersist:function(t){h._onContactStay(t)},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 s=h._physXManager._eventMap[t];i=s[e],s[e]=void 0}else{var o=h._physXManager._eventMap[e];i=o[t],o[t]=void 0}i.state=2}});var p=c.getDefaultSceneDesc(_.getTolerancesScale(),0,this._physXSimulationCallbackInstance);this._pxScene=_.createScene(p),p.delete()}var i=t.prototype;return i.setGravity=function(t){this._pxScene.setGravity(t)},i.addCollider=function(t){t._scene=this,this._pxScene.addActor(t._pxActor,null);for(var e=t._shapes,i=0,s=e.length;i<s;i++)this._addColliderShape(e[i]._id)},i.removeCollider=function(t){t._scene=null,this._pxScene.removeActor(t._pxActor,!0);for(var e=t._shapes,i=0,s=e.length;i<s;i++)this._removeColliderShape(e[i]._id)},i.addCharacterController=function(t){if(t._scene=this,!t._pxController){var e=t._shape;if(e){var i=t._pxManager;i!==this&&(i&&t._destroyPXController(),t._createPXController(this,e)),this._addColliderShape(e._id)}}t._pxManager=this},i.removeCharacterController=function(t){t._scene=null,t._pxManager=null,t._destroyPXController();var e=t._shape;e&&this._removeColliderShape(e._id)},i.update=function(t){this._simulate(t),this._fetchResults(),this._fireEvent()},i.raycast=function(e,i,s,o){var n=this._pxRaycastHit;i=Math.min(i,34e37);var r=this._physXPhysics._physX.PxQueryFilterCallback.implement({preFilter:function(t,e,i){return s(e)?2:0}}),a=this._pxScene.raycastSingle(e.origin,e.direction,i,n,this._pxFilterData,r);if(r.delete(),a&&void 0!=o){var l=t._tempPosition,h=t._tempNormal,c=n.position,_=n.normal;l.set(c.x,c.y,c.z),h.set(_.x,_.y,_.z),o(n.getShape().getUUID(),n.distance,l,h)}return a},i.boxCast=function(e,i,s,o,n,r,a){this._boxGeometry?this._boxGeometry.halfExtents=s:this._boxGeometry=new this._physXPhysics._physX.PxBoxGeometry(s.x,s.y,s.z);var l=t._tempPose;return l.translation.copyFrom(e),l.rotation.copyFrom(i),this._sweepSingle(this._boxGeometry,l,o,n,r,a)},i.sphereCast=function(e,i,s,o,n,r){this._sphereGeometry?this._sphereGeometry.radius=i:this._sphereGeometry=new this._physXPhysics._physX.PxSphereGeometry(i);var a=t._tempQuaternion;return a.set(0,0,0,1),this._sweepSingle(this._sphereGeometry,{translation:e,rotation:a},s,o,n,r)},i.capsuleCast=function(e,i,s,o,n,r,a,l){this._capsuleGeometry?(this._capsuleGeometry.radius=i,this._capsuleGeometry.halfHeight=.5*s):this._capsuleGeometry=new this._physXPhysics._physX.PxCapsuleGeometry(i,.5*s);var h=t._tempPose;return h.translation.copyFrom(e),h.rotation.copyFrom(o),this._sweepSingle(this._capsuleGeometry,h,n,r,a,l)},i.overlapBoxAll=function(e,i,s,o){this._boxGeometry?this._boxGeometry.halfExtents=s:this._boxGeometry=new this._physXPhysics._physX.PxBoxGeometry(s.x,s.y,s.z);var n=t._tempPose;return n.translation.copyFrom(e),n.rotation.copyFrom(i),this._overlapMultiple(this._boxGeometry,n,o)},i.overlapSphereAll=function(e,i,s){this._sphereGeometry?this._sphereGeometry.radius=i:this._sphereGeometry=new this._physXPhysics._physX.PxSphereGeometry(i);var o=t._tempQuaternion;return o.set(0,0,0,1),this._overlapMultiple(this._sphereGeometry,{translation:e,rotation:o},s)},i.overlapCapsuleAll=function(e,i,s,o,n){this._capsuleGeometry?(this._capsuleGeometry.radius=i,this._capsuleGeometry.halfHeight=.5*s):this._capsuleGeometry=new this._physXPhysics._physX.PxCapsuleGeometry(i,.5*s);var r=t._tempPose;return r.translation.copyFrom(e),r.rotation.copyFrom(o),this._overlapMultiple(this._capsuleGeometry,r,n)},i.destroy=function(){var t,e,i,s;null==(t=this._boxGeometry)||t.delete(),null==(e=this._sphereGeometry)||e.delete(),null==(i=this._capsuleGeometry)||i.delete(),this._physXSimulationCallbackInstance.delete(),this._pxRaycastHit.delete(),this._pxFilterData.flags.delete(),this._pxFilterData.delete(),null==(s=this._pxControllerManager)||s.release(),this._pxScene.release()},i._getControllerManager=function(){var t=this._pxControllerManager;return null===t&&(this._pxControllerManager=t=this._pxScene.createControllerManager()),t},i._addColliderShape=function(t){this._physXManager._eventMap[t]=Object.create(null)},i._removeColliderShape=function(t){var e=this._eventPool,i=this._currentEvents,s=this._physXManager._eventMap;i.forEach(function(o,n){o.index1==t?(i.deleteByIndex(n),e.push(o)):o.index2==t&&(i.deleteByIndex(n),e.push(o),s[o.index1][t]=void 0)}),delete s[t]},i._sweepSingle=function(e,i,s,o,n,r){o=Math.min(o,34e37);var a=this._physXPhysics._physX.PxQueryFilterCallback.implement({preFilter:function(t,e,i){return n(e)?2:0}}),l=new this._physXPhysics._physX.PxSweepHit,h=this._pxScene.sweepSingle(e,i,s,o,l,this._pxFilterData,a);if(h&&void 0!=r){var c=t._tempPosition,_=t._tempNormal,p=l.position,u=l.normal;c.set(p.x,p.y,p.z),_.set(u.x,u.y,u.z),r(l.getShape().getUUID(),l.distance,c,_)}return a.delete(),l.delete(),h},i._overlapMultiple=function(e,i,s){var o=this._physXPhysics._physX.PxQueryFilterCallback.implement({preFilter:function(t,e,i){return s(e)?2:0}}),n=this._pxScene.overlapMultiple(e,i,256,this._pxFilterData,o),r=t._tempShapeIDs;if(r.length=0,n)for(var a=0,l=n.size();a<l;a++)r.push(n.get(a).getShape().getUUID());return o.delete(),null==n||n.delete(),r},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 f(t,e),this._physXManager._eventMap[t][e]=i,i},i._fireEvent=function(){var t=this,e=this._eventPool,i=this._currentEvents;i.forEach(function(s,o){0==s.state?(t._onTriggerEnter(s.index1,s.index2),s.state=1):1==s.state?t._onTriggerStay(s.index1,s.index2):2==s.state&&(i.deleteByIndex(o),t._onTriggerExit(s.index1,s.index2),e.push(s))})},t}();x._tempPosition=new e.Vector3,x._tempQuaternion=new e.Quaternion,x._tempNormal=new e.Vector3,x._tempPose={translation:new e.Vector3,rotation:new e.Quaternion},x._tempShapeIDs=[];var f=function(t,e){this.index1=t,this.index2=e},g=/*#__PURE__*/function(t){function e(e,i,s){var o;return(o=t.call(this,e)||this)._pxActor=e._pxPhysics.createRigidStatic(o._transform(i,s)),o}return o(e,t),e}(p),m=((r={})[r.Auto=0]="Auto",r[r.WebAssembly=1]="WebAssembly",r[r.JavaScript=2]="JavaScript",r),v=/*#__PURE__*/function(){function t(t){this._rotation=new e.Quaternion,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==(e=this._collider)?void 0:e._pxActor)||null,(null==t?void 0:t._pxActor)||null)},i.setAnchor=function(e){this._setLocalPose(0,e,t._defaultQuat),this._anchor=e},i.setConnectedAnchor=function(t){this._setLocalPose(1,t,this._rotation),this._connectedAnchor=t},i.setRotation=function(t){this._setLocalPose(1,this._connectedAnchor,t),this._rotation.copyFrom(t)},i.setMassScale=function(t){this._pxJoint.setInvMassScale0(1/t)},i.setConnectedMassScale=function(t){this._pxJoint.setInvMassScale1(1/t)},i.setInertiaScale=function(t){this._pxJoint.setInvInertiaScale0(t)},i.setConnectedInertiaScale=function(t){this._pxJoint.setInvInertiaScale1(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.destroy=function(){this._pxJoint&&(this._pxJoint.release(),this._collider=null)},i._setLocalPose=function(t,e,i){this._pxJoint.setLocalPose(t,e,i)},t}();v._defaultVec=new e.Vector3,v._defaultQuat=new e.Quaternion;var S=/*#__PURE__*/function(t){function e(e,i){var s;return(s=t.call(this,e)||this)._collider=i,s._pxJoint=e._pxPhysics.createFixedJoint(i._pxActor,v._defaultVec,v._defaultQuat,null,v._defaultVec,v._defaultQuat),s}return o(e,t),e}(v),P=/*#__PURE__*/function(t){function i(i,s){var o;return(o=t.call(this,i)||this)._axisRotationQuaternion=new e.Quaternion,o._connectedAxisRotationQuaternion=new e.Quaternion,o._collider=s,o._pxJoint=i._pxPhysics.createRevoluteJoint(s._pxActor,v._defaultVec,v._defaultQuat,null,v._defaultVec,v._defaultQuat),o}o(i,t);var s=i.prototype;return s.setRotation=function(t){var e=this._axis;this._rotation.copyFrom(t),e&&this.setAxis(e)},s.setAxis=function(t){this._axis=t;var s=i._xAxis,o=this._axisRotationQuaternion;s.set(1,0,0);var n=Math.acos(e.Vector3.dot(s,t));e.Vector3.cross(s,t,s),e.Quaternion.rotationAxisAngle(s,n,o),this._setLocalPose(0,this._anchor,o);var r=this._connectedAxisRotationQuaternion;e.Quaternion.multiply(this._rotation,o,r),this._setLocalPose(1,this._connectedAnchor,r)},s.setAnchor=function(t){this._setLocalPose(0,t,this._axisRotationQuaternion),this._anchor=t},s.setConnectedAnchor=function(t){this._setLocalPose(1,t,this._connectedAxisRotationQuaternion),this._connectedAnchor=t},s.getAngle=function(){return e.MathUtil.radianToDegree(this._pxJoint.getAngle())},s.getVelocity=function(){return this._pxJoint.getVelocity()},s.setHardLimit=function(t,i,s){this._pxJoint.setHardLimit(e.MathUtil.degreeToRadian(t),e.MathUtil.degreeToRadian(i),s)},s.setSoftLimit=function(t,i,s,o){this._pxJoint.setSoftLimit(e.MathUtil.degreeToRadian(t),e.MathUtil.degreeToRadian(i),s,o)},s.setDriveVelocity=function(t,e){void 0===e&&(e=!0),this._pxJoint.setDriveVelocity(t,e)},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);P._xAxis=new e.Vector3(1,0,0);var A=/*#__PURE__*/function(t){function e(e,i){var s;return(s=t.call(this,e)||this)._collider=i,s._pxJoint=e._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}o(e,t);var i=e.prototype;return i.setMinDistance=function(t){this._pxJoint.setMinDistance(t)},i.setMaxDistance=function(t){this._pxJoint.setMaxDistance(t)},i.setTolerance=function(t){this._pxJoint.setTolerance(t)},i.setStiffness=function(t){this._pxJoint.setStiffness(t)},i.setDamping=function(t){this._pxJoint.setDamping(t)},e}(v),C=/*#__PURE__*/function(t){function i(i,s,o){var n;return(n=t.call(this,i)||this)._axis=new e.Quaternion(0,0,a.halfSqrt,a.halfSqrt),n._physXRotation.copyFrom(n._axis),n._pxGeometry=new i._physX.PxPlaneGeometry,n._initialize(o,s),n._setLocalPose(),n}return o(i,t),i}(a),M=/*#__PURE__*/function(t){function e(e,i,s,o){var n;return(n=t.call(this,e)||this)._maxScale=1,n._radius=s,n._pxGeometry=new e._physX.PxSphereGeometry(s*n._maxScale),n._initialize(o,i),n._setLocalPose(),n}o(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}(a),w=/*#__PURE__*/function(){function t(t,e){var i,s;void 0===t&&(t=m.Auto),this._initializeState=0,this._runTimeMode=t,this._wasmModeUrl=null!=(i=null==e?void 0:e.wasmModeUrl)?i:"https://mdn.alipayobjects.com/rms/afts/file/A*m04iQojeKRgAAAAASWAAAAgAehQnAQ/physx.release.js",this._downgradeModeUrl=null!=(s=null==e?void 0:e.javaScriptModeUrl)?s:"https://mdn.alipayobjects.com/rms/afts/file/A*13gEToqpJWcAAAAAgEAAAAgAehQnAQ/physx.release.downgrade.js"}var e=t.prototype;return e.initialize=function(){var t=this;if(2===this._initializeState)return Promise.resolve();if(1===this._initializeState)return this._initializePromise;var e=this._runTimeMode,s=new Promise(function(s,o){var n=document.createElement("script");document.body.appendChild(n),n.async=!0,n.onload=s,n.onerror=o,e==m.Auto&&(e=!function(){try{var t;if(("undefined"==typeof WebAssembly?"undefined":(t=WebAssembly)&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t)=="object"&&"function"==typeof WebAssembly.instantiate){var e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(i(e,WebAssembly.Module))return i(new WebAssembly.Instance(e),WebAssembly.Instance)}}catch(t){}return!1}()?m.JavaScript:m.WebAssembly),e==m.JavaScript?n.src=t._downgradeModeUrl:e==m.WebAssembly&&(n.src=t._wasmModeUrl)}),o=new Promise(function(e,i){s.then(function(){return window.PHYSX().then(function(i){t._init(i),t._initializeState=2,t._initializePromise=null,console.log("PhysX loaded."),e()},i)},i).catch(i)});return this._initializePromise=o,o},e.destroy=function(){this._physX.PxCloseExtensions(),this._pxPhysics.release(),this._pxFoundation.release(),this._defaultErrorCallback.delete(),this._allocator.delete(),this._tolerancesScale.delete()},e.createPhysicsManager=function(){return new d},e.createPhysicsScene=function(t,e,i,s,o,n,r){return new x(this,t,e,i,s,o,n,r)},e.createStaticCollider=function(t,e){return new g(this,t,e)},e.createDynamicCollider=function(t,e){return new u(this,t,e)},e.createCharacterController=function(){return new _(this)},e.createPhysicsMaterial=function(t,e,i,s,o){return new y(this,t,e,i,s,o)},e.createBoxColliderShape=function(t,e,i){return new l(this,t,e,i)},e.createSphereColliderShape=function(t,e,i){return new M(this,t,e,i)},e.createPlaneColliderShape=function(t,e){return new C(this,t,e)},e.createCapsuleColliderShape=function(t,e,i,s){return new h(this,t,e,i,s)},e.createFixedJoint=function(t){return new S(this,t)},e.createHingeJoint=function(t){return new P(this,t)},e.createSpringJoint=function(t){return new A(this,t)},e.getColliderLayerCollision=function(t,e){return this._physX.getGroupCollisionFlag(t,e)},e.setColliderLayerCollision=function(t,e,i){this._physX.setGroupCollisionFlag(t,e,i)},e._init=function(t){var e=t.PX_PHYSICS_VERSION,i=new t.PxDefaultErrorCallback,s=new t.PxDefaultAllocator,o=t.PxCreateFoundation(e,s,i),n=new t.PxTolerancesScale,r=t.PxCreatePhysics(e,o,n,!1,null);t.PxInitExtensions(r,null),this._physX=t,this._pxFoundation=o,this._pxPhysics=r,this._defaultErrorCallback=i,this._allocator=s,this._tolerancesScale=n},t}(),b="1.6.2";console.log("Galacean Engine Physics PhysX Version: "+b),t.PhysXPhysics=w,t.PhysXRuntimeMode=m,t.version=b,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 o(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)}var n,r,a=/*#__PURE__*/function(){function t(t){this._controllers=new e.DisorderedArray,this._contractOffset=.02,this._worldScale=new e.Vector3(1,1,1),this._position=new e.Vector3,this._rotation=new e.Vector3,this._axis=null,this._physXRotation=new e.Quaternion,this._shapeFlags=3,this._physXPhysics=t}var i=t.prototype;return i.setRotation=function(t){var i=this._rotation.set(e.MathUtil.degreeToRadian(t.x),e.MathUtil.degreeToRadian(t.y),e.MathUtil.degreeToRadian(t.z));e.Quaternion.rotationYawPitchRoll(i.y,i.x,i.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,s=e.length;i<s;i++)e.get(i)._updateShapePosition(this._position,this._worldScale);this._setLocalPose()},i.setWorldScale=function(t){this._worldScale.set(Math.abs(t.x),Math.abs(t.y),Math.abs(t.z)),this._setLocalPose();for(var e=this._controllers,i=0,s=e.length;i<s;i++)e.get(i)._updateShapePosition(this._position,this._worldScale)},i.setContactOffset=function(t){this._contractOffset=t;var e=this._controllers;if(e.length)for(var i,s=0,o=e.length;s<o;s++)null==(i=e.get(s)._pxController)||i.setContactOffset(t);else this._pxShape.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.pointDistance=function(e){var i=this._pxGeometry.pointDistance(this._pxShape.getGlobalPose(),e),s=i.closestPoint,o=t._tempVector4;return o.set(s.x,s.y,s.z,i.distance),o},i.destroy=function(){this._pxShape.release(),this._pxGeometry.delete()},i._setShapeFlags=function(t){this._shapeFlags=t;var e=new this._physXPhysics._physX.PxShapeFlags(this._shapeFlags);this._pxShape.setFlags(e),e.delete()},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;var i=new this._physXPhysics._physX.PxShapeFlags(this._shapeFlags);this._pxShape=this._physXPhysics._pxPhysics.createShape(this._pxGeometry,t._pxMaterial,!0,i),i.delete(),this._pxShape.setUUID(e)},i._modifyFlag=function(t,e){this._shapeFlags=e?this._shapeFlags|t:this._shapeFlags&~t},t}();a.halfSqrt=.70710678118655,a.transform={translation:new e.Vector3,rotation:null},a._tempVector4=new e.Vector4;var l=/*#__PURE__*/function(t){function i(i,s,o,n){(r=t.call(this,i)||this)._halfSize=new e.Vector3;var r,a=r._halfSize;return a.set(.5*o.x,.5*o.y,.5*o.z),r._pxGeometry=new i._physX.PxBoxGeometry(a.x,a.y,a.z),r._initialize(n,s),r._setLocalPose(),r}o(i,t);var s=i.prototype;return s.setSize=function(t){var s=this._halfSize,o=i._tempHalfExtents;s.set(.5*t.x,.5*t.y,.5*t.z),e.Vector3.multiply(s,this._worldScale,o),this._pxGeometry.halfExtents=o,this._pxShape.setGeometry(this._pxGeometry),this._updateController(o)},s.setRotation=function(e){t.prototype.setRotation.call(this,e),this._controllers.length>0&&console.warn("Box character controller `rotation` is not supported in PhysX and will be ignored")},s.setWorldScale=function(s){t.prototype.setWorldScale.call(this,s);var o=i._tempHalfExtents;e.Vector3.multiply(this._halfSize,this._worldScale,o),this._pxGeometry.halfExtents=o,this._pxShape.setGeometry(this._pxGeometry),this._updateController(o)},s._updateController=function(t){for(var e=this._controllers,i=0,s=e.length;i<s;i++){var o=e.get(i)._pxController;o&&(o.setHalfHeight(t.y),o.setHalfSideExtent(t.x),o.setHalfForwardExtent(t.z))}},i}(a);l._tempHalfExtents=new e.Vector3;var h=/*#__PURE__*/function(t){function i(i,s,o,n,r){var l;return(l=t.call(this,i)||this)._upAxis=1,l._radius=o,l._halfHeight=.5*n,l._axis=new e.Quaternion(0,0,a.halfSqrt,a.halfSqrt),l._physXRotation.copyFrom(l._axis),l._pxGeometry=new i._physX.PxCapsuleGeometry(o,l._halfHeight),l._initialize(r,s),l._setLocalPose(),l}o(i,t);var s=i.prototype;return s.setRadius=function(t){this._radius=t;var e,i=this._worldScale;switch(this._upAxis){case 0:this._pxGeometry.radius=this._radius*Math.max(i.y,i.z);break;case 1:this._pxGeometry.radius=this._radius*Math.max(i.x,i.z);break;case 2:this._pxGeometry.radius=this._radius*Math.max(i.x,i.y)}this._pxShape.setGeometry(this._pxGeometry);for(var s=this._pxGeometry.radius,o=this._controllers,n=0,r=o.length;n<r;n++)null==(e=o.get(n)._pxController)||e.setRadius(s)},s.setHeight=function(t){this._halfHeight=.5*t;var e,i=this._worldScale;switch(this._upAxis){case 0:this._pxGeometry.halfHeight=this._halfHeight*i.x;break;case 1:this._pxGeometry.halfHeight=this._halfHeight*i.y;break;case 2:this._pxGeometry.halfHeight=this._halfHeight*i.z}this._pxShape.setGeometry(this._pxGeometry);for(var s=2*this._pxGeometry.halfHeight,o=this._controllers,n=0,r=o.length;n<r;n++)null==(e=o.get(n)._pxController)||e.setHeight(s)},s.setRotation=function(e){t.prototype.setRotation.call(this,e),this._controllers.length>0&&console.warn("Capsule character controller `rotation` is not supported in PhysX and will be ignored")},s.setUpAxis=function(t){var i=this._rotation,s=this._axis,o=this._physXRotation;switch(this._upAxis=t,this._upAxis){case 0:s.set(0,0,0,1);break;case 1:s.set(0,0,a.halfSqrt,a.halfSqrt);break;case 2:s.set(0,a.halfSqrt,0,a.halfSqrt)}i?(e.Quaternion.rotationYawPitchRoll(i.y,i.x,i.z,o),e.Quaternion.multiply(o,s,o)):o.copyFrom(s),this._setLocalPose(),this._controllers.length>0&&console.warn("Capsule character controller `upAxis` is not supported in PhysX and will be ignored")},s.setWorldScale=function(e){t.prototype.setWorldScale.call(this,e);var i=this._worldScale,s=this._pxGeometry;switch(this._upAxis){case 0:s.radius=this._radius*Math.max(i.y,i.z),s.halfHeight=this._halfHeight*i.x;break;case 1:s.radius=this._radius*Math.max(i.x,i.z),s.halfHeight=this._halfHeight*i.y;break;case 2:s.radius=this._radius*Math.max(i.x,i.y),s.halfHeight=this._halfHeight*i.z}this._pxShape.setGeometry(s);for(var o=s.radius,n=2*s.halfHeight,r=this._controllers,a=0,l=r.length;a<l;a++){var h=r.get(a)._pxController;h&&(h.setRadius(o),h.setHeight(n))}},i}(a),c=((n={})[n.X=0]="X",n[n.Y=1]="Y",n[n.Z=2]="Z",n),_=/*#__PURE__*/function(){function t(t){this._scene=null,this._shapeScaledPosition=new e.Vector3,this._worldPosition=null,this._physXPhysics=t}var s=t.prototype;return s.move=function(t,e,i){var s,o;return null!=(o=null==(s=this._pxController)?void 0:s.move(t,e,i))?o:0},s.setWorldPosition=function(t){this._worldPosition=t,this._updateNativePosition()},s.getWorldPosition=function(t){this._pxController&&(t.copyFrom(this._pxController.getPosition()),t.subtract(this._shapeScaledPosition))},s.setStepOffset=function(t){var e;null==(e=this._pxController)||e.setStepOffset(t)},s.setNonWalkableMode=function(t){var e;null==(e=this._pxController)||e.setNonWalkableMode(t)},s.setUpDirection=function(t){var e;null==(e=this._pxController)||e.setUpDirection(t)},s.setSlopeLimit=function(t){var e;null==(e=this._pxController)||e.setSlopeLimit(Math.cos(t*Math.PI/180))},s.addShape=function(t){var e,i;this._updateShapePosition(t._position,t._worldScale),this._pxManager&&this._createPXController(this._pxManager,t),this._shape=t,t._controllers.add(this),null==(e=this._pxController)||e.setContactOffset(t._contractOffset),null==(i=this._scene)||i._addColliderShape(t._id)},s.removeShape=function(t){var e;this._destroyPXController(),this._shape=null,t._controllers.delete(this),null==(e=this._scene)||e._removeColliderShape(t._id)},s.setCollisionLayer=function(t){var e,i=null==(e=this._pxController)?void 0:e.getActor();i&&this._physXPhysics._physX.setGroup(i,t)},s.destroy=function(){this._destroyPXController()},s._createPXController=function(t,e){var s;if(i(e,l))(s=new this._physXPhysics._physX.PxBoxControllerDesc).halfHeight=e._halfSize.y,s.halfSideExtent=e._halfSize.x,s.halfForwardExtent=e._halfSize.z,e._rotation.lengthSquared()>0&&console.warn("Box character controller `rotation` is not supported in PhysX and will be ignored");else if(i(e,h))(s=new this._physXPhysics._physX.PxCapsuleControllerDesc).radius=e._radius,s.height=2*e._halfHeight,s.climbingMode=1,e._rotation.lengthSquared()>0&&console.warn("Capsule character controller `rotation` is not supported in PhysX and will be ignored"),e._upAxis!==c.Y&&console.warn("Capsule character controller `upAxis` is not supported in PhysX and will be ignored");else throw"unsupported shape type";s.setMaterial(e._pxMaterial),this._pxController=t._getControllerManager().createController(s),s.delete(),this._pxController.setUUID(e._id),this._updateNativePosition()},s._destroyPXController=function(){this._pxController&&(this._pxController.release(),this._pxController=null)},s._updateShapePosition=function(t,i){e.Vector3.multiply(t,i,this._shapeScaledPosition),this._updateNativePosition()},s._updateNativePosition=function(){var i=this._worldPosition;this._pxController&&i&&(e.Vector3.add(i,this._shapeScaledPosition,t._tempVec),this._pxController.setPosition(t._tempVec))},t}();_._tempVec=new e.Vector3;var p=/*#__PURE__*/function(){function t(t){this._scene=null,this._shapes=[],this._physXPhysics=t}var e=t.prototype;return e.addShape=function(t){var e;this._pxActor.attachShape(t._pxShape),this._shapes.push(t),null==(e=this._scene)||e._addColliderShape(t._id)},e.removeShape=function(t){this._pxActor.detachShape(t._pxShape,!0);var e,i=this._shapes;i.splice(i.indexOf(t),1),null==(e=this._scene)||e._removeColliderShape(t._id)},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.setCollisionLayer=function(t){this._physXPhysics._physX.setGroup(this._pxActor,t)},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}();p._tempTransform={translation:null,rotation:null};var u=/*#__PURE__*/function(t){function s(e,i,s){var o,n=(o=t.call(this,e)||this)._transform(i,s);return o._pxActor=e._pxPhysics.createRigidDynamic(n),o}o(s,t);var n=s.prototype;return n.setLinearDamping=function(t){this._pxActor.setLinearDamping(t)},n.setAngularDamping=function(t){this._pxActor.setAngularDamping(t)},n.getLinearVelocity=function(t){var e=this._pxActor.getLinearVelocity();return t.set(e.x,e.y,e.z)},n.setLinearVelocity=function(t){this._pxActor.setLinearVelocity(t,!0)},n.getAngularVelocity=function(t){var i=this._pxActor.getAngularVelocity();return t.set(e.MathUtil.radianToDegree(i.x),e.MathUtil.radianToDegree(i.y),e.MathUtil.radianToDegree(i.z))},n.setAngularVelocity=function(t){s._tempTranslation.set(e.MathUtil.degreeToRadian(t.x),e.MathUtil.degreeToRadian(t.y),e.MathUtil.degreeToRadian(t.z)),this._pxActor.setAngularVelocity(s._tempTranslation,!0)},n.setMass=function(t){this._pxActor.setMass(t)},n.getCenterOfMass=function(t){var e=this._pxActor.getCMassLocalPose().translation;return t.set(e.x,e.y,e.z)},n.setCenterOfMass=function(t){this._pxActor.setCMassLocalPose(t)},n.setInertiaTensor=function(t){this._pxActor.setMassSpaceInertiaTensor(t)},n.getInertiaTensor=function(t){var e=this._pxActor.getMassSpaceInertiaTensor();return t.set(e.x,e.y,e.z)},n.setMassAndUpdateInertia=function(t){this._pxActor.setMassAndUpdateInertia(t)},n.setMaxAngularVelocity=function(t){this._pxActor.setMaxAngularVelocity(e.MathUtil.degreeToRadian(t))},n.setMaxDepenetrationVelocity=function(t){this._pxActor.setMaxDepenetrationVelocity(t)},n.setSleepThreshold=function(t){this._pxActor.setSleepThreshold(t)},n.setSolverIterations=function(t){this._pxActor.setSolverIterationCounts(t,1)},n.setCollisionDetectionMode=function(t){var e=this._physXPhysics._physX;switch(t){case 1:this._pxActor.setRigidBodyFlag(e.PxRigidBodyFlag.eENABLE_CCD,!0);break;case 2:this._pxActor.setRigidBodyFlag(e.PxRigidBodyFlag.eENABLE_CCD,!1),this._pxActor.setRigidBodyFlag(e.PxRigidBodyFlag.eENABLE_CCD_FRICTION,!0);break;case 3:this._pxActor.setRigidBodyFlag(e.PxRigidBodyFlag.eENABLE_CCD,!1),this._pxActor.setRigidBodyFlag(e.PxRigidBodyFlag.eENABLE_SPECULATIVE_CCD,!0);break;case 0: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)}},n.setUseGravity=function(t){this._pxActor.setActorFlag(this._physXPhysics._physX.PxActorFlag.eDISABLE_GRAVITY,!t)},n.setIsKinematic=function(t){t?this._pxActor.setRigidBodyFlag(this._physXPhysics._physX.PxRigidBodyFlag.eKINEMATIC,!0):this._pxActor.setRigidBodyFlag(this._physXPhysics._physX.PxRigidBodyFlag.eKINEMATIC,!1)},n.setConstraints=function(t){this._pxActor.setRigidDynamicLockFlags(t)},n.addForce=function(t){this._pxActor.addForce({x:t.x,y:t.y,z:t.z})},n.addTorque=function(t){this._pxActor.addTorque({x:t.x,y:t.y,z:t.z})},n.move=function(t,o){if(o){this._pxActor.setKinematicTarget(t,o);return}var n=s._tempTranslation,r=s._tempRotation;this.getWorldTransform(n,r),i(t,e.Vector3)?this._pxActor.setKinematicTarget(t,r):this._pxActor.setKinematicTarget(n,t)},n.sleep=function(){return this._pxActor.putToSleep()},n.isSleeping=function(){return this._pxActor.isSleeping()},n.wakeUp=function(){return this._pxActor.wakeUp()},s}(p);u._tempTranslation=new e.Vector3,u._tempRotation=new e.Quaternion;var d=function(){this._eventMap={}},y=/*#__PURE__*/function(){function t(t,e,i,s,o,n){this._physXPhysics=t;var r=t._pxPhysics.createMaterial(e,i,s);r.setFrictionCombineMode(o),r.setRestitutionCombineMode(n),this._pxMaterial=r}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}(),x=/*#__PURE__*/function(){function t(t,i,s,o,n,r,a,l){var h=this;this._pxControllerManager=null,this._boxGeometry=null,this._sphereGeometry=null,this._capsuleGeometry=null,this._currentEvents=new e.DisorderedArray,this._eventPool=[],this._physXPhysics=t,this._physXManager=i;var c=t._physX;this._pxRaycastHit=new c.PxRaycastHit,this._pxFilterData=new c.PxQueryFilterData,this._pxFilterData.flags=new c.PxQueryFlags(7),this._onContactEnter=s,this._onContactExit=o,this._onContactStay=n,this._onTriggerEnter=r,this._onTriggerExit=a,this._onTriggerStay=l;var _=t._pxPhysics;this._physXSimulationCallbackInstance=c.PxSimulationEventCallback.implement({onContactBegin:function(t){h._onContactEnter(t)},onContactEnd:function(t){h._onContactExit(t)},onContactPersist:function(t){h._onContactStay(t)},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 s=h._physXManager._eventMap[t];i=s[e],s[e]=void 0}else{var o=h._physXManager._eventMap[e];i=o[t],o[t]=void 0}i.state=2}});var p=c.getDefaultSceneDesc(_.getTolerancesScale(),0,this._physXSimulationCallbackInstance);this._pxScene=_.createScene(p),p.delete()}var i=t.prototype;return i.setGravity=function(t){this._pxScene.setGravity(t)},i.addCollider=function(t){t._scene=this,this._pxScene.addActor(t._pxActor,null);for(var e=t._shapes,i=0,s=e.length;i<s;i++)this._addColliderShape(e[i]._id)},i.removeCollider=function(t){t._scene=null,this._pxScene.removeActor(t._pxActor,!0);for(var e=t._shapes,i=0,s=e.length;i<s;i++)this._removeColliderShape(e[i]._id)},i.addCharacterController=function(t){if(t._scene=this,!t._pxController){var e=t._shape;if(e){var i=t._pxManager;i!==this&&(i&&t._destroyPXController(),t._createPXController(this,e)),this._addColliderShape(e._id)}}t._pxManager=this},i.removeCharacterController=function(t){t._scene=null,t._pxManager=null,t._destroyPXController();var e=t._shape;e&&this._removeColliderShape(e._id)},i.update=function(t){this._simulate(t),this._fetchResults(),this._fireEvent()},i.raycast=function(e,i,s,o){var n=this._pxRaycastHit;i=Math.min(i,34e37);var r=this._physXPhysics._physX.PxQueryFilterCallback.implement({preFilter:function(t,e,i){return s(e)?2:0}}),a=this._pxScene.raycastSingle(e.origin,e.direction,i,n,this._pxFilterData,r);if(r.delete(),a&&void 0!=o){var l=t._tempPosition,h=t._tempNormal,c=n.position,_=n.normal;l.set(c.x,c.y,c.z),h.set(_.x,_.y,_.z),o(n.getShape().getUUID(),n.distance,l,h)}return a},i.boxCast=function(e,i,s,o,n,r,a){this._boxGeometry?this._boxGeometry.halfExtents=s:this._boxGeometry=new this._physXPhysics._physX.PxBoxGeometry(s.x,s.y,s.z);var l=t._tempPose;return l.translation.copyFrom(e),l.rotation.copyFrom(i),this._sweepSingle(this._boxGeometry,l,o,n,r,a)},i.sphereCast=function(e,i,s,o,n,r){this._sphereGeometry?this._sphereGeometry.radius=i:this._sphereGeometry=new this._physXPhysics._physX.PxSphereGeometry(i);var a=t._tempQuaternion;return a.set(0,0,0,1),this._sweepSingle(this._sphereGeometry,{translation:e,rotation:a},s,o,n,r)},i.capsuleCast=function(e,i,s,o,n,r,a,l){this._capsuleGeometry?(this._capsuleGeometry.radius=i,this._capsuleGeometry.halfHeight=.5*s):this._capsuleGeometry=new this._physXPhysics._physX.PxCapsuleGeometry(i,.5*s);var h=t._tempPose;return h.translation.copyFrom(e),h.rotation.copyFrom(o),this._sweepSingle(this._capsuleGeometry,h,n,r,a,l)},i.overlapBoxAll=function(e,i,s,o){this._boxGeometry?this._boxGeometry.halfExtents=s:this._boxGeometry=new this._physXPhysics._physX.PxBoxGeometry(s.x,s.y,s.z);var n=t._tempPose;return n.translation.copyFrom(e),n.rotation.copyFrom(i),this._overlapMultiple(this._boxGeometry,n,o)},i.overlapSphereAll=function(e,i,s){this._sphereGeometry?this._sphereGeometry.radius=i:this._sphereGeometry=new this._physXPhysics._physX.PxSphereGeometry(i);var o=t._tempQuaternion;return o.set(0,0,0,1),this._overlapMultiple(this._sphereGeometry,{translation:e,rotation:o},s)},i.overlapCapsuleAll=function(e,i,s,o,n){this._capsuleGeometry?(this._capsuleGeometry.radius=i,this._capsuleGeometry.halfHeight=.5*s):this._capsuleGeometry=new this._physXPhysics._physX.PxCapsuleGeometry(i,.5*s);var r=t._tempPose;return r.translation.copyFrom(e),r.rotation.copyFrom(o),this._overlapMultiple(this._capsuleGeometry,r,n)},i.destroy=function(){var t,e,i,s;null==(t=this._boxGeometry)||t.delete(),null==(e=this._sphereGeometry)||e.delete(),null==(i=this._capsuleGeometry)||i.delete(),this._physXSimulationCallbackInstance.delete(),this._pxRaycastHit.delete(),this._pxFilterData.flags.delete(),this._pxFilterData.delete(),null==(s=this._pxControllerManager)||s.release(),this._pxScene.release()},i._getControllerManager=function(){var t=this._pxControllerManager;return null===t&&(this._pxControllerManager=t=this._pxScene.createControllerManager()),t},i._addColliderShape=function(t){this._physXManager._eventMap[t]=Object.create(null)},i._removeColliderShape=function(t){var e=this._eventPool,i=this._currentEvents,s=this._physXManager._eventMap;i.forEach(function(o,n){o.index1==t?(i.deleteByIndex(n),e.push(o)):o.index2==t&&(i.deleteByIndex(n),e.push(o),s[o.index1][t]=void 0)}),delete s[t]},i._sweepSingle=function(e,i,s,o,n,r){o=Math.min(o,34e37);var a=this._physXPhysics._physX.PxQueryFilterCallback.implement({preFilter:function(t,e,i){return n(e)?2:0}}),l=new this._physXPhysics._physX.PxSweepHit,h=this._pxScene.sweepSingle(e,i,s,o,l,this._pxFilterData,a);if(h&&void 0!=r){var c=t._tempPosition,_=t._tempNormal,p=l.position,u=l.normal;c.set(p.x,p.y,p.z),_.set(u.x,u.y,u.z),r(l.getShape().getUUID(),l.distance,c,_)}return a.delete(),l.delete(),h},i._overlapMultiple=function(e,i,s){var o=this._physXPhysics._physX.PxQueryFilterCallback.implement({preFilter:function(t,e,i){return s(e)?2:0}}),n=this._pxScene.overlapMultiple(e,i,256,this._pxFilterData,o),r=t._tempShapeIDs;if(r.length=0,n)for(var a=0,l=n.size();a<l;a++)r.push(n.get(a).getShape().getUUID());return o.delete(),null==n||n.delete(),r},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 f(t,e),this._physXManager._eventMap[t][e]=i,i},i._fireEvent=function(){var t=this,e=this._eventPool,i=this._currentEvents;i.forEach(function(s,o){0==s.state?(t._onTriggerEnter(s.index1,s.index2),s.state=1):1==s.state?t._onTriggerStay(s.index1,s.index2):2==s.state&&(i.deleteByIndex(o),t._onTriggerExit(s.index1,s.index2),e.push(s))})},t}();x._tempPosition=new e.Vector3,x._tempQuaternion=new e.Quaternion,x._tempNormal=new e.Vector3,x._tempPose={translation:new e.Vector3,rotation:new e.Quaternion},x._tempShapeIDs=[];var f=function(t,e){this.index1=t,this.index2=e},g=/*#__PURE__*/function(t){function e(e,i,s){var o;return(o=t.call(this,e)||this)._pxActor=e._pxPhysics.createRigidStatic(o._transform(i,s)),o}return o(e,t),e}(p),m=((r={})[r.Auto=0]="Auto",r[r.WebAssembly=1]="WebAssembly",r[r.JavaScript=2]="JavaScript",r),v=/*#__PURE__*/function(){function t(t){this._rotation=new e.Quaternion,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==(e=this._collider)?void 0:e._pxActor)||null,(null==t?void 0:t._pxActor)||null)},i.setAnchor=function(e){this._setLocalPose(0,e,t._defaultQuat),this._anchor=e},i.setConnectedAnchor=function(t){this._setLocalPose(1,t,this._rotation),this._connectedAnchor=t},i.setRotation=function(t){this._setLocalPose(1,this._connectedAnchor,t),this._rotation.copyFrom(t)},i.setMassScale=function(t){this._pxJoint.setInvMassScale0(1/t)},i.setConnectedMassScale=function(t){this._pxJoint.setInvMassScale1(1/t)},i.setInertiaScale=function(t){this._pxJoint.setInvInertiaScale0(t)},i.setConnectedInertiaScale=function(t){this._pxJoint.setInvInertiaScale1(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.destroy=function(){this._pxJoint&&(this._pxJoint.release(),this._collider=null)},i._setLocalPose=function(t,e,i){this._pxJoint.setLocalPose(t,e,i)},t}();v._defaultVec=new e.Vector3,v._defaultQuat=new e.Quaternion;var S=/*#__PURE__*/function(t){function e(e,i){var s;return(s=t.call(this,e)||this)._collider=i,s._pxJoint=e._pxPhysics.createFixedJoint(i._pxActor,v._defaultVec,v._defaultQuat,null,v._defaultVec,v._defaultQuat),s}return o(e,t),e}(v),P=/*#__PURE__*/function(t){function i(i,s){var o;return(o=t.call(this,i)||this)._axisRotationQuaternion=new e.Quaternion,o._connectedAxisRotationQuaternion=new e.Quaternion,o._collider=s,o._pxJoint=i._pxPhysics.createRevoluteJoint(s._pxActor,v._defaultVec,v._defaultQuat,null,v._defaultVec,v._defaultQuat),o}o(i,t);var s=i.prototype;return s.setRotation=function(t){var e=this._axis;this._rotation.copyFrom(t),e&&this.setAxis(e)},s.setAxis=function(t){this._axis=t;var s=i._xAxis,o=this._axisRotationQuaternion;s.set(1,0,0);var n=Math.acos(e.Vector3.dot(s,t));e.Vector3.cross(s,t,s),e.Quaternion.rotationAxisAngle(s,n,o),this._setLocalPose(0,this._anchor,o);var r=this._connectedAxisRotationQuaternion;e.Quaternion.multiply(this._rotation,o,r),this._setLocalPose(1,this._connectedAnchor,r)},s.setAnchor=function(t){this._setLocalPose(0,t,this._axisRotationQuaternion),this._anchor=t},s.setConnectedAnchor=function(t){this._setLocalPose(1,t,this._connectedAxisRotationQuaternion),this._connectedAnchor=t},s.getAngle=function(){return e.MathUtil.radianToDegree(this._pxJoint.getAngle())},s.getVelocity=function(){return this._pxJoint.getVelocity()},s.setHardLimit=function(t,i,s){this._pxJoint.setHardLimit(e.MathUtil.degreeToRadian(t),e.MathUtil.degreeToRadian(i),s)},s.setSoftLimit=function(t,i,s,o){this._pxJoint.setSoftLimit(e.MathUtil.degreeToRadian(t),e.MathUtil.degreeToRadian(i),s,o)},s.setDriveVelocity=function(t,e){void 0===e&&(e=!0),this._pxJoint.setDriveVelocity(t,e)},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);P._xAxis=new e.Vector3(1,0,0);var A=/*#__PURE__*/function(t){function e(e,i){var s;return(s=t.call(this,e)||this)._collider=i,s._pxJoint=e._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}o(e,t);var i=e.prototype;return i.setMinDistance=function(t){this._pxJoint.setMinDistance(t)},i.setMaxDistance=function(t){this._pxJoint.setMaxDistance(t)},i.setTolerance=function(t){this._pxJoint.setTolerance(t)},i.setStiffness=function(t){this._pxJoint.setStiffness(t)},i.setDamping=function(t){this._pxJoint.setDamping(t)},e}(v),C=/*#__PURE__*/function(t){function i(i,s,o){var n;return(n=t.call(this,i)||this)._axis=new e.Quaternion(0,0,a.halfSqrt,a.halfSqrt),n._physXRotation.copyFrom(n._axis),n._pxGeometry=new i._physX.PxPlaneGeometry,n._initialize(o,s),n._setLocalPose(),n}return o(i,t),i}(a),M=/*#__PURE__*/function(t){function e(e,i,s,o){var n;return(n=t.call(this,e)||this)._maxScale=1,n._radius=s,n._pxGeometry=new e._physX.PxSphereGeometry(s*n._maxScale),n._initialize(o,i),n._setLocalPose(),n}o(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}(a),w=/*#__PURE__*/function(){function t(t,e){var i,s;void 0===t&&(t=m.Auto),this._initializeState=0,this._runTimeMode=t,this._wasmModeUrl=null!=(i=null==e?void 0:e.wasmModeUrl)?i:"https://mdn.alipayobjects.com/rms/afts/file/A*m04iQojeKRgAAAAASWAAAAgAehQnAQ/physx.release.js",this._downgradeModeUrl=null!=(s=null==e?void 0:e.javaScriptModeUrl)?s:"https://mdn.alipayobjects.com/rms/afts/file/A*13gEToqpJWcAAAAAgEAAAAgAehQnAQ/physx.release.downgrade.js"}var e=t.prototype;return e.initialize=function(){var t=this;if(2===this._initializeState)return Promise.resolve();if(1===this._initializeState)return this._initializePromise;var e=this._runTimeMode,s=new Promise(function(s,o){var n=document.createElement("script");document.body.appendChild(n),n.async=!0,n.onload=s,n.onerror=o,e==m.Auto&&(e=!function(){try{var t;if(("undefined"==typeof WebAssembly?"undefined":(t=WebAssembly)&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t)=="object"&&"function"==typeof WebAssembly.instantiate){var e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(i(e,WebAssembly.Module))return i(new WebAssembly.Instance(e),WebAssembly.Instance)}}catch(t){}return!1}()?m.JavaScript:m.WebAssembly),e==m.JavaScript?n.src=t._downgradeModeUrl:e==m.WebAssembly&&(n.src=t._wasmModeUrl)}),o=new Promise(function(e,i){s.then(function(){return window.PHYSX().then(function(i){t._init(i),t._initializeState=2,t._initializePromise=null,console.log("PhysX loaded."),e()},i)},i).catch(i)});return this._initializePromise=o,o},e.destroy=function(){this._physX.PxCloseExtensions(),this._pxPhysics.release(),this._pxFoundation.release(),this._defaultErrorCallback.delete(),this._allocator.delete(),this._tolerancesScale.delete()},e.createPhysicsManager=function(){return new d},e.createPhysicsScene=function(t,e,i,s,o,n,r){return new x(this,t,e,i,s,o,n,r)},e.createStaticCollider=function(t,e){return new g(this,t,e)},e.createDynamicCollider=function(t,e){return new u(this,t,e)},e.createCharacterController=function(){return new _(this)},e.createPhysicsMaterial=function(t,e,i,s,o){return new y(this,t,e,i,s,o)},e.createBoxColliderShape=function(t,e,i){return new l(this,t,e,i)},e.createSphereColliderShape=function(t,e,i){return new M(this,t,e,i)},e.createPlaneColliderShape=function(t,e){return new C(this,t,e)},e.createCapsuleColliderShape=function(t,e,i,s){return new h(this,t,e,i,s)},e.createFixedJoint=function(t){return new S(this,t)},e.createHingeJoint=function(t){return new P(this,t)},e.createSpringJoint=function(t){return new A(this,t)},e.getColliderLayerCollision=function(t,e){return this._physX.getGroupCollisionFlag(t,e)},e.setColliderLayerCollision=function(t,e,i){this._physX.setGroupCollisionFlag(t,e,i)},e._init=function(t){var e=t.PX_PHYSICS_VERSION,i=new t.PxDefaultErrorCallback,s=new t.PxDefaultAllocator,o=t.PxCreateFoundation(e,s,i),n=new t.PxTolerancesScale,r=t.PxCreatePhysics(e,o,n,!1,null);t.PxInitExtensions(r,null),this._physX=t,this._pxFoundation=o,this._pxPhysics=r,this._defaultErrorCallback=i,this._allocator=s,this._tolerancesScale=n},t}(),b="1.6.3";console.log("Galacean Engine Physics PhysX Version: "+b),t.PhysXPhysics=w,t.PhysXRuntimeMode=m,t.version=b,Object.defineProperty(t,"__esModule",{value:!0})});
|
|
2
2
|
//# sourceMappingURL=browser.min.js.map
|
package/dist/main.js
CHANGED
|
@@ -1662,7 +1662,7 @@ PhysXHingeJoint._xAxis = new engine.Vector3(1, 0, 0);
|
|
|
1662
1662
|
}();
|
|
1663
1663
|
|
|
1664
1664
|
//@ts-ignore
|
|
1665
|
-
var version = "1.6.
|
|
1665
|
+
var version = "1.6.3";
|
|
1666
1666
|
console.log("Galacean Engine Physics PhysX Version: " + version);
|
|
1667
1667
|
|
|
1668
1668
|
exports.PhysXPhysics = PhysXPhysics;
|
package/dist/module.js
CHANGED
|
@@ -1658,7 +1658,7 @@ PhysXHingeJoint._xAxis = new Vector3(1, 0, 0);
|
|
|
1658
1658
|
}();
|
|
1659
1659
|
|
|
1660
1660
|
//@ts-ignore
|
|
1661
|
-
var version = "1.6.
|
|
1661
|
+
var version = "1.6.3";
|
|
1662
1662
|
console.log("Galacean Engine Physics PhysX Version: " + version);
|
|
1663
1663
|
|
|
1664
1664
|
export { PhysXPhysics, PhysXRuntimeMode, version };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@galacean/engine-physics-physx",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.3",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
"types/**/*"
|
|
27
27
|
],
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@galacean/engine
|
|
30
|
-
"@galacean/engine": "1.6.
|
|
29
|
+
"@galacean/engine": "1.6.3",
|
|
30
|
+
"@galacean/engine-design": "1.6.3"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"@galacean/engine": "1.6.
|
|
33
|
+
"@galacean/engine": "1.6.3"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"b:types": "tsc"
|