mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-15 11:31:37 +08:00
[unity] Fixed Sprite.ToAtlasRegion and SpriteAttacher example script ignoring pivot in 4.1. Closes #2109. Issue was introduced in commit 9ecf28b, see #1884.
This commit is contained in:
parent
514469f45b
commit
766105189f
@ -193,6 +193,10 @@ namespace Spine.Unity.AttachmentTools {
|
||||
region.index = -1;
|
||||
region.degrees = s.packed && s.packingRotation != SpritePackingRotation.None ? 90 : 0;
|
||||
|
||||
// World space units
|
||||
Bounds bounds = s.bounds;
|
||||
Vector2 boundsMin = bounds.min, boundsMax = bounds.max;
|
||||
|
||||
// Texture space/pixel units
|
||||
Rect spineRect = s.textureRect.SpineUnityFlipRect(s.texture.height);
|
||||
Rect originalRect = s.rect;
|
||||
@ -200,8 +204,8 @@ namespace Spine.Unity.AttachmentTools {
|
||||
region.originalWidth = (int)originalRect.width;
|
||||
region.height = (int)spineRect.height;
|
||||
region.originalHeight = (int)originalRect.height;
|
||||
region.offsetX = s.textureRectOffset.x;
|
||||
region.offsetY = s.textureRectOffset.y;
|
||||
region.offsetX = s.textureRectOffset.x + spineRect.width * (0.5f - InverseLerp(boundsMin.x, boundsMax.x, 0));
|
||||
region.offsetY = s.textureRectOffset.y + spineRect.height * (0.5f - InverseLerp(boundsMin.y, boundsMax.y, 0));
|
||||
|
||||
if (isolatedTexture) {
|
||||
region.u = 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user