@galacean/engine-physics-physx 1.4.3 → 1.4.5

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
@@ -995,6 +995,7 @@ PhysXPhysicsScene._tempNormal = new Vector3();
995
995
  * a base interface providing common functionality for PhysX joints
996
996
  */ var PhysXJoint = /*#__PURE__*/ function() {
997
997
  function PhysXJoint(physXPhysics) {
998
+ this._rotation = new Quaternion();
998
999
  this._breakForce = Number.MAX_VALUE;
999
1000
  this._breakTorque = Number.MAX_VALUE;
1000
1001
  this._physXPhysics = physXPhysics;
@@ -1010,11 +1011,17 @@ PhysXPhysicsScene._tempNormal = new Vector3();
1010
1011
  * {@inheritDoc IJoint.setConnectedAnchor }
1011
1012
  */ _proto.setAnchor = function setAnchor(value) {
1012
1013
  this._setLocalPose(0, value, PhysXJoint._defaultQuat);
1014
+ this._anchor = value;
1013
1015
  };
1014
1016
  /**
1015
1017
  * {@inheritDoc IJoint.setConnectedAnchor }
1016
1018
  */ _proto.setConnectedAnchor = function setConnectedAnchor(value) {
1017
- this._setLocalPose(1, value, PhysXJoint._defaultQuat);
1019
+ this._setLocalPose(1, value, this._rotation);
1020
+ this._connectedAnchor = value;
1021
+ };
1022
+ _proto.setRotation = function setRotation(value) {
1023
+ this._setLocalPose(1, this._connectedAnchor, value);
1024
+ this._rotation.copyFrom(value);
1018
1025
  };
1019
1026
  /**
1020
1027
  * {@inheritDoc IJoint.setMassScale }
@@ -1089,15 +1096,21 @@ PhysXJoint._defaultQuat = new Quaternion();
1089
1096
  _inherits(PhysXHingeJoint, PhysXJoint1);
1090
1097
  function PhysXHingeJoint(physXPhysics, collider) {
1091
1098
  var _this;
1092
- _this = PhysXJoint1.call(this, physXPhysics) || this, _this._axisRotationQuaternion = new Quaternion();
1099
+ _this = PhysXJoint1.call(this, physXPhysics) || this, _this._axisRotationQuaternion = new Quaternion(), _this._connectedAxisRotationQuaternion = new Quaternion();
1093
1100
  _this._collider = collider;
1094
1101
  _this._pxJoint = physXPhysics._pxPhysics.createRevoluteJoint(collider._pxActor, PhysXJoint._defaultVec, PhysXJoint._defaultQuat, null, PhysXJoint._defaultVec, PhysXJoint._defaultQuat);
1095
1102
  return _this;
1096
1103
  }
1097
1104
  var _proto = PhysXHingeJoint.prototype;
1105
+ _proto.setRotation = function setRotation(value) {
1106
+ var axis = this._axis;
1107
+ this._rotation.copyFrom(value);
1108
+ axis && this.setAxis(axis);
1109
+ };
1098
1110
  /**
1099
1111
  * {@inheritDoc IHingeJoint.setAxis }
1100
1112
  */ _proto.setAxis = function setAxis(value) {
1113
+ this._axis = value;
1101
1114
  var xAxis = PhysXHingeJoint._xAxis;
1102
1115
  var axisRotationQuaternion = this._axisRotationQuaternion;
1103
1116
  xAxis.set(1, 0, 0);
@@ -1105,14 +1118,18 @@ PhysXJoint._defaultQuat = new Quaternion();
1105
1118
  Vector3.cross(xAxis, value, xAxis);
1106
1119
  Quaternion.rotationAxisAngle(xAxis, angle, axisRotationQuaternion);
1107
1120
  this._setLocalPose(0, this._anchor, axisRotationQuaternion);
1108
- this._setLocalPose(1, this._connectedAnchor, axisRotationQuaternion);
1121
+ var connectedAxisRotationQuaternion = this._connectedAxisRotationQuaternion;
1122
+ Quaternion.multiply(this._rotation, axisRotationQuaternion, connectedAxisRotationQuaternion);
1123
+ this._setLocalPose(1, this._connectedAnchor, connectedAxisRotationQuaternion);
1109
1124
  };
1110
1125
  _proto.setAnchor = function setAnchor(value) {
1111
1126
  this._setLocalPose(0, value, this._axisRotationQuaternion);
1112
1127
  this._anchor = value;
1113
1128
  };
1114
- _proto.setConnectedAnchor = function setConnectedAnchor(value) {
1115
- this._setLocalPose(1, value, this._axisRotationQuaternion);
1129
+ /**
1130
+ * {@inheritDoc IJoint.setConnectedAnchor }
1131
+ */ _proto.setConnectedAnchor = function setConnectedAnchor(value) {
1132
+ this._setLocalPose(1, value, this._connectedAxisRotationQuaternion);
1116
1133
  this._connectedAnchor = value;
1117
1134
  };
1118
1135
  /**
@@ -1406,7 +1423,7 @@ PhysXHingeJoint._xAxis = new Vector3(1, 0, 0);
1406
1423
  }();
1407
1424
 
1408
1425
  //@ts-ignore
1409
- var version = "1.4.3";
1426
+ var version = "1.4.5";
1410
1427
  console.log("Galacean Engine Physics PhysX Version: " + version);
1411
1428
 
1412
1429
  export { PhysXPhysics, PhysXRuntimeMode, version };