@galacean/engine-physics-physx 1.5.8 → 1.5.9
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 +43 -7
- package/dist/browser.js.map +1 -1
- package/dist/browser.min.js +1 -1
- package/dist/browser.min.js.map +1 -1
- package/dist/main.js +43 -7
- package/dist/main.js.map +1 -1
- package/dist/module.js +43 -7
- package/dist/module.js.map +1 -1
- package/package.json +4 -4
- package/types/shape/PhysXBoxColliderShape.d.ts +4 -0
- package/types/shape/PhysXCapsuleColliderShape.d.ts +5 -3
- package/types/shape/PhysXColliderShape.d.ts +0 -1
package/dist/browser.js
CHANGED
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
/** @internal */ this._contractOffset = 0.02;
|
|
45
45
|
/** @internal */ this._worldScale = new engine.Vector3(1, 1, 1);
|
|
46
46
|
/** @internal */ this._position = new engine.Vector3();
|
|
47
|
-
this._rotation = new engine.Vector3();
|
|
47
|
+
/** @internal */ this._rotation = new engine.Vector3();
|
|
48
48
|
this._axis = null;
|
|
49
49
|
this._physXRotation = new engine.Quaternion();
|
|
50
50
|
this._shapeFlags = 2 | 1;
|
|
@@ -186,6 +186,14 @@
|
|
|
186
186
|
this._updateController(tempExtents);
|
|
187
187
|
};
|
|
188
188
|
/**
|
|
189
|
+
* {@inheritDoc IColliderShape.setRotation }
|
|
190
|
+
*/ _proto.setRotation = function setRotation(value) {
|
|
191
|
+
PhysXColliderShape.prototype.setRotation.call(this, value);
|
|
192
|
+
if (this._controllers.length > 0) {
|
|
193
|
+
console.warn("Box character controller `rotation` is not supported in PhysX and will be ignored");
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
/**
|
|
189
197
|
* {@inheritDoc IColliderShape.setWorldScale }
|
|
190
198
|
*/ _proto.setWorldScale = function setWorldScale(scale) {
|
|
191
199
|
PhysXColliderShape.prototype.setWorldScale.call(this, scale);
|
|
@@ -200,8 +208,8 @@
|
|
|
200
208
|
for(var i = 0, n = controllers.length; i < n; i++){
|
|
201
209
|
var pxController = controllers.get(i)._pxController;
|
|
202
210
|
if (pxController) {
|
|
203
|
-
pxController.setHalfHeight(extents.
|
|
204
|
-
pxController.setHalfSideExtent(extents.
|
|
211
|
+
pxController.setHalfHeight(extents.y);
|
|
212
|
+
pxController.setHalfSideExtent(extents.x);
|
|
205
213
|
pxController.setHalfForwardExtent(extents.z);
|
|
206
214
|
}
|
|
207
215
|
}
|
|
@@ -216,7 +224,7 @@
|
|
|
216
224
|
_inherits(PhysXCapsuleColliderShape, PhysXColliderShape1);
|
|
217
225
|
function PhysXCapsuleColliderShape(physXPhysics, uniqueID, radius, height, material) {
|
|
218
226
|
var _this;
|
|
219
|
-
_this = PhysXColliderShape1.call(this, physXPhysics) || this, _this._upAxis = 1;
|
|
227
|
+
_this = PhysXColliderShape1.call(this, physXPhysics) || this, /** @internal */ _this._upAxis = 1;
|
|
220
228
|
_this._radius = radius;
|
|
221
229
|
_this._halfHeight = height * 0.5;
|
|
222
230
|
_this._axis = new engine.Quaternion(0, 0, PhysXColliderShape.halfSqrt, PhysXColliderShape.halfSqrt);
|
|
@@ -276,6 +284,14 @@
|
|
|
276
284
|
}
|
|
277
285
|
};
|
|
278
286
|
/**
|
|
287
|
+
* {@inheritDoc ICapsuleColliderShape.setRotation }
|
|
288
|
+
*/ _proto.setRotation = function setRotation(value) {
|
|
289
|
+
PhysXColliderShape1.prototype.setRotation.call(this, value);
|
|
290
|
+
if (this._controllers.length > 0) {
|
|
291
|
+
console.warn("Capsule character controller `rotation` is not supported in PhysX and will be ignored");
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
/**
|
|
279
295
|
* {@inheritDoc ICapsuleColliderShape.setUpAxis }
|
|
280
296
|
*/ _proto.setUpAxis = function setUpAxis(upAxis) {
|
|
281
297
|
var _this = this, rotation = _this._rotation, axis = _this._axis, physXRotation = _this._physXRotation;
|
|
@@ -298,6 +314,9 @@
|
|
|
298
314
|
physXRotation.copyFrom(axis);
|
|
299
315
|
}
|
|
300
316
|
this._setLocalPose();
|
|
317
|
+
if (this._controllers.length > 0) {
|
|
318
|
+
console.warn("Capsule character controller `upAxis` is not supported in PhysX and will be ignored");
|
|
319
|
+
}
|
|
301
320
|
};
|
|
302
321
|
/**
|
|
303
322
|
* {@inheritDoc IColliderShape.setWorldScale }
|
|
@@ -333,6 +352,14 @@
|
|
|
333
352
|
};
|
|
334
353
|
return PhysXCapsuleColliderShape;
|
|
335
354
|
}(PhysXColliderShape);
|
|
355
|
+
/**
|
|
356
|
+
* The up axis of the collider shape.
|
|
357
|
+
*/ var ColliderShapeUpAxis = /*#__PURE__*/ function(ColliderShapeUpAxis) {
|
|
358
|
+
/** Up axis is X. */ ColliderShapeUpAxis[ColliderShapeUpAxis["X"] = 0] = "X";
|
|
359
|
+
/** Up axis is Y. */ ColliderShapeUpAxis[ColliderShapeUpAxis["Y"] = 1] = "Y";
|
|
360
|
+
/** Up axis is Z. */ ColliderShapeUpAxis[ColliderShapeUpAxis["Z"] = 2] = "Z";
|
|
361
|
+
return ColliderShapeUpAxis;
|
|
362
|
+
}({});
|
|
336
363
|
|
|
337
364
|
/**
|
|
338
365
|
* Base class for character controllers.
|
|
@@ -431,14 +458,23 @@
|
|
|
431
458
|
var desc;
|
|
432
459
|
if (_instanceof(shape, PhysXBoxColliderShape)) {
|
|
433
460
|
desc = new this._physXPhysics._physX.PxBoxControllerDesc();
|
|
434
|
-
desc.halfHeight = shape._halfSize.
|
|
435
|
-
desc.halfSideExtent = shape._halfSize.
|
|
461
|
+
desc.halfHeight = shape._halfSize.y;
|
|
462
|
+
desc.halfSideExtent = shape._halfSize.x;
|
|
436
463
|
desc.halfForwardExtent = shape._halfSize.z;
|
|
464
|
+
if (shape._rotation.lengthSquared() > 0) {
|
|
465
|
+
console.warn("Box character controller `rotation` is not supported in PhysX and will be ignored");
|
|
466
|
+
}
|
|
437
467
|
} else if (_instanceof(shape, PhysXCapsuleColliderShape)) {
|
|
438
468
|
desc = new this._physXPhysics._physX.PxCapsuleControllerDesc();
|
|
439
469
|
desc.radius = shape._radius;
|
|
440
470
|
desc.height = shape._halfHeight * 2;
|
|
441
471
|
desc.climbingMode = 1; // constraint mode
|
|
472
|
+
if (shape._rotation.lengthSquared() > 0) {
|
|
473
|
+
console.warn("Capsule character controller `rotation` is not supported in PhysX and will be ignored");
|
|
474
|
+
}
|
|
475
|
+
if (shape._upAxis !== ColliderShapeUpAxis.Y) {
|
|
476
|
+
console.warn("Capsule character controller `upAxis` is not supported in PhysX and will be ignored");
|
|
477
|
+
}
|
|
442
478
|
} else {
|
|
443
479
|
throw "unsupported shape type";
|
|
444
480
|
}
|
|
@@ -1482,7 +1518,7 @@
|
|
|
1482
1518
|
}();
|
|
1483
1519
|
|
|
1484
1520
|
//@ts-ignore
|
|
1485
|
-
var version = "1.5.
|
|
1521
|
+
var version = "1.5.9";
|
|
1486
1522
|
console.log("Galacean Engine Physics PhysX Version: " + version);
|
|
1487
1523
|
|
|
1488
1524
|
exports.PhysXPhysics = PhysXPhysics;
|