• Editor
  • Scaling- scaling the entire skeleton/root, as if bitmap?

  • Modificato
Related Discussions
...

I am using an older run time of Spine from a few months ago, but is there a way to scale down a skeleton in ONE direction, to squash down the animation, like as if you had just vertically scaled it in photoshop?

When I set the scaleY on the root bone, it seems to only scale down the images, not their rotation points, so everything looks ugly and disconnected.

Is that something that is in the newer run time, or is there an easy alternative way to do that? (I tried scaling the batcher projection matrix, which scales it correctly, but then all the screen coordinates will need to be converted).

EDIT: I updated to the latest version, but there doesn't seem to be a very good way to simply scale the skeleton non-uniformly. Setting the scaleX =.5 seems to somewhat scale her 50% vertically, with some things being scaled strangely (the hips).

Everything would be "good enough" if I could get the hips scaling correctly with the rest of her:

Immagine rimossa a causa della mancanza di supporto per HTTPS. | Mostra Comunque

(Default scale) (X scaled by .5f, which provides a vertical scale) (x scaled by 1.5, which provides a vertical scale)

  • Modificato

I figured something on it out- the scale is somehow based off of bone length? The hip bone is just for the hip placement/ rotation, so it has no length, but changing it to the height of the hips is now making that scale much better.

But I obviously have to fix some other things as well- so how does scale work, relative to bone length? For instance, as in the screen shot above, the head is scaled in a strange direction, almost skewed. So is the way to get everything scaling properly to have each bone almost perfectly the "longwise" for the part being animated, and with the intended direction of scaling?

Hello,

This works for me (Unity c#)

float xScale = 0.5f;
float yScale = 1f;
skeleton.gameObject.transform.localScale = new Vector3(xScale, yScale, 1f);


cheers

evs

I think it depends on the runtime. What are you using?

In any case, you usually shouldn't touch the root bone at all, especially for scaling.

Scaling works like this:
http://www.softimageblog.com/archives/84
It is always applied along the bone axes, that is why it doesn't give you the effect you want. The reason is because this avoids skew, which is desirable in many situations and can cause problems because skew can't be represented by a 3x3 matrix transform.

You can scale a container like is shown in Unity. For libgdx you would need to adjust your camera or draw to an FrameBuffer, then draw that squished.

Awesome, thanks Nate, it makes a lot more sense now. (and thanks everyone else too)

One more question- is there a way at runtime to scale, and not affect the children?

Everything is connected to the hip- but if I wanted to scale the hip x2, and not the children, is there something that is already there, or would I just have to go through the children then, and set them at scale x.5 so that "they don't scale"?

Thanks!

Scaling the container in unity breaks batching, though which leads to lower performance (unity will cause another draw call if any elements are a different size as it is a 3D engine, and needs to do so in order to keep lighting correct).

Does anyone have any code to reliably scale a spine model without breaking batching (I mean the entire thing, rather than just one part) ?

chrismweb ha scritto

Everything is connected to the hip- but if I wanted to scale the hip x2, and not the children, is there something that is already there, or would I just have to go through the children then, and set them at scale x.5 so that "they don't scale"?

There's at least two other ways to do this:
(1) The latest version of Spine Editor (and only two runtimes for now) supports disabling scale and rotation inheritance. You can uncheck the Inherit Scale checkbox on the hip bone's immediate children and you should be able to scale the hip without the scale cascading down to all its descendants. Note that this will also destroy those children's ability to inherit from anything higher up in the hierarchy.

(2) If you're using a runtime where this isn't working yet (basically, if you're not using C# or Java/libgdx), you can make an extra child bone exactly where the hip bone is and put the hip image there instead of on the parent. Then scale that.

hippocoder ha scritto

Scaling the container in unity breaks batching, though which leads to lower performance (unity will cause another draw call if any elements are a different size as it is a 3D engine, and needs to do so in order to keep lighting correct).

Does anyone have any code to reliably scale a spine model without breaking batching (I mean the entire thing, rather than just one part) ?

@hippocoder - I think that you're the man for the job :rock:

cheers

evs

hippocoder ha scritto

Does anyone have any code to reliably scale a spine model without breaking batching (I mean the entire thing, rather than just one part) ?

For non-uniform scaling, not AFAIK. For uniform scaling you can scale the root bone or use scaling when loading the JSON.

Thanks Nate!

I guess I will just have to live with breaking batching and try to minimise it happening because we usually like to scale our sprites in game a lot, for subtle effects such as squashing them and so on (see mario wii)... We will just have to refactor the code our end.