@galacean/engine-physics-physx 1.5.7 → 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/module.js CHANGED
@@ -40,7 +40,7 @@ function _inherits(subClass, superClass) {
40
40
  /** @internal */ this._contractOffset = 0.02;
41
41
  /** @internal */ this._worldScale = new Vector3(1, 1, 1);
42
42
  /** @internal */ this._position = new Vector3();
43
- this._rotation = new Vector3();
43
+ /** @internal */ this._rotation = new Vector3();
44
44
  this._axis = null;
45
45
  this._physXRotation = new Quaternion();
46
46
  this._shapeFlags = 2 | 1;
@@ -182,6 +182,14 @@ PhysXColliderShape.transform = {
182
182
  this._updateController(tempExtents);
183
183
  };
184
184
  /**
185
+ * {@inheritDoc IColliderShape.setRotation }
186
+ */ _proto.setRotation = function setRotation(value) {
187
+ PhysXColliderShape.prototype.setRotation.call(this, value);
188
+ if (this._controllers.length > 0) {
189
+ console.warn("Box character controller `rotation` is not supported in PhysX and will be ignored");
190
+ }
191
+ };
192
+ /**
185
193
  * {@inheritDoc IColliderShape.setWorldScale }
186
194
  */ _proto.setWorldScale = function setWorldScale(scale) {
187
195
  PhysXColliderShape.prototype.setWorldScale.call(this, scale);
@@ -196,8 +204,8 @@ PhysXColliderShape.transform = {
196
204
  for(var i = 0, n = controllers.length; i < n; i++){
197
205
  var pxController = controllers.get(i)._pxController;
198
206
  if (pxController) {
199
- pxController.setHalfHeight(extents.x);
200
- pxController.setHalfSideExtent(extents.y);
207
+ pxController.setHalfHeight(extents.y);
208
+ pxController.setHalfSideExtent(extents.x);
201
209
  pxController.setHalfForwardExtent(extents.z);
202
210
  }
203
211
  }
@@ -212,7 +220,7 @@ PhysXBoxColliderShape._tempHalfExtents = new Vector3();
212
220
  _inherits(PhysXCapsuleColliderShape, PhysXColliderShape1);
213
221
  function PhysXCapsuleColliderShape(physXPhysics, uniqueID, radius, height, material) {
214
222
  var _this;
215
- _this = PhysXColliderShape1.call(this, physXPhysics) || this, _this._upAxis = 1;
223
+ _this = PhysXColliderShape1.call(this, physXPhysics) || this, /** @internal */ _this._upAxis = 1;
216
224
  _this._radius = radius;
217
225
  _this._halfHeight = height * 0.5;
218
226
  _this._axis = new Quaternion(0, 0, PhysXColliderShape.halfSqrt, PhysXColliderShape.halfSqrt);
@@ -272,6 +280,14 @@ PhysXBoxColliderShape._tempHalfExtents = new Vector3();
272
280
  }
273
281
  };
274
282
  /**
283
+ * {@inheritDoc ICapsuleColliderShape.setRotation }
284
+ */ _proto.setRotation = function setRotation(value) {
285
+ PhysXColliderShape1.prototype.setRotation.call(this, value);
286
+ if (this._controllers.length > 0) {
287
+ console.warn("Capsule character controller `rotation` is not supported in PhysX and will be ignored");
288
+ }
289
+ };
290
+ /**
275
291
  * {@inheritDoc ICapsuleColliderShape.setUpAxis }
276
292
  */ _proto.setUpAxis = function setUpAxis(upAxis) {
277
293
  var _this = this, rotation = _this._rotation, axis = _this._axis, physXRotation = _this._physXRotation;
@@ -294,6 +310,9 @@ PhysXBoxColliderShape._tempHalfExtents = new Vector3();
294
310
  physXRotation.copyFrom(axis);
295
311
  }
296
312
  this._setLocalPose();
313
+ if (this._controllers.length > 0) {
314
+ console.warn("Capsule character controller `upAxis` is not supported in PhysX and will be ignored");
315
+ }
297
316
  };
298
317
  /**
299
318
  * {@inheritDoc IColliderShape.setWorldScale }
@@ -329,6 +348,14 @@ PhysXBoxColliderShape._tempHalfExtents = new Vector3();
329
348
  };
330
349
  return PhysXCapsuleColliderShape;
331
350
  }(PhysXColliderShape);
351
+ /**
352
+ * The up axis of the collider shape.
353
+ */ var ColliderShapeUpAxis = /*#__PURE__*/ function(ColliderShapeUpAxis) {
354
+ /** Up axis is X. */ ColliderShapeUpAxis[ColliderShapeUpAxis["X"] = 0] = "X";
355
+ /** Up axis is Y. */ ColliderShapeUpAxis[ColliderShapeUpAxis["Y"] = 1] = "Y";
356
+ /** Up axis is Z. */ ColliderShapeUpAxis[ColliderShapeUpAxis["Z"] = 2] = "Z";
357
+ return ColliderShapeUpAxis;
358
+ }({});
332
359
 
333
360
  /**
334
361
  * Base class for character controllers.
@@ -427,14 +454,23 @@ PhysXBoxColliderShape._tempHalfExtents = new Vector3();
427
454
  var desc;
428
455
  if (_instanceof(shape, PhysXBoxColliderShape)) {
429
456
  desc = new this._physXPhysics._physX.PxBoxControllerDesc();
430
- desc.halfHeight = shape._halfSize.x;
431
- desc.halfSideExtent = shape._halfSize.y;
457
+ desc.halfHeight = shape._halfSize.y;
458
+ desc.halfSideExtent = shape._halfSize.x;
432
459
  desc.halfForwardExtent = shape._halfSize.z;
460
+ if (shape._rotation.lengthSquared() > 0) {
461
+ console.warn("Box character controller `rotation` is not supported in PhysX and will be ignored");
462
+ }
433
463
  } else if (_instanceof(shape, PhysXCapsuleColliderShape)) {
434
464
  desc = new this._physXPhysics._physX.PxCapsuleControllerDesc();
435
465
  desc.radius = shape._radius;
436
466
  desc.height = shape._halfHeight * 2;
437
467
  desc.climbingMode = 1; // constraint mode
468
+ if (shape._rotation.lengthSquared() > 0) {
469
+ console.warn("Capsule character controller `rotation` is not supported in PhysX and will be ignored");
470
+ }
471
+ if (shape._upAxis !== ColliderShapeUpAxis.Y) {
472
+ console.warn("Capsule character controller `upAxis` is not supported in PhysX and will be ignored");
473
+ }
438
474
  } else {
439
475
  throw "unsupported shape type";
440
476
  }
@@ -1478,7 +1514,7 @@ PhysXHingeJoint._xAxis = new Vector3(1, 0, 0);
1478
1514
  }();
1479
1515
 
1480
1516
  //@ts-ignore
1481
- var version = "1.5.7";
1517
+ var version = "1.5.9";
1482
1518
  console.log("Galacean Engine Physics PhysX Version: " + version);
1483
1519
 
1484
1520
  export { PhysXPhysics, PhysXRuntimeMode, version };