@galacean/engine-physics-physx 0.0.0-experimental-renderSort.3 → 0.0.0-experimental-shaderlab.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/LICENSE +2 -2
- package/dist/browser.js +37 -22
- 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 +36 -22
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +36 -22
- package/dist/module.js +36 -22
- 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/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);
|
|
@@ -825,15 +833,21 @@ var /**
|
|
|
825
833
|
* {@inheritDoc IPhysicsManager.removeColliderShape }
|
|
826
834
|
*/ _proto.removeColliderShape = function removeColliderShape(colliderShape) {
|
|
827
835
|
var _this = this, eventPool = _this._eventPool, currentEvents = _this._currentEvents;
|
|
828
|
-
var
|
|
836
|
+
var id = colliderShape._id;
|
|
837
|
+
var _this__physXManager = this._physXManager, eventMap = _this__physXManager._eventMap;
|
|
829
838
|
for(var i = currentEvents.length - 1; i >= 0; i--){
|
|
830
839
|
var event = currentEvents.get(i);
|
|
831
|
-
if (event.index1 ==
|
|
840
|
+
if (event.index1 == id) {
|
|
832
841
|
currentEvents.deleteByIndex(i);
|
|
833
842
|
eventPool.push(event);
|
|
843
|
+
} else if (event.index2 == id) {
|
|
844
|
+
currentEvents.deleteByIndex(i);
|
|
845
|
+
eventPool.push(event);
|
|
846
|
+
// If the shape is big index, should clear from the small index shape subMap
|
|
847
|
+
eventMap[event.index1][id] = undefined;
|
|
834
848
|
}
|
|
835
849
|
}
|
|
836
|
-
delete
|
|
850
|
+
delete eventMap[id];
|
|
837
851
|
};
|
|
838
852
|
/**
|
|
839
853
|
* {@inheritDoc IPhysicsManager.addCollider }
|
|
@@ -1256,7 +1270,7 @@ var /**
|
|
|
1256
1270
|
* {@inheritDoc IColliderShape.setWorldScale }
|
|
1257
1271
|
*/ _proto.setWorldScale = function setWorldScale(scale) {
|
|
1258
1272
|
PhysXColliderShape1.prototype.setWorldScale.call(this, scale);
|
|
1259
|
-
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));
|
|
1260
1274
|
this._pxGeometry.radius = this._radius * this._maxScale;
|
|
1261
1275
|
this._pxShape.setGeometry(this._pxGeometry);
|
|
1262
1276
|
};
|
|
@@ -1423,7 +1437,7 @@ var InitializeState;
|
|
|
1423
1437
|
})(InitializeState || (InitializeState = {}));
|
|
1424
1438
|
|
|
1425
1439
|
//@ts-ignore
|
|
1426
|
-
var version = "0.0.0-experimental-
|
|
1440
|
+
var version = "0.0.0-experimental-shaderlab.2";
|
|
1427
1441
|
console.log("Galacean PhysX version: " + version);
|
|
1428
1442
|
|
|
1429
1443
|
exports.PhysXPhysics = PhysXPhysics;
|