• Editor
  • When will the 2DTK spine skeleton scaling bug be fixed?

Related Discussions
...

Sorry for bringing this up again since I get no positive answer regardin this and the issue is becoming serious and affect a lot of aspect of my game.

As I have mentioned several times before, the 2DTK skeleton cannot scale itself by changing the target height and target ortho size in the sprite collection in 2dtk editor. I'm not using 2dtkCamera for some of my reasons (one reason is that there is a bug with unity that prevent it to render at correct position) so just by selecting using 2dtk camera in the sprite collection will not be my choose. I have consulted with unikron software and confirmed this is a bug with the integration of spine, and I asked several users and they all have the same problem. I think there is a need to put fixing the bug on schedule.

As for now, the only way to adjust the size of the skeleton is to use the scale transform in unity. But the skeleton in my game is SO huge that I have to use a factor 0.005 on both axis to get desired size. And this comes with various problem. At this scale, physcis and charactor controll for my player gets innacurate and that greatly affects my game setup. Also I have the entire scene attaching the camera that's attached to the player so they all get scaled. This is hard to manage when things gets complicated.

For this screenshot you can see, if I add a character controller by default, it will be so big that outlarge my entire scene. I have to adjust the radius and height greatly, but for some reason, probably because of the scaling, When the capsule size decreased to fit my scaled player, and when the height reaches it's smallest value that can be observed on the screne (the capsule became a sphere), the height value is still showing 300+, any value beneth that makes no change on screen.

All those problem are probabaly due to scaling the skeleton way too small. And I believe it's necessary to have the problem fixed so it could be properly utilized.

Can you put the fixing on your schedule? Thanks

The code that converts a TK2D sprite collection into a Spine atlas is here:
https://github.com/EsotericSoftware/spi ... tLoader.cs
I am guessing the tk2dSpriteCollectionData field "halfTargetHeight" has something to do with the target ortho size. Do you know? The docs are not very helpful:
http://www.unikronsoftware.com/2dtoolki ... b5e16c2f69

Not sure why you need to scale it down so much, but instead of using the Unity transform to scale, you can scale the skeleton data asset. You can set this in the Unity inspector. If we figure out how to determine a scale from the TK2D sprite collection based on the target ortho size, then maybe we can get rid of the scale in the skeleton data inspector and set the scale appropriately:
https://github.com/EsotericSoftware/spi ... set.cs#L47

Nate a écrit

The code that converts a TK2D sprite collection into a Spine atlas is here:
https://github.com/EsotericSoftware/spi ... tLoader.cs
I am guessing the tk2dSpriteCollectionData field "halfTargetHeight" has something to do with the target ortho size. Do you know? The docs are not very helpful:
http://www.unikronsoftware.com/2dtoolki ... b5e16c2f69

Not sure why you need to scale it down so much, but instead of using the Unity transform to scale, you can scale the skeleton data asset. You can set this in the Unity inspector. If we figure out how to determine a scale from the TK2D sprite collection based on the target ortho size, then maybe we can get rid of the scale in the skeleton data inspector and set the scale appropriately:
https://github.com/EsotericSoftware/spi ... set.cs#L47

I forward your post to unikron software and he provided a solution:

The answer to this is in the previous post:
scale = 2.0 * ortho size / native resolution height.

So in relation to the sprite collection data, just reworking the equation, its
scale = 1.0f / (invOrthoSize * halfTargetHeight);

Does this work?

@[supprimé]

Open tk2dSpineSkeletonDataAsset.cs

Delete (or comment out) line 12:

public float scale = 1;

Change line 47 from:

json.Scale = scale;

To:

json.Scale = 1.0f / (spritesData.invOrthoSize * spritesData.halfTargetHeight);

Now when you go to to the SpriteCollection Settings and changeTarget Height and/or Target Ortho Size then click commit, you will immediately see the size change!

cheers

evs

Thanks @evs!

@Nate, seems we can make a new commit and close the case now 🙂

Committed, thanks!