Scaling problem with spine animation

Hello,

I have spine Animation of resolution (20481536 for retina )which covers entire screen and the design resolution is set to 1024768.For this I have created spine animation using following code with scale factor 1.0f

SkeletonAnimation* animation = SkeletonAnimation::createWithFile(jsonFileName, atlasFileName, 1.0);

In all the devices (retina and normal), animations are being scaled out.If the scaleFator is set to .5,animations will appear fine in all the devices.

How the single set of assets will work fine for all the devices(retina and normal) when I set the scale factor to 0.5? Whether spine animation get scaled based on device content factor?

Please help me out.

Thanks.

Hi,

How I usually deal with spine is like this:

animation = spine::SkeletonAnimation::createWithFile("xxx.json", "xxx.atlas");
animation->update(0.0f);
animation->setScale(x / animation->getBoundingBox().size.height); // where x is the size you want, say getContentSize().height / 2

I don’t know if this would working when using design resolutions, since I generally handle all the scaling myself, but aside from that, calling update will correctly return the bounding box of the animation, thus letting you scale it to your needs.

Hope that helps.