@galacean/engine-core 1.4.0 → 1.4.1
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/main.js +32 -20
- package/dist/main.js.map +1 -1
- package/dist/module.js +32 -20
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/physics/joint/HingeJoint.d.ts +2 -1
- package/types/physics/joint/Joint.d.ts +1 -1
package/dist/module.js
CHANGED
|
@@ -21837,9 +21837,9 @@ var Joint = /*#__PURE__*/ function(Component) {
|
|
|
21837
21837
|
_this = Component.call(this, entity) || this, _this._colliderInfo = new JointColliderInfo(), _this._connectedColliderInfo = new JointColliderInfo(), _this._force = Infinity, _this._torque = Infinity, _this._automaticConnectedAnchor = true;
|
|
21838
21838
|
//@ts-ignore
|
|
21839
21839
|
_this._colliderInfo.anchor._onValueChanged = _this._updateActualAnchor.bind(_this, 1);
|
|
21840
|
-
_this.
|
|
21840
|
+
_this._handleConnectedAnchorChanged = _this._handleConnectedAnchorChanged.bind(_this);
|
|
21841
21841
|
//@ts-ignore
|
|
21842
|
-
_this._connectedColliderInfo.anchor._onValueChanged = _this.
|
|
21842
|
+
_this._connectedColliderInfo.anchor._onValueChanged = _this._handleConnectedAnchorChanged.bind(_this);
|
|
21843
21843
|
_this._onSelfTransformChanged = _this._onSelfTransformChanged.bind(_this);
|
|
21844
21844
|
_this._onConnectedTransformChanged = _this._onConnectedTransformChanged.bind(_this);
|
|
21845
21845
|
// @ts-ignore
|
|
@@ -21885,6 +21885,8 @@ var Joint = /*#__PURE__*/ function(Component) {
|
|
|
21885
21885
|
var connectedAnchor = connectedColliderInfo.anchor;
|
|
21886
21886
|
var connectedActualAnchor = connectedColliderInfo.actualAnchor;
|
|
21887
21887
|
var connectedCollider = connectedColliderInfo.collider;
|
|
21888
|
+
// @ts-ignore
|
|
21889
|
+
connectedAnchor._onValueChanged = null;
|
|
21888
21890
|
if (connectedCollider) {
|
|
21889
21891
|
var _connectedCollider_entity_transform = connectedCollider.entity.transform, connectedPos = _connectedCollider_entity_transform.worldPosition, connectedWorldScale = _connectedCollider_entity_transform.lossyWorldScale;
|
|
21890
21892
|
Vector3.subtract(selfPos, connectedPos, Joint._tempVector3);
|
|
@@ -21894,6 +21896,16 @@ var Joint = /*#__PURE__*/ function(Component) {
|
|
|
21894
21896
|
Vector3.add(selfPos, selfActualAnchor, connectedActualAnchor);
|
|
21895
21897
|
connectedAnchor.copyFrom(connectedActualAnchor);
|
|
21896
21898
|
}
|
|
21899
|
+
// @ts-ignore
|
|
21900
|
+
connectedAnchor._onValueChanged = this._handleConnectedAnchorChanged;
|
|
21901
|
+
this._updateActualAnchor(2);
|
|
21902
|
+
};
|
|
21903
|
+
_proto._handleConnectedAnchorChanged = function _handleConnectedAnchorChanged() {
|
|
21904
|
+
if (this._automaticConnectedAnchor) {
|
|
21905
|
+
console.warn("Cannot set connectedAnchor when automaticConnectedAnchor is true.");
|
|
21906
|
+
} else {
|
|
21907
|
+
this._updateActualAnchor(2);
|
|
21908
|
+
}
|
|
21897
21909
|
};
|
|
21898
21910
|
_proto._onSelfTransformChanged = function _onSelfTransformChanged(type) {
|
|
21899
21911
|
if (type & TransformModifyFlags.WorldScale) {
|
|
@@ -21973,25 +21985,12 @@ var Joint = /*#__PURE__*/ function(Component) {
|
|
|
21973
21985
|
* @remarks If connectedCollider is set, this anchor is relative offset, or the anchor is world position.
|
|
21974
21986
|
* The connectedAnchor is automatically calculated, if you want to set it manually, please set automaticConnectedAnchor to false
|
|
21975
21987
|
*/ function get() {
|
|
21976
|
-
|
|
21977
|
-
if (this._automaticConnectedAnchor) {
|
|
21978
|
-
//@ts-ignore
|
|
21979
|
-
connectedColliderAnchor._onValueChanged = null;
|
|
21980
|
-
this._calculateConnectedAnchor();
|
|
21981
|
-
//@ts-ignore
|
|
21982
|
-
connectedColliderAnchor._onValueChanged = this._updateConnectedActualAnchor;
|
|
21983
|
-
}
|
|
21984
|
-
return connectedColliderAnchor;
|
|
21988
|
+
return this._connectedColliderInfo.anchor;
|
|
21985
21989
|
},
|
|
21986
21990
|
set: function set(value) {
|
|
21987
|
-
if (this._automaticConnectedAnchor) {
|
|
21988
|
-
console.warn("Cannot set connectedAnchor when automaticConnectedAnchor is true.");
|
|
21989
|
-
return;
|
|
21990
|
-
}
|
|
21991
21991
|
var connectedAnchor = this._connectedColliderInfo.anchor;
|
|
21992
21992
|
if (value !== connectedAnchor) {
|
|
21993
21993
|
connectedAnchor.copyFrom(value);
|
|
21994
|
-
this._updateActualAnchor(2);
|
|
21995
21994
|
}
|
|
21996
21995
|
}
|
|
21997
21996
|
},
|
|
@@ -22112,7 +22111,7 @@ __decorate([
|
|
|
22112
22111
|
], Joint.prototype, "_nativeJoint", void 0);
|
|
22113
22112
|
__decorate([
|
|
22114
22113
|
ignoreClone
|
|
22115
|
-
], Joint.prototype, "
|
|
22114
|
+
], Joint.prototype, "_handleConnectedAnchorChanged", null);
|
|
22116
22115
|
__decorate([
|
|
22117
22116
|
ignoreClone
|
|
22118
22117
|
], Joint.prototype, "_onSelfTransformChanged", null);
|
|
@@ -22174,6 +22173,9 @@ __decorate([
|
|
|
22174
22173
|
_this = Joint.call(this, entity) || this, _this._axis = new Vector3(1, 0, 0), _this._hingeFlags = HingeJointFlag.None, _this._useSpring = false, _this._angle = 0, _this._velocity = 0;
|
|
22175
22174
|
_this._onMotorChanged = _this._onMotorChanged.bind(_this);
|
|
22176
22175
|
_this._onLimitsChanged = _this._onLimitsChanged.bind(_this);
|
|
22176
|
+
_this._onAxisChanged = _this._onAxisChanged.bind(_this);
|
|
22177
|
+
//@ts-ignore
|
|
22178
|
+
_this._axis._onValueChanged = _this._onAxisChanged;
|
|
22177
22179
|
return _this;
|
|
22178
22180
|
}
|
|
22179
22181
|
var _proto = HingeJoint.prototype;
|
|
@@ -22222,20 +22224,27 @@ __decorate([
|
|
|
22222
22224
|
}
|
|
22223
22225
|
}
|
|
22224
22226
|
};
|
|
22227
|
+
_proto._onAxisChanged = function _onAxisChanged() {
|
|
22228
|
+
var _this__nativeJoint;
|
|
22229
|
+
//@ts-ignore
|
|
22230
|
+
this._axis._onValueChanged = null;
|
|
22231
|
+
this._axis.normalize();
|
|
22232
|
+
(_this__nativeJoint = this._nativeJoint) == null ? void 0 : _this__nativeJoint.setAxis(this._axis);
|
|
22233
|
+
//@ts-ignore
|
|
22234
|
+
this._axis._onValueChanged = this._onAxisChanged;
|
|
22235
|
+
};
|
|
22225
22236
|
_create_class(HingeJoint, [
|
|
22226
22237
|
{
|
|
22227
22238
|
key: "axis",
|
|
22228
22239
|
get: /**
|
|
22229
|
-
* The
|
|
22240
|
+
* The Direction of the axis around which the hingeJoint.
|
|
22230
22241
|
*/ function get() {
|
|
22231
22242
|
return this._axis;
|
|
22232
22243
|
},
|
|
22233
22244
|
set: function set(value) {
|
|
22234
22245
|
var axis = this._axis;
|
|
22235
22246
|
if (value !== axis) {
|
|
22236
|
-
var _this__nativeJoint;
|
|
22237
22247
|
axis.copyFrom(value);
|
|
22238
|
-
(_this__nativeJoint = this._nativeJoint) == null ? void 0 : _this__nativeJoint.setAxis(axis);
|
|
22239
22248
|
}
|
|
22240
22249
|
}
|
|
22241
22250
|
},
|
|
@@ -22359,6 +22368,9 @@ __decorate([
|
|
|
22359
22368
|
__decorate([
|
|
22360
22369
|
ignoreClone
|
|
22361
22370
|
], HingeJoint.prototype, "_onLimitsChanged", null);
|
|
22371
|
+
__decorate([
|
|
22372
|
+
ignoreClone
|
|
22373
|
+
], HingeJoint.prototype, "_onAxisChanged", null);
|
|
22362
22374
|
|
|
22363
22375
|
/**
|
|
22364
22376
|
* A joint that maintains an upper or lower bound (or both) on the distance between two points on different objects.
|