• Editor
  • Darken a character

  • تم التحرير
Related Discussions
...

Hello. I've seen that "fading a character" is pretty hard to do and seems to be an unsolved problem. What if I want to darken a character? That is, look like a shadow is cast over their whole body. I'm making a visual novel, and when a character isn't speaking in a conversation, I'd like them to be darkened so it's clear they're not speaking.
Thanks

Hello AoF!
If you wish to darken the whole character, you could have an animation where you can filter the tree on slots, select all of them, then change their color in the property panel to be darker.
Attachments - Spine User Guide: Tinting

You can then run this animation along with the others on a separate track to dim or undim your character when needed.

Cool! So how would you go about playing two animations at once? I'm using Unity with mechanim references.

Do I just say state.SetAnimation(trackIndex, animation, loop); two times?

If you want two animations to be played on separate tracks at the same time, that's what the trackIndex parameter is about.

state.SetAnimation(0, baseAnimation, loop);
state.SetAnimation(1, colorFadeAnimation, loop);
AoF wrote

I'm using Unity with mechanim references.

I'm a bit confused by this line - if you are using SkeletonMecanim, then instead of the above state.SetAnimation calls, you would add a new animation layer in Unity's Animator window as usual. There you would then transition between animations as on the base layer.

Note you can also go through the Skeleton slots and set the Slot color (in some runtimes it's r, g, b, and a properties) rather than using an animation to do so. Eg 0,0,0,1 will make the slot's attachment black, 0.5,0.5,0.5,1 half black, etc.

Nate wrote

Note you can also go through the Skeleton slots and set the Slot color (in some runtimes it's r, g, b, and a properties) rather than using an animation to do so. Eg 0,0,0,1 will make the slot's attachment black, 0.5,0.5,0.5,1 half black, etc.

In the context of my code, this might be easier to do. I imagine I get the root slot from the skeleton and recursively visit them all, setting the slot color along the way? Are there any code examples of visiting all the slots?

Skeleton slots is a list of all slots.