spine-runtimes icon indicating copy to clipboard operation
spine-runtimes copied to clipboard

[player] Take clipping into account when calculating animation viewport

Open Disorrder opened this issue 2 years ago • 3 comments

https://github.com/EsotericSoftware/spine-runtimes/blob/6661ae9322986c84267f7b4b71d66d332dad6d29/spine-ts/spine-player/src/Player.ts#L762

I suggest to calculate viewport size by clipping, but not min-max vertices. Sometimes animation goes out of bounds and player fits viewport size to not visible parts. It's unexpected behaviour for me, so I have to setup viewport manually which is taking much time and exhausting. See example, I expect to see these two animations in same bounding box, but 2nd orange jump outside of bottom border

(Could try to provide PR later if you agree with idea. But only for JS platform)

image image

Disorrder avatar Dec 30 '22 11:12 Disorrder

Oh, that's actually a bug! This method must absolutely incorporate clipping. I'll try to get this fixed after my vacation, unless you send a PR before that!

badlogic avatar Dec 30 '22 13:12 badlogic

@badlogic This method doesn't incorporate clipping because it's described inside skin category. But method only read animation params

Disorrder avatar Dec 30 '22 13:12 Disorrder

The method itself doesn't care where attachments, including clipping attachments, come from. What it needs to do is simulate the logic of SkeletonRenderer and clip region and mesh attachments when a clipping attachment is active, then take their min/max.

badlogic avatar Dec 30 '22 13:12 badlogic

This has been fixed with 03f8f67 and f309722. See https://github.com/EsotericSoftware/spine-runtimes/pull/2220#issuecomment-2092602776 for more details.

davidetan avatar May 03 '24 09:05 davidetan