- Изменено
[UNITY] AtlasRegion with 270 degrees isn't rotated
I added skin atlas repacking and encountered an issue where some of my regions weren't being rotated properly.
This is the problematic code:
// \Spine\Runtime\spine-sharp\Atlas.cs
if (region.degrees == 90) {
region.u2 = (region.x + region.height) / (float)page.width;
region.v2 = (region.y + region.width) / (float)page.height;
(region.packedWidth, region.packedHeight) = (region.packedHeight, region.packedWidth);
} else {
region.u2 = (region.x + region.width) / (float)page.width;
region.v2 = (region.y + region.height) / (float)page.height;
}
if I change this:
if (region.degrees == 90)
to this:
if (region.degrees is 90 or 270)
it works properly, and ideas?
P.S
I attached a minimal project extracted from my main one to reproduce the bug.
It also writes log warnings for the 3 regions that aren't rotated.
Just run it and you'll understand everything.
Thanks for sending your reproduction project and sorry for the troubles. We will get back to you as soon as we've figured out what's going wrong.
Issue ticket URL:
https://github.com/EsotericSoftware/spine-runtimes/issues/2181
This issue has just been fixed on the 4.1 and 4.2-beta branches.
New spine-unity unitypackages are available for download here as usual:
spine-unity Download.
Thanks for reporting!