From b3aa3e0c48fd35b87a8899407feb019dd8305af2 Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Wed, 10 Jan 2024 17:06:34 +0100 Subject: [PATCH] [unity] Fixed GetRepackedSkin issue with polygon packing and 270 degree rotation and atlas is non-square. Closes #2445. --- .../Runtime/spine-unity/Utility/AtlasUtilities.cs | 11 ++++++----- spine-unity/Assets/Spine/package.json | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Utility/AtlasUtilities.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Utility/AtlasUtilities.cs index 7f38e3db1..1587ff414 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Utility/AtlasUtilities.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Utility/AtlasUtilities.cs @@ -740,11 +740,12 @@ namespace Spine.Unity.AttachmentTools { float v2 = uvRect.yMin; if (referenceRegion.degrees == 270) { - // at a 270 degree region, u2/v2 deltas are swapped, and delta-v is negative. - float du = u2 - u; - float dv = v - v2; - u2 = u + dv; - v2 = v - du; + // at a 270 degree region, u2/v2 deltas and atlas width/height are swapped, and delta-v is negative. + float du = uvRect.width; // u2 - u; + float dv = uvRect.height; // v - v2; + float atlasAspectRatio = page.width / page.height; + u2 = u + (dv / atlasAspectRatio); + v2 = v - (du * atlasAspectRatio); } return new AtlasRegion { diff --git a/spine-unity/Assets/Spine/package.json b/spine-unity/Assets/Spine/package.json index 5219d6f12..a37922cd6 100644 --- a/spine-unity/Assets/Spine/package.json +++ b/spine-unity/Assets/Spine/package.json @@ -2,7 +2,7 @@ "name": "com.esotericsoftware.spine.spine-unity", "displayName": "spine-unity Runtime", "description": "This plugin provides the spine-unity runtime core.", - "version": "4.1.33", + "version": "4.1.34", "unity": "2018.3", "author": { "name": "Esoteric Software",