@galacean/engine-core 1.4.4 → 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/main.js +33 -8
- package/dist/main.js.map +1 -1
- package/dist/module.js +33 -8
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/physics/DynamicCollider.d.ts +2 -0
- package/types/physics/joint/Joint.d.ts +3 -0
package/dist/module.js
CHANGED
|
@@ -21312,7 +21312,16 @@ __decorate([
|
|
|
21312
21312
|
*/ _proto._onLateUpdate = function _onLateUpdate() {
|
|
21313
21313
|
var transform = this.entity.transform;
|
|
21314
21314
|
var worldPosition = transform.worldPosition, worldRotationQuaternion = transform.worldRotationQuaternion;
|
|
21315
|
-
|
|
21315
|
+
var outPosition = DynamicCollider._tempVector3;
|
|
21316
|
+
var outRotation = DynamicCollider._tempQuat;
|
|
21317
|
+
this._nativeCollider.getWorldTransform(outPosition, outRotation);
|
|
21318
|
+
// To resolve the issue where onValueChanged is triggered even though the values are equal
|
|
21319
|
+
if (!Vector3.equals(outPosition, worldPosition)) {
|
|
21320
|
+
worldPosition.copyFrom(outPosition);
|
|
21321
|
+
}
|
|
21322
|
+
if (!Quaternion.equals(outRotation, worldRotationQuaternion)) {
|
|
21323
|
+
worldRotationQuaternion.copyFrom(outRotation);
|
|
21324
|
+
}
|
|
21316
21325
|
this._updateFlag.flag = false;
|
|
21317
21326
|
};
|
|
21318
21327
|
/**
|
|
@@ -21647,6 +21656,8 @@ __decorate([
|
|
|
21647
21656
|
]);
|
|
21648
21657
|
return DynamicCollider;
|
|
21649
21658
|
}(Collider);
|
|
21659
|
+
DynamicCollider._tempVector3 = new Vector3();
|
|
21660
|
+
DynamicCollider._tempQuat = new Quaternion();
|
|
21650
21661
|
__decorate([
|
|
21651
21662
|
ignoreClone
|
|
21652
21663
|
], DynamicCollider.prototype, "_linearVelocity", void 0);
|
|
@@ -21861,6 +21872,7 @@ var Joint = /*#__PURE__*/ function(Component) {
|
|
|
21861
21872
|
*/ _proto._onEnableInScene = function _onEnableInScene() {
|
|
21862
21873
|
this._createJoint();
|
|
21863
21874
|
this._syncNative();
|
|
21875
|
+
this._updateRotation();
|
|
21864
21876
|
};
|
|
21865
21877
|
/**
|
|
21866
21878
|
* @internal
|
|
@@ -21889,20 +21901,19 @@ var Joint = /*#__PURE__*/ function(Component) {
|
|
|
21889
21901
|
_proto._calculateConnectedAnchor = function _calculateConnectedAnchor() {
|
|
21890
21902
|
var colliderInfo = this._colliderInfo;
|
|
21891
21903
|
var connectedColliderInfo = this._connectedColliderInfo;
|
|
21892
|
-
var _this_entity_transform = this.entity.transform, selfPos = _this_entity_transform.worldPosition;
|
|
21893
|
-
var selfActualAnchor = colliderInfo.actualAnchor;
|
|
21894
21904
|
var connectedAnchor = connectedColliderInfo.anchor;
|
|
21895
21905
|
var connectedActualAnchor = connectedColliderInfo.actualAnchor;
|
|
21896
21906
|
var connectedCollider = connectedColliderInfo.collider;
|
|
21897
21907
|
// @ts-ignore
|
|
21898
21908
|
connectedAnchor._onValueChanged = null;
|
|
21899
21909
|
if (connectedCollider) {
|
|
21900
|
-
var
|
|
21901
|
-
|
|
21902
|
-
Vector3.
|
|
21903
|
-
|
|
21910
|
+
var tempVector3 = Joint._tempVector3;
|
|
21911
|
+
var tempMatrix = Joint._tempMatrix;
|
|
21912
|
+
Vector3.transformCoordinate(colliderInfo.anchor, this.entity.transform.worldMatrix, tempVector3);
|
|
21913
|
+
Matrix.invert(connectedCollider.entity.transform.worldMatrix, tempMatrix);
|
|
21914
|
+
Vector3.transformCoordinate(tempVector3, tempMatrix, connectedAnchor);
|
|
21904
21915
|
} else {
|
|
21905
|
-
Vector3.
|
|
21916
|
+
Vector3.transformCoordinate(colliderInfo.anchor, this.entity.transform.worldMatrix, connectedActualAnchor);
|
|
21906
21917
|
connectedAnchor.copyFrom(connectedActualAnchor);
|
|
21907
21918
|
}
|
|
21908
21919
|
// @ts-ignore
|
|
@@ -21926,6 +21937,17 @@ var Joint = /*#__PURE__*/ function(Component) {
|
|
|
21926
21937
|
this._updateActualAnchor(2);
|
|
21927
21938
|
}
|
|
21928
21939
|
};
|
|
21940
|
+
_proto._updateRotation = function _updateRotation() {
|
|
21941
|
+
var _this__nativeJoint;
|
|
21942
|
+
var quat = Joint._tempQuat;
|
|
21943
|
+
var connectedColliderInfo = this._connectedColliderInfo;
|
|
21944
|
+
var connectedCollider = connectedColliderInfo.collider;
|
|
21945
|
+
if (connectedCollider) {
|
|
21946
|
+
Quaternion.invert(connectedCollider.entity.transform.worldRotationQuaternion, quat);
|
|
21947
|
+
}
|
|
21948
|
+
Quaternion.multiply(quat, this.entity.transform.worldRotationQuaternion, quat);
|
|
21949
|
+
(_this__nativeJoint = this._nativeJoint) == null ? void 0 : _this__nativeJoint.setRotation(quat);
|
|
21950
|
+
};
|
|
21929
21951
|
_proto._updateActualAnchor = function _updateActualAnchor(flag) {
|
|
21930
21952
|
if (flag & 1) {
|
|
21931
21953
|
var _this__nativeJoint;
|
|
@@ -21963,6 +21985,7 @@ var Joint = /*#__PURE__*/ function(Component) {
|
|
|
21963
21985
|
value == null ? void 0 : value.entity._updateFlagManager.addListener(this._onConnectedTransformChanged);
|
|
21964
21986
|
this._connectedColliderInfo.collider = value;
|
|
21965
21987
|
(_this__nativeJoint = this._nativeJoint) == null ? void 0 : _this__nativeJoint.setConnectedCollider(value == null ? void 0 : value._nativeCollider);
|
|
21988
|
+
this._updateRotation();
|
|
21966
21989
|
if (this._automaticConnectedAnchor) {
|
|
21967
21990
|
this._calculateConnectedAnchor();
|
|
21968
21991
|
} else {
|
|
@@ -22109,6 +22132,8 @@ var Joint = /*#__PURE__*/ function(Component) {
|
|
|
22109
22132
|
return Joint;
|
|
22110
22133
|
}(Component);
|
|
22111
22134
|
Joint._tempVector3 = new Vector3();
|
|
22135
|
+
Joint._tempQuat = new Quaternion();
|
|
22136
|
+
Joint._tempMatrix = new Matrix();
|
|
22112
22137
|
__decorate([
|
|
22113
22138
|
deepClone
|
|
22114
22139
|
], Joint.prototype, "_colliderInfo", void 0);
|