• Unity
  • Blending a Sprite with a Spine Animation

  • Изменено
Related Discussions
...

Hello everyone, I want to say thanks for the answer under my previous post.

My question is whether the spine has the ability to mix animation with regular sprites in the scene for a smooth transition from sprite to animation.

Could you please describe what exactly you are having in mind? Please also describe in more detail what you mean by "animation" and "regular sprites", as these terms allow for quite a lot of different interpretations.

By animation, I mean Skeleton Data Фsset
located on the stage, which with regards to sprites, I mean a regular 2D sprite, not related to the animation spine atlas.

What exactly do I want to get. Let's say we have a skeleton of a car on the stage, and there is a separate sprite of it, when I click, I change the sprite to the spine skeleton. They have a difference in size, and I would like to make the transition invisible, without adjusting each sprite to fit the skeleton of the car. I heard that the spine has this function of mixing the sprite with the skeleton, that I could mix the skeleton with the sprite, thereby achieving a smooth transition effect.

TheZero написал

Let's say we have a skeleton of a car on the stage, and there is a separate sprite of it, when I click, I change the sprite to the spine skeleton. They have a difference in size, and I would like to make the transition invisible, without adjusting each sprite to fit the skeleton of the car.

You can set the import Scale parameter of a skeleton via the Inspector of the SkeletonDataAsset (select this asset in the Project panel).
spine-unity Runtime Documentation: Skeleton Data
Note the remark on the documentation page:

Note: When you want to precisely match e.g. 32px of artwork to 1 game unit (and the attachment images have not been scaled in Spine), you can set this Scale parameter to 1/px_per_unit. So for 32px/unit you would set Scale to 1/32 = 0.03125.

TheZero написал

I heard that the spine has this function of mixing the sprite with the skeleton, that I could mix the skeleton with the sprite, thereby achieving a smooth transition effect.

There is nothing specifically provided or necessary that would create or modify such a transition. Basically you need to make sure that (1) the scale matches and (2) that it looks the same in the first frame of your Spine animation. Then you can place both the Sprite GameObject and the SkeletonAnimation GameObject at the same location and disable one and enable the other to swap between them. If your car Sprite shall be a single Sprite and your skeleton has multiple animated parts, it would perhaps be easiest to start with the Spine skeleton and then export your single first frame which will then be perfectly identical. See the following section about how to export your skeleton as images instead of as data (.json or binary):
Export - Spine User Guide: Images