@galacean/engine-core 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/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/main.js
CHANGED
|
@@ -21316,7 +21316,16 @@ __decorate([
|
|
|
21316
21316
|
*/ _proto._onLateUpdate = function _onLateUpdate() {
|
|
21317
21317
|
var transform = this.entity.transform;
|
|
21318
21318
|
var worldPosition = transform.worldPosition, worldRotationQuaternion = transform.worldRotationQuaternion;
|
|
21319
|
-
|
|
21319
|
+
var outPosition = DynamicCollider._tempVector3;
|
|
21320
|
+
var outRotation = DynamicCollider._tempQuat;
|
|
21321
|
+
this._nativeCollider.getWorldTransform(outPosition, outRotation);
|
|
21322
|
+
// To resolve the issue where onValueChanged is triggered even though the values are equal
|
|
21323
|
+
if (!engineMath.Vector3.equals(outPosition, worldPosition)) {
|
|
21324
|
+
worldPosition.copyFrom(outPosition);
|
|
21325
|
+
}
|
|
21326
|
+
if (!engineMath.Quaternion.equals(outRotation, worldRotationQuaternion)) {
|
|
21327
|
+
worldRotationQuaternion.copyFrom(outRotation);
|
|
21328
|
+
}
|
|
21320
21329
|
this._updateFlag.flag = false;
|
|
21321
21330
|
};
|
|
21322
21331
|
/**
|
|
@@ -21651,6 +21660,8 @@ __decorate([
|
|
|
21651
21660
|
]);
|
|
21652
21661
|
return DynamicCollider;
|
|
21653
21662
|
}(exports.Collider);
|
|
21663
|
+
DynamicCollider._tempVector3 = new engineMath.Vector3();
|
|
21664
|
+
DynamicCollider._tempQuat = new engineMath.Quaternion();
|
|
21654
21665
|
__decorate([
|
|
21655
21666
|
ignoreClone
|
|
21656
21667
|
], DynamicCollider.prototype, "_linearVelocity", void 0);
|
|
@@ -21865,6 +21876,7 @@ exports.Joint = /*#__PURE__*/ function(Component) {
|
|
|
21865
21876
|
*/ _proto._onEnableInScene = function _onEnableInScene() {
|
|
21866
21877
|
this._createJoint();
|
|
21867
21878
|
this._syncNative();
|
|
21879
|
+
this._updateRotation();
|
|
21868
21880
|
};
|
|
21869
21881
|
/**
|
|
21870
21882
|
* @internal
|
|
@@ -21893,20 +21905,19 @@ exports.Joint = /*#__PURE__*/ function(Component) {
|
|
|
21893
21905
|
_proto._calculateConnectedAnchor = function _calculateConnectedAnchor() {
|
|
21894
21906
|
var colliderInfo = this._colliderInfo;
|
|
21895
21907
|
var connectedColliderInfo = this._connectedColliderInfo;
|
|
21896
|
-
var _this_entity_transform = this.entity.transform, selfPos = _this_entity_transform.worldPosition;
|
|
21897
|
-
var selfActualAnchor = colliderInfo.actualAnchor;
|
|
21898
21908
|
var connectedAnchor = connectedColliderInfo.anchor;
|
|
21899
21909
|
var connectedActualAnchor = connectedColliderInfo.actualAnchor;
|
|
21900
21910
|
var connectedCollider = connectedColliderInfo.collider;
|
|
21901
21911
|
// @ts-ignore
|
|
21902
21912
|
connectedAnchor._onValueChanged = null;
|
|
21903
21913
|
if (connectedCollider) {
|
|
21904
|
-
var
|
|
21905
|
-
|
|
21906
|
-
engineMath.Vector3.
|
|
21907
|
-
engineMath.
|
|
21914
|
+
var tempVector3 = Joint._tempVector3;
|
|
21915
|
+
var tempMatrix = Joint._tempMatrix;
|
|
21916
|
+
engineMath.Vector3.transformCoordinate(colliderInfo.anchor, this.entity.transform.worldMatrix, tempVector3);
|
|
21917
|
+
engineMath.Matrix.invert(connectedCollider.entity.transform.worldMatrix, tempMatrix);
|
|
21918
|
+
engineMath.Vector3.transformCoordinate(tempVector3, tempMatrix, connectedAnchor);
|
|
21908
21919
|
} else {
|
|
21909
|
-
engineMath.Vector3.
|
|
21920
|
+
engineMath.Vector3.transformCoordinate(colliderInfo.anchor, this.entity.transform.worldMatrix, connectedActualAnchor);
|
|
21910
21921
|
connectedAnchor.copyFrom(connectedActualAnchor);
|
|
21911
21922
|
}
|
|
21912
21923
|
// @ts-ignore
|
|
@@ -21930,6 +21941,17 @@ exports.Joint = /*#__PURE__*/ function(Component) {
|
|
|
21930
21941
|
this._updateActualAnchor(2);
|
|
21931
21942
|
}
|
|
21932
21943
|
};
|
|
21944
|
+
_proto._updateRotation = function _updateRotation() {
|
|
21945
|
+
var _this__nativeJoint;
|
|
21946
|
+
var quat = Joint._tempQuat;
|
|
21947
|
+
var connectedColliderInfo = this._connectedColliderInfo;
|
|
21948
|
+
var connectedCollider = connectedColliderInfo.collider;
|
|
21949
|
+
if (connectedCollider) {
|
|
21950
|
+
engineMath.Quaternion.invert(connectedCollider.entity.transform.worldRotationQuaternion, quat);
|
|
21951
|
+
}
|
|
21952
|
+
engineMath.Quaternion.multiply(quat, this.entity.transform.worldRotationQuaternion, quat);
|
|
21953
|
+
(_this__nativeJoint = this._nativeJoint) == null ? void 0 : _this__nativeJoint.setRotation(quat);
|
|
21954
|
+
};
|
|
21933
21955
|
_proto._updateActualAnchor = function _updateActualAnchor(flag) {
|
|
21934
21956
|
if (flag & 1) {
|
|
21935
21957
|
var _this__nativeJoint;
|
|
@@ -21967,6 +21989,7 @@ exports.Joint = /*#__PURE__*/ function(Component) {
|
|
|
21967
21989
|
value == null ? void 0 : value.entity._updateFlagManager.addListener(this._onConnectedTransformChanged);
|
|
21968
21990
|
this._connectedColliderInfo.collider = value;
|
|
21969
21991
|
(_this__nativeJoint = this._nativeJoint) == null ? void 0 : _this__nativeJoint.setConnectedCollider(value == null ? void 0 : value._nativeCollider);
|
|
21992
|
+
this._updateRotation();
|
|
21970
21993
|
if (this._automaticConnectedAnchor) {
|
|
21971
21994
|
this._calculateConnectedAnchor();
|
|
21972
21995
|
} else {
|
|
@@ -22113,6 +22136,8 @@ exports.Joint = /*#__PURE__*/ function(Component) {
|
|
|
22113
22136
|
return Joint;
|
|
22114
22137
|
}(Component);
|
|
22115
22138
|
exports.Joint._tempVector3 = new engineMath.Vector3();
|
|
22139
|
+
exports.Joint._tempQuat = new engineMath.Quaternion();
|
|
22140
|
+
exports.Joint._tempMatrix = new engineMath.Matrix();
|
|
22116
22141
|
__decorate([
|
|
22117
22142
|
deepClone
|
|
22118
22143
|
], exports.Joint.prototype, "_colliderInfo", void 0);
|