@galacean/engine-physics-physx 1.4.4 → 1.4.6

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 CHANGED
@@ -999,6 +999,7 @@
999
999
  * a base interface providing common functionality for PhysX joints
1000
1000
  */ var PhysXJoint = /*#__PURE__*/ function() {
1001
1001
  function PhysXJoint(physXPhysics) {
1002
+ this._rotation = new engine.Quaternion();
1002
1003
  this._breakForce = Number.MAX_VALUE;
1003
1004
  this._breakTorque = Number.MAX_VALUE;
1004
1005
  this._physXPhysics = physXPhysics;
@@ -1014,11 +1015,17 @@
1014
1015
  * {@inheritDoc IJoint.setConnectedAnchor }
1015
1016
  */ _proto.setAnchor = function setAnchor(value) {
1016
1017
  this._setLocalPose(0, value, PhysXJoint._defaultQuat);
1018
+ this._anchor = value;
1017
1019
  };
1018
1020
  /**
1019
1021
  * {@inheritDoc IJoint.setConnectedAnchor }
1020
1022
  */ _proto.setConnectedAnchor = function setConnectedAnchor(value) {
1021
- this._setLocalPose(1, value, PhysXJoint._defaultQuat);
1023
+ this._setLocalPose(1, value, this._rotation);
1024
+ this._connectedAnchor = value;
1025
+ };
1026
+ _proto.setRotation = function setRotation(value) {
1027
+ this._setLocalPose(1, this._connectedAnchor, value);
1028
+ this._rotation.copyFrom(value);
1022
1029
  };
1023
1030
  /**
1024
1031
  * {@inheritDoc IJoint.setMassScale }
@@ -1093,15 +1100,21 @@
1093
1100
  _inherits(PhysXHingeJoint, PhysXJoint1);
1094
1101
  function PhysXHingeJoint(physXPhysics, collider) {
1095
1102
  var _this;
1096
- _this = PhysXJoint1.call(this, physXPhysics) || this, _this._axisRotationQuaternion = new engine.Quaternion();
1103
+ _this = PhysXJoint1.call(this, physXPhysics) || this, _this._axisRotationQuaternion = new engine.Quaternion(), _this._connectedAxisRotationQuaternion = new engine.Quaternion();
1097
1104
  _this._collider = collider;
1098
1105
  _this._pxJoint = physXPhysics._pxPhysics.createRevoluteJoint(collider._pxActor, PhysXJoint._defaultVec, PhysXJoint._defaultQuat, null, PhysXJoint._defaultVec, PhysXJoint._defaultQuat);
1099
1106
  return _this;
1100
1107
  }
1101
1108
  var _proto = PhysXHingeJoint.prototype;
1109
+ _proto.setRotation = function setRotation(value) {
1110
+ var axis = this._axis;
1111
+ this._rotation.copyFrom(value);
1112
+ axis && this.setAxis(axis);
1113
+ };
1102
1114
  /**
1103
1115
  * {@inheritDoc IHingeJoint.setAxis }
1104
1116
  */ _proto.setAxis = function setAxis(value) {
1117
+ this._axis = value;
1105
1118
  var xAxis = PhysXHingeJoint._xAxis;
1106
1119
  var axisRotationQuaternion = this._axisRotationQuaternion;
1107
1120
  xAxis.set(1, 0, 0);
@@ -1109,14 +1122,18 @@
1109
1122
  engine.Vector3.cross(xAxis, value, xAxis);
1110
1123
  engine.Quaternion.rotationAxisAngle(xAxis, angle, axisRotationQuaternion);
1111
1124
  this._setLocalPose(0, this._anchor, axisRotationQuaternion);
1112
- this._setLocalPose(1, this._connectedAnchor, axisRotationQuaternion);
1125
+ var connectedAxisRotationQuaternion = this._connectedAxisRotationQuaternion;
1126
+ engine.Quaternion.multiply(this._rotation, axisRotationQuaternion, connectedAxisRotationQuaternion);
1127
+ this._setLocalPose(1, this._connectedAnchor, connectedAxisRotationQuaternion);
1113
1128
  };
1114
1129
  _proto.setAnchor = function setAnchor(value) {
1115
1130
  this._setLocalPose(0, value, this._axisRotationQuaternion);
1116
1131
  this._anchor = value;
1117
1132
  };
1118
- _proto.setConnectedAnchor = function setConnectedAnchor(value) {
1119
- this._setLocalPose(1, value, this._axisRotationQuaternion);
1133
+ /**
1134
+ * {@inheritDoc IJoint.setConnectedAnchor }
1135
+ */ _proto.setConnectedAnchor = function setConnectedAnchor(value) {
1136
+ this._setLocalPose(1, value, this._connectedAxisRotationQuaternion);
1120
1137
  this._connectedAnchor = value;
1121
1138
  };
1122
1139
  /**
@@ -1410,7 +1427,7 @@
1410
1427
  }();
1411
1428
 
1412
1429
  //@ts-ignore
1413
- var version = "1.4.4";
1430
+ var version = "1.4.6";
1414
1431
  console.log("Galacean Engine Physics PhysX Version: " + version);
1415
1432
 
1416
1433
  exports.PhysXPhysics = PhysXPhysics;