@galacean/engine-physics-physx 1.0.0-beta.20 → 1.0.0-beta.21
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 +14 -14
- package/dist/browser.min.js +1 -1
- package/dist/main.js +14 -14
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +14 -14
- package/dist/module.js +14 -14
- package/dist/module.js.map +1 -1
- package/package.json +4 -4
- package/types/shape/PhysXColliderShape.d.ts +2 -2
package/dist/miniprogram.js
CHANGED
|
@@ -313,7 +313,7 @@ var ShapeFlag;
|
|
|
313
313
|
*/ var PhysXColliderShape = /*#__PURE__*/ function() {
|
|
314
314
|
function PhysXColliderShape(physXPhysics) {
|
|
315
315
|
/** @internal */ this._controllers = new DisorderedArray();
|
|
316
|
-
this.
|
|
316
|
+
this._worldScale = new miniprogram.Vector3(1, 1, 1);
|
|
317
317
|
this._position = new miniprogram.Vector3();
|
|
318
318
|
this._rotation = null;
|
|
319
319
|
this._axis = null;
|
|
@@ -340,18 +340,18 @@ var ShapeFlag;
|
|
|
340
340
|
}
|
|
341
341
|
var controllers = this._controllers;
|
|
342
342
|
for(var i = 0, n = controllers.length; i < n; i++){
|
|
343
|
-
controllers.get(i)._setLocalPosition(this._position, this.
|
|
343
|
+
controllers.get(i)._setLocalPosition(this._position, this._worldScale);
|
|
344
344
|
}
|
|
345
345
|
this._setLocalPose();
|
|
346
346
|
};
|
|
347
347
|
/**
|
|
348
348
|
* {@inheritDoc IColliderShape.setWorldScale }
|
|
349
349
|
*/ _proto.setWorldScale = function setWorldScale(scale) {
|
|
350
|
-
this.
|
|
350
|
+
this._worldScale.copyFrom(scale);
|
|
351
351
|
this._setLocalPose();
|
|
352
352
|
var controllers = this._controllers;
|
|
353
353
|
for(var i = 0, n = controllers.length; i < n; i++){
|
|
354
|
-
controllers.get(i)._setLocalPosition(this._position, this.
|
|
354
|
+
controllers.get(i)._setLocalPosition(this._position, this._worldScale);
|
|
355
355
|
}
|
|
356
356
|
};
|
|
357
357
|
/**
|
|
@@ -390,7 +390,7 @@ var ShapeFlag;
|
|
|
390
390
|
};
|
|
391
391
|
_proto._setLocalPose = function _setLocalPose() {
|
|
392
392
|
var transform = PhysXColliderShape.transform;
|
|
393
|
-
miniprogram.Vector3.multiply(this._position, this.
|
|
393
|
+
miniprogram.Vector3.multiply(this._position, this._worldScale, transform.translation);
|
|
394
394
|
transform.rotation = this._physXRotation;
|
|
395
395
|
this._pxShape.setLocalPose(transform);
|
|
396
396
|
};
|
|
@@ -424,7 +424,7 @@ var ShapeFlag;
|
|
|
424
424
|
_this = PhysXColliderShape.call(this, physXPhysics) || this;
|
|
425
425
|
/** @internal */ _this._halfSize = new miniprogram.Vector3();
|
|
426
426
|
_this._halfSize.set(size.x * 0.5, size.y * 0.5, size.z * 0.5);
|
|
427
|
-
_this._pxGeometry = new physXPhysics._physX.PxBoxGeometry(_this._halfSize.x * _this.
|
|
427
|
+
_this._pxGeometry = new physXPhysics._physX.PxBoxGeometry(_this._halfSize.x * _this._worldScale.x, _this._halfSize.y * _this._worldScale.y, _this._halfSize.z * _this._worldScale.z);
|
|
428
428
|
_this._initialize(material, uniqueID);
|
|
429
429
|
_this._setLocalPose();
|
|
430
430
|
return _this;
|
|
@@ -435,7 +435,7 @@ var ShapeFlag;
|
|
|
435
435
|
*/ _proto.setSize = function setSize(value) {
|
|
436
436
|
var tempExtents = PhysXBoxColliderShape._tempHalfExtents;
|
|
437
437
|
this._halfSize.set(value.x * 0.5, value.y * 0.5, value.z * 0.5);
|
|
438
|
-
miniprogram.Vector3.multiply(this._halfSize, this.
|
|
438
|
+
miniprogram.Vector3.multiply(this._halfSize, this._worldScale, tempExtents);
|
|
439
439
|
this._pxGeometry.halfExtents = tempExtents;
|
|
440
440
|
this._pxShape.setGeometry(this._pxGeometry);
|
|
441
441
|
this._updateController(tempExtents);
|
|
@@ -445,7 +445,7 @@ var ShapeFlag;
|
|
|
445
445
|
*/ _proto.setWorldScale = function setWorldScale(scale) {
|
|
446
446
|
PhysXColliderShape.prototype.setWorldScale.call(this, scale);
|
|
447
447
|
var tempExtents = PhysXBoxColliderShape._tempHalfExtents;
|
|
448
|
-
miniprogram.Vector3.multiply(this._halfSize, this.
|
|
448
|
+
miniprogram.Vector3.multiply(this._halfSize, this._worldScale, tempExtents);
|
|
449
449
|
this._pxGeometry.halfExtents = tempExtents;
|
|
450
450
|
this._pxShape.setGeometry(this._pxGeometry);
|
|
451
451
|
this._updateController(tempExtents);
|
|
@@ -489,13 +489,13 @@ var ShapeFlag;
|
|
|
489
489
|
this._radius = value;
|
|
490
490
|
switch(this._upAxis){
|
|
491
491
|
case /** Up axis is X. */ 0:
|
|
492
|
-
this._pxGeometry.radius = this._radius * Math.max(this.
|
|
492
|
+
this._pxGeometry.radius = this._radius * Math.max(this._worldScale.y, this._worldScale.z);
|
|
493
493
|
break;
|
|
494
494
|
case 1:
|
|
495
|
-
this._pxGeometry.radius = this._radius * Math.max(this.
|
|
495
|
+
this._pxGeometry.radius = this._radius * Math.max(this._worldScale.x, this._worldScale.z);
|
|
496
496
|
break;
|
|
497
497
|
case /** Up axis is Z. */ 2:
|
|
498
|
-
this._pxGeometry.radius = this._radius * Math.max(this.
|
|
498
|
+
this._pxGeometry.radius = this._radius * Math.max(this._worldScale.x, this._worldScale.y);
|
|
499
499
|
break;
|
|
500
500
|
}
|
|
501
501
|
this._pxShape.setGeometry(this._pxGeometry);
|
|
@@ -511,13 +511,13 @@ var ShapeFlag;
|
|
|
511
511
|
this._halfHeight = value * 0.5;
|
|
512
512
|
switch(this._upAxis){
|
|
513
513
|
case 0:
|
|
514
|
-
this._pxGeometry.halfHeight = this._halfHeight * this.
|
|
514
|
+
this._pxGeometry.halfHeight = this._halfHeight * this._worldScale.x;
|
|
515
515
|
break;
|
|
516
516
|
case 1:
|
|
517
|
-
this._pxGeometry.halfHeight = this._halfHeight * this.
|
|
517
|
+
this._pxGeometry.halfHeight = this._halfHeight * this._worldScale.y;
|
|
518
518
|
break;
|
|
519
519
|
case 2:
|
|
520
|
-
this._pxGeometry.halfHeight = this._halfHeight * this.
|
|
520
|
+
this._pxGeometry.halfHeight = this._halfHeight * this._worldScale.z;
|
|
521
521
|
break;
|
|
522
522
|
}
|
|
523
523
|
this._pxShape.setGeometry(this._pxGeometry);
|
package/dist/module.js
CHANGED
|
@@ -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.
|
|
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)._setLocalPosition(this._position, this.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
509
|
+
this._pxGeometry.halfHeight = this._halfHeight * this._worldScale.x;
|
|
510
510
|
break;
|
|
511
511
|
case 1:
|
|
512
|
-
this._pxGeometry.halfHeight = this._halfHeight * this.
|
|
512
|
+
this._pxGeometry.halfHeight = this._halfHeight * this._worldScale.y;
|
|
513
513
|
break;
|
|
514
514
|
case 2:
|
|
515
|
-
this._pxGeometry.halfHeight = this._halfHeight * this.
|
|
515
|
+
this._pxGeometry.halfHeight = this._halfHeight * this._worldScale.z;
|
|
516
516
|
break;
|
|
517
517
|
}
|
|
518
518
|
this._pxShape.setGeometry(this._pxGeometry);
|