@galacean/engine-physics-physx 1.2.0-beta.1 → 1.2.0-beta.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 +28 -19
- package/dist/browser.js.map +1 -0
- package/dist/browser.min.js +2 -1
- package/dist/browser.min.js.map +1 -0
- package/dist/main.js +27 -19
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +27 -19
- package/dist/module.js +27 -19
- package/dist/module.js.map +1 -1
- package/package.json +4 -4
- package/types/shape/PhysXBoxColliderShape.d.ts +1 -0
- package/types/shape/PhysXCapsuleColliderShape.d.ts +1 -0
- package/types/StaticInterfaceImplement.d.ts +0 -5
package/dist/main.js
CHANGED
|
@@ -196,8 +196,10 @@ var ShapeFlag;
|
|
|
196
196
|
var _this;
|
|
197
197
|
_this = PhysXColliderShape1.call(this, physXPhysics) || this;
|
|
198
198
|
/** @internal */ _this._halfSize = new engine.Vector3();
|
|
199
|
-
_this.
|
|
200
|
-
|
|
199
|
+
_this._sizeScale = new engine.Vector3(1, 1, 1);
|
|
200
|
+
var halfSize = _this._halfSize;
|
|
201
|
+
halfSize.set(size.x * 0.5, size.y * 0.5, size.z * 0.5);
|
|
202
|
+
_this._pxGeometry = new physXPhysics._physX.PxBoxGeometry(halfSize.x, halfSize.y, halfSize.z);
|
|
201
203
|
_this._initialize(material, uniqueID);
|
|
202
204
|
_this._setLocalPose();
|
|
203
205
|
return _this;
|
|
@@ -206,9 +208,10 @@ var ShapeFlag;
|
|
|
206
208
|
/**
|
|
207
209
|
* {@inheritDoc IBoxColliderShape.setSize }
|
|
208
210
|
*/ _proto.setSize = function setSize(value) {
|
|
211
|
+
var halfSize = this._halfSize;
|
|
209
212
|
var tempExtents = PhysXBoxColliderShape._tempHalfExtents;
|
|
210
|
-
|
|
211
|
-
engine.Vector3.multiply(
|
|
213
|
+
halfSize.set(value.x * 0.5, value.y * 0.5, value.z * 0.5);
|
|
214
|
+
engine.Vector3.multiply(halfSize, this._sizeScale, tempExtents);
|
|
212
215
|
this._pxGeometry.halfExtents = tempExtents;
|
|
213
216
|
this._pxShape.setGeometry(this._pxGeometry);
|
|
214
217
|
this._updateController(tempExtents);
|
|
@@ -217,8 +220,9 @@ var ShapeFlag;
|
|
|
217
220
|
* {@inheritDoc IColliderShape.setWorldScale }
|
|
218
221
|
*/ _proto.setWorldScale = function setWorldScale(scale) {
|
|
219
222
|
PhysXColliderShape1.prototype.setWorldScale.call(this, scale);
|
|
223
|
+
this._sizeScale.set(Math.abs(scale.x), Math.abs(scale.y), Math.abs(scale.z));
|
|
220
224
|
var tempExtents = PhysXBoxColliderShape._tempHalfExtents;
|
|
221
|
-
engine.Vector3.multiply(this._halfSize, this.
|
|
225
|
+
engine.Vector3.multiply(this._halfSize, this._sizeScale, tempExtents);
|
|
222
226
|
this._pxGeometry.halfExtents = tempExtents;
|
|
223
227
|
this._pxShape.setGeometry(this._pxGeometry);
|
|
224
228
|
this._updateController(tempExtents);
|
|
@@ -246,6 +250,7 @@ var ShapeFlag;
|
|
|
246
250
|
var _this;
|
|
247
251
|
_this = PhysXColliderShape1.call(this, physXPhysics) || this;
|
|
248
252
|
_this._upAxis = /** Up axis is Y. */ 1;
|
|
253
|
+
_this._sizeScale = new engine.Vector3(1, 1, 1);
|
|
249
254
|
_this._radius = radius;
|
|
250
255
|
_this._halfHeight = height * 0.5;
|
|
251
256
|
_this._axis = new engine.Quaternion(0, 0, PhysXColliderShape.halfSqrt, PhysXColliderShape.halfSqrt);
|
|
@@ -260,15 +265,16 @@ var ShapeFlag;
|
|
|
260
265
|
* {@inheritDoc ICapsuleColliderShape.setRadius }
|
|
261
266
|
*/ _proto.setRadius = function setRadius(value) {
|
|
262
267
|
this._radius = value;
|
|
268
|
+
var sizeScale = this._sizeScale;
|
|
263
269
|
switch(this._upAxis){
|
|
264
270
|
case /** Up axis is X. */ 0:
|
|
265
|
-
this._pxGeometry.radius = this._radius * Math.max(
|
|
271
|
+
this._pxGeometry.radius = this._radius * Math.max(sizeScale.y, sizeScale.z);
|
|
266
272
|
break;
|
|
267
273
|
case 1:
|
|
268
|
-
this._pxGeometry.radius = this._radius * Math.max(
|
|
274
|
+
this._pxGeometry.radius = this._radius * Math.max(sizeScale.x, sizeScale.z);
|
|
269
275
|
break;
|
|
270
276
|
case /** Up axis is Z. */ 2:
|
|
271
|
-
this._pxGeometry.radius = this._radius * Math.max(
|
|
277
|
+
this._pxGeometry.radius = this._radius * Math.max(sizeScale.x, sizeScale.y);
|
|
272
278
|
break;
|
|
273
279
|
}
|
|
274
280
|
this._pxShape.setGeometry(this._pxGeometry);
|
|
@@ -282,15 +288,16 @@ var ShapeFlag;
|
|
|
282
288
|
* {@inheritDoc ICapsuleColliderShape.setHeight }
|
|
283
289
|
*/ _proto.setHeight = function setHeight(value) {
|
|
284
290
|
this._halfHeight = value * 0.5;
|
|
291
|
+
var sizeScale = this._sizeScale;
|
|
285
292
|
switch(this._upAxis){
|
|
286
293
|
case 0:
|
|
287
|
-
this._pxGeometry.halfHeight = this._halfHeight *
|
|
294
|
+
this._pxGeometry.halfHeight = this._halfHeight * sizeScale.x;
|
|
288
295
|
break;
|
|
289
296
|
case 1:
|
|
290
|
-
this._pxGeometry.halfHeight = this._halfHeight *
|
|
297
|
+
this._pxGeometry.halfHeight = this._halfHeight * sizeScale.y;
|
|
291
298
|
break;
|
|
292
299
|
case 2:
|
|
293
|
-
this._pxGeometry.halfHeight = this._halfHeight *
|
|
300
|
+
this._pxGeometry.halfHeight = this._halfHeight * sizeScale.z;
|
|
294
301
|
break;
|
|
295
302
|
}
|
|
296
303
|
this._pxShape.setGeometry(this._pxGeometry);
|
|
@@ -328,19 +335,20 @@ var ShapeFlag;
|
|
|
328
335
|
* {@inheritDoc IColliderShape.setWorldScale }
|
|
329
336
|
*/ _proto.setWorldScale = function setWorldScale(scale) {
|
|
330
337
|
PhysXColliderShape1.prototype.setWorldScale.call(this, scale);
|
|
338
|
+
var sizeScale = this._sizeScale.set(Math.abs(scale.x), Math.abs(scale.y), Math.abs(scale.z));
|
|
331
339
|
var geometry = this._pxGeometry;
|
|
332
340
|
switch(this._upAxis){
|
|
333
341
|
case 0:
|
|
334
|
-
geometry.radius = this._radius * Math.max(
|
|
335
|
-
geometry.halfHeight = this._halfHeight *
|
|
342
|
+
geometry.radius = this._radius * Math.max(sizeScale.y, sizeScale.z);
|
|
343
|
+
geometry.halfHeight = this._halfHeight * sizeScale.x;
|
|
336
344
|
break;
|
|
337
345
|
case 1:
|
|
338
|
-
geometry.radius = this._radius * Math.max(
|
|
339
|
-
geometry.halfHeight = this._halfHeight *
|
|
346
|
+
geometry.radius = this._radius * Math.max(sizeScale.x, sizeScale.z);
|
|
347
|
+
geometry.halfHeight = this._halfHeight * sizeScale.y;
|
|
340
348
|
break;
|
|
341
349
|
case 2:
|
|
342
|
-
geometry.radius = this._radius * Math.max(
|
|
343
|
-
geometry.halfHeight = this._halfHeight *
|
|
350
|
+
geometry.radius = this._radius * Math.max(sizeScale.x, sizeScale.y);
|
|
351
|
+
geometry.halfHeight = this._halfHeight * sizeScale.z;
|
|
344
352
|
break;
|
|
345
353
|
}
|
|
346
354
|
this._pxShape.setGeometry(geometry);
|
|
@@ -1262,7 +1270,7 @@ var /**
|
|
|
1262
1270
|
* {@inheritDoc IColliderShape.setWorldScale }
|
|
1263
1271
|
*/ _proto.setWorldScale = function setWorldScale(scale) {
|
|
1264
1272
|
PhysXColliderShape1.prototype.setWorldScale.call(this, scale);
|
|
1265
|
-
this._maxScale = Math.max(scale.x, scale.y, scale.z);
|
|
1273
|
+
this._maxScale = Math.max(Math.abs(scale.x), Math.abs(scale.y), Math.abs(scale.z));
|
|
1266
1274
|
this._pxGeometry.radius = this._radius * this._maxScale;
|
|
1267
1275
|
this._pxShape.setGeometry(this._pxGeometry);
|
|
1268
1276
|
};
|
|
@@ -1429,7 +1437,7 @@ var InitializeState;
|
|
|
1429
1437
|
})(InitializeState || (InitializeState = {}));
|
|
1430
1438
|
|
|
1431
1439
|
//@ts-ignore
|
|
1432
|
-
var version = "1.2.0-beta.
|
|
1440
|
+
var version = "1.2.0-beta.3";
|
|
1433
1441
|
console.log("Galacean PhysX version: " + version);
|
|
1434
1442
|
|
|
1435
1443
|
exports.PhysXPhysics = PhysXPhysics;
|