• Editor
  • Hide bone during animation : Feature Request

Related Discussions
...

Hi Spine,

In my app we have 3 bones for head positions - left, front and right - so character can shake head. We can't just transform the heads because the head shake goes into 3D space requiring image swaps. The head bone consists of lots of child bones for eyes, ears, mouth, etc. Using the "no attachment in slot" approach means continuously adding/removing attachments for lots of slots. What would be nice is to be able to show 1 head state while hiding the others without all the fuss. Being able to set visibility of bone in timeline would be much easier.

In the meantime what we do is set the scales to zero for the "invisible" heads then animate them in over a single frame. That's much less work than un/re attaching to multiple slots. Setting visibility of bone would be even nicer.

Thanks for awesome tool.

jb

Interesting problem. The scale trick works (be sure to use a stepped curve), but you still incur the cost of computing the world transforms for the bones. This really isn't much, but if you are on mobile and you have a ton of skeletons you could write your own Skeleton#updateWorldTransform (see the source it is only 2 lines) that skipped bones with x or y scale of 0. You may also want to skip rendering anything for slots that are on a bone with x or y scale of zero.

That'll have to do for now, as the development backlog is looooong.

2 godine kasnije

Just want to add, that we are having the same situation where I work.

We have 3 characters where the user can toggle on and off hats, glasses, moustache, etc.
The characters have a side face and a front face. We figured the easiest for the developers would be to just be able to turn an entire bone on and off so the setup is like so:

Notice that the only difference is, that HeadFront is not enabled.
x = enabled

  • Bone: HeadSide x

Slot: FaceSide x


Slot: GlassesSunSide


Slot: GlassesNerdySide x


Slot: GlassesCoolSide


Slot: HatsCapSide x


Slot: HatsTallSide


Slot: HatsPicoloSide


Slot: MouthMoustacheSide x

  • Bone: HeadFront

Slot: FaceFront x


Slot: GlassesSunFront


Slot: GlassesNerdyFront x


Slot: GlassesCoolFront


Slot: HatsCapFront x


Slot: HatsTallFront


Slot: HatsPicoloFront


Slot: MouthMoustacheFront x

Hope it makes sence 🙂

It's easiest to modify the renderer to skip slots for specific bones that you want hidden.

+1 for this. I think I ranted about a similar feature last year. XD
Similar use cases do pop up at the forums every now and then.
"Shake head" is a good example of an animation that needs this.

I'd love to show and hide groups of slots (and bones?) easily, for the purposes of having "head states", and "torso states" and "arm states" and "leg states", different states which are easier to manage if they were comprised of a totally different set of slots. (and bones and bone setup poses, I guess)

I think UbiArt games use this technique a lot. Their characters certainly do a fair amount of state changes for heads, bodies, limbs within animation clips.

On a related note, a feature like this could also solve many problems for multi-directional animations for top-down or isometric games.
A character could be allowed to do a spinning animation, or some other animation that involves turning. And separate skeletons for each direction won't need to be managed at runtime, since we can assume that not only could individual parts be turned on and off, but entire bodies.

No rushing Nate though. He's doing good work!
This is uniquely a 2D skeletal animation problem that needs to be solved. And given how Spine is set up, a good solution for this isn't very obvious.... not to me anyway. >_>

Totally agree! It is a feature which would help a lot, but it's also possible to get around it.

We are going to do so with filtering the accessories with naming conventions, so now there's just one head with slots each containing a side and a front picture. The developers can simply filter slots (eg. only 1 "hats" slot is allowed to be turned on at any given time) on and off to change accessories. And they can filter every Region to switch image to turn the head at random intervals. Likewise if I animate the head to turn at specific points in an animation I just have to switch Region image on all accessories. Maybe it's completely common sense, but it took us a while to get there and Spine doesn't seem quite build for this functionality 🙂 None the less I wouldn't know what other software to use, so this is def not a complaint!

  • Bone: Head x

Slot: Face x


Reg: FaceSide x


Reg: FaceFront


Slot: GlassesSun


Reg: GlassesSunSide x


Reg: GlassesSunFront


Slot: GlassesNerdy x


Reg: GlassesNerdySide x


Reg: GlassesNerdyFront


Slot: GlassesCool


Reg: GlassesNerdySide x


Reg: GlassesNerdyFront


Slot: HatsCap x


Reg: HatsCapSide x


Reg: HatsCapFront


Slot: HatsTall


Reg: HatsTallSide x


Reg: HatsTallFront


Slot: HatsPicolo


Reg: HatsPicoloSide x


Reg: HatsPicoloFront


Slot: MouthMoustache x


Reg: MouthMoustacheSide x


Reg: MouthMoustacheFront