Эх сурвалжийг харах

[unity] Skip SkeletonUtility follow post-local phase if bones are not constrained.

pharan 7 жил өмнө
parent
commit
1d5b62c2fd

+ 17 - 16
spine-unity/Assets/spine-unity/SkeletonUtility/SkeletonUtilityBone.cs

@@ -142,24 +142,25 @@ namespace Spine.Unity {
 						break;
 					case UpdatePhase.World:
 					case UpdatePhase.Complete:
-						// Use Applied transform values (ax, ay, AppliedRotation, ascale) because world values may be modified by constraints.
-						bone.UpdateAppliedTransform();
-
-						if (position)
-							thisTransform.localPosition = new Vector3(bone.ax, bone.ay, 0);
-
-						if (rotation) {
-							if (bone.data.transformMode.InheritsRotation()) {
-								thisTransform.localRotation = Quaternion.Euler(0, 0, bone.AppliedRotation);
-							} else {
-								Vector3 euler = skeletonTransform.rotation.eulerAngles;
-								thisTransform.rotation = Quaternion.Euler(euler.x, euler.y, euler.z + (bone.WorldRotationX * skeletonFlipRotation));
+						// Use Applied transform values (ax, ay, AppliedRotation, ascale) if world values were modified by constraints.
+						if (!bone.appliedValid) {
+							bone.UpdateAppliedTransform();
+							if (position)
+								thisTransform.localPosition = new Vector3(bone.ax, bone.ay, 0);
+
+							if (rotation) {
+								if (bone.data.transformMode.InheritsRotation()) {
+									thisTransform.localRotation = Quaternion.Euler(0, 0, bone.AppliedRotation);
+								} else {
+									Vector3 euler = skeletonTransform.rotation.eulerAngles;
+									thisTransform.rotation = Quaternion.Euler(euler.x, euler.y, euler.z + (bone.WorldRotationX * skeletonFlipRotation));
+								}
 							}
-						}
 
-						if (scale) {
-							thisTransform.localScale = new Vector3(bone.ascaleX, bone.ascaleY, 1f);
-							incompatibleTransformMode = BoneTransformModeIncompatible(bone);
+							if (scale) {
+								thisTransform.localScale = new Vector3(bone.ascaleX, bone.ascaleY, 1f);
+								incompatibleTransformMode = BoneTransformModeIncompatible(bone);
+							}
 						}
 						break;
 				}