@galacean/engine-physics-physx 1.0.0-beta.9 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Vector3, Quaternion } from '@galacean/engine';
1
+ import { Vector3, Quaternion, version } from '@galacean/engine';
2
2
 
3
3
  function _instanceof(left, right) {
4
4
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
@@ -308,7 +308,7 @@ var ShapeFlag;
308
308
  */ var PhysXColliderShape = /*#__PURE__*/ function() {
309
309
  function PhysXColliderShape(physXPhysics) {
310
310
  /** @internal */ this._controllers = new DisorderedArray();
311
- this._scale = new Vector3(1, 1, 1);
311
+ this._worldScale = new Vector3(1, 1, 1);
312
312
  this._position = new Vector3();
313
313
  this._rotation = null;
314
314
  this._axis = null;
@@ -335,18 +335,18 @@ var ShapeFlag;
335
335
  }
336
336
  var controllers = this._controllers;
337
337
  for(var i = 0, n = controllers.length; i < n; i++){
338
- controllers.get(i)._pxController.setLocalPosition(this._position, this._scale);
338
+ controllers.get(i)._setLocalPosition(this._position, this._worldScale);
339
339
  }
340
340
  this._setLocalPose();
341
341
  };
342
342
  /**
343
343
  * {@inheritDoc IColliderShape.setWorldScale }
344
344
  */ _proto.setWorldScale = function setWorldScale(scale) {
345
- this._scale.copyFrom(scale);
345
+ this._worldScale.copyFrom(scale);
346
346
  this._setLocalPose();
347
347
  var controllers = this._controllers;
348
348
  for(var i = 0, n = controllers.length; i < n; i++){
349
- controllers.get(i)._setLocalPosition(this._position, this._scale);
349
+ controllers.get(i)._setLocalPosition(this._position, this._worldScale);
350
350
  }
351
351
  };
352
352
  /**
@@ -385,7 +385,7 @@ var ShapeFlag;
385
385
  };
386
386
  _proto._setLocalPose = function _setLocalPose() {
387
387
  var transform = PhysXColliderShape.transform;
388
- Vector3.multiply(this._position, this._scale, transform.translation);
388
+ Vector3.multiply(this._position, this._worldScale, transform.translation);
389
389
  transform.rotation = this._physXRotation;
390
390
  this._pxShape.setLocalPose(transform);
391
391
  };
@@ -419,7 +419,7 @@ var ShapeFlag;
419
419
  _this = PhysXColliderShape.call(this, physXPhysics) || this;
420
420
  /** @internal */ _this._halfSize = new Vector3();
421
421
  _this._halfSize.set(size.x * 0.5, size.y * 0.5, size.z * 0.5);
422
- _this._pxGeometry = new physXPhysics._physX.PxBoxGeometry(_this._halfSize.x * _this._scale.x, _this._halfSize.y * _this._scale.y, _this._halfSize.z * _this._scale.z);
422
+ _this._pxGeometry = new physXPhysics._physX.PxBoxGeometry(_this._halfSize.x * _this._worldScale.x, _this._halfSize.y * _this._worldScale.y, _this._halfSize.z * _this._worldScale.z);
423
423
  _this._initialize(material, uniqueID);
424
424
  _this._setLocalPose();
425
425
  return _this;
@@ -430,7 +430,7 @@ var ShapeFlag;
430
430
  */ _proto.setSize = function setSize(value) {
431
431
  var tempExtents = PhysXBoxColliderShape._tempHalfExtents;
432
432
  this._halfSize.set(value.x * 0.5, value.y * 0.5, value.z * 0.5);
433
- Vector3.multiply(this._halfSize, this._scale, tempExtents);
433
+ Vector3.multiply(this._halfSize, this._worldScale, tempExtents);
434
434
  this._pxGeometry.halfExtents = tempExtents;
435
435
  this._pxShape.setGeometry(this._pxGeometry);
436
436
  this._updateController(tempExtents);
@@ -440,7 +440,7 @@ var ShapeFlag;
440
440
  */ _proto.setWorldScale = function setWorldScale(scale) {
441
441
  PhysXColliderShape.prototype.setWorldScale.call(this, scale);
442
442
  var tempExtents = PhysXBoxColliderShape._tempHalfExtents;
443
- Vector3.multiply(this._halfSize, this._scale, tempExtents);
443
+ Vector3.multiply(this._halfSize, this._worldScale, tempExtents);
444
444
  this._pxGeometry.halfExtents = tempExtents;
445
445
  this._pxShape.setGeometry(this._pxGeometry);
446
446
  this._updateController(tempExtents);
@@ -484,13 +484,13 @@ var ShapeFlag;
484
484
  this._radius = value;
485
485
  switch(this._upAxis){
486
486
  case /** Up axis is X. */ 0:
487
- this._pxGeometry.radius = this._radius * Math.max(this._scale.y, this._scale.z);
487
+ this._pxGeometry.radius = this._radius * Math.max(this._worldScale.y, this._worldScale.z);
488
488
  break;
489
489
  case 1:
490
- this._pxGeometry.radius = this._radius * Math.max(this._scale.x, this._scale.z);
490
+ this._pxGeometry.radius = this._radius * Math.max(this._worldScale.x, this._worldScale.z);
491
491
  break;
492
492
  case /** Up axis is Z. */ 2:
493
- this._pxGeometry.radius = this._radius * Math.max(this._scale.x, this._scale.y);
493
+ this._pxGeometry.radius = this._radius * Math.max(this._worldScale.x, this._worldScale.y);
494
494
  break;
495
495
  }
496
496
  this._pxShape.setGeometry(this._pxGeometry);
@@ -506,13 +506,13 @@ var ShapeFlag;
506
506
  this._halfHeight = value * 0.5;
507
507
  switch(this._upAxis){
508
508
  case 0:
509
- this._pxGeometry.halfHeight = this._halfHeight * this._scale.x;
509
+ this._pxGeometry.halfHeight = this._halfHeight * this._worldScale.x;
510
510
  break;
511
511
  case 1:
512
- this._pxGeometry.halfHeight = this._halfHeight * this._scale.y;
512
+ this._pxGeometry.halfHeight = this._halfHeight * this._worldScale.y;
513
513
  break;
514
514
  case 2:
515
- this._pxGeometry.halfHeight = this._halfHeight * this._scale.z;
515
+ this._pxGeometry.halfHeight = this._halfHeight * this._worldScale.z;
516
516
  break;
517
517
  }
518
518
  this._pxShape.setGeometry(this._pxGeometry);
@@ -687,7 +687,7 @@ var /**
687
687
  * @internal
688
688
  */ _proto._setLocalPosition = function _setLocalPosition(position, scale) {
689
689
  Vector3.multiply(position, scale, this._scaledOffset);
690
- this.setWorldPosition(this._position);
690
+ this.setWorldPosition(position);
691
691
  };
692
692
  return PhysXCharacterController;
693
693
  }();
@@ -1239,7 +1239,7 @@ var /**
1239
1239
  * {@inheritDoc IColliderShape.setWorldScale }
1240
1240
  */ _proto.setWorldScale = function setWorldScale(scale) {
1241
1241
  PhysXColliderShape.prototype.setWorldScale.call(this, scale);
1242
- this._maxScale = Math.max(scale.x, Math.max(scale.x, scale.y));
1242
+ this._maxScale = Math.max(scale.x, scale.y, scale.z);
1243
1243
  this._pxGeometry.radius = this._radius * this._maxScale;
1244
1244
  this._pxShape.setGeometry(this._pxGeometry);
1245
1245
  };
@@ -1290,9 +1290,9 @@ var /**
1290
1290
  }
1291
1291
  }
1292
1292
  if (runtimeMode == PhysXRuntimeMode.JavaScript) {
1293
- script.src = "https://gw.alipayobjects.com/os/lib/oasis-engine/physics-physx/1.0.0-alpha.4/libs/physx.release.js.js";
1293
+ script.src = "https://gw.alipayobjects.com/os/lib/galacean/engine-physics-physx/" + version + "/libs/physx.release.js.js";
1294
1294
  } else if (runtimeMode == PhysXRuntimeMode.WebAssembly) {
1295
- script.src = "https://gw.alipayobjects.com/os/lib/oasis-engine/physics-physx/1.0.0-alpha.4/libs/physx.release.js";
1295
+ script.src = "https://gw.alipayobjects.com/os/lib/galacean/engine-physics-physx/" + version + "/libs/physx.release.js";
1296
1296
  }
1297
1297
  });
1298
1298
  var initializePromise = new Promise(function(resolve, reject) {