Page 1 of 1
Using Animator Layers with Dialogue system
Posted: Sat Jun 12, 2021 7:53 am
by lostmushroom
Hey Tony, I'm trying to do something with animator layers/weight and I'm wondering if there's a way to do it with DS.
I have two spine animations of a background, a base layer and a "distance" layer where it look farther away (scaled down).
I also have a main conversation that runs every "turn" so to speak. Each time it runs, I'd like it to increase the weight of the distance layer by a small amount, maybe 0.1. The idea is to make the background appear further and further away with each turn.
Is there a way to use AnimatorLayer() but to add an increment rather than set an absolute value?
Re: Using Animator Layers with Dialogue system
Posted: Sat Jun 12, 2021 8:12 am
by Tony Li
Hi,
You can keep the weight value in a DS variable, and increment it in the Script field. Then use [var=
variable] to include the variables value in your AnimatorLayer() sequencer command. Example:
- Script: Variable["weight"] = Variable["weight"] + 0.1;
- Sequence: AnimatorLayer(1, [var=weight])
Re: Using Animator Layers with Dialogue system
Posted: Sun Jun 13, 2021 10:57 am
by lostmushroom
Thanks, that works great. Don't know why I didn't think of it.
The only thing is, it doesn't seem to be animating smoothly even though I added a transition time. Just to check, this syntax is correct if I want it to take 0.5 seconds to change the weight?
AnimatorLayer(1, [var=BackgroundAnimWeight], Background, 0.5);
Re: Using Animator Layers with Dialogue system
Posted: Sun Jun 13, 2021 3:25 pm
by Tony Li
Hi,
That's the correct syntax. Temporarily set the Dialogue Manager's Other Settings > Debug Level to Info. This will log the sequencer command parameters as the Dialogue System's parser understands them. Maybe there's a typo or a parsing error and it's not detecting that the duration is 0.5 seconds.
Re: Using Animator Layers with Dialogue system
Posted: Mon Jun 14, 2021 11:27 am
by lostmushroom
I get this in the console. Seems correct I think?
- animator layer.PNG (14.18 KiB) Viewed 546 times
Re: Using Animator Layers with Dialogue system
Posted: Mon Jun 14, 2021 11:35 am
by Tony Li
That looks correct. Is it possible that a weight of 0.04 is low enough that it doesn't have a noticeable effect on layer 1?
Can you send a
reproduction project to tony (at) pixelcrushers.com?
Re: Using Animator Layers with Dialogue system
Posted: Mon Jun 14, 2021 11:42 am
by lostmushroom
It has magically started working
Thanks for your help!
Re: Using Animator Layers with Dialogue system
Posted: Mon Jun 14, 2021 1:48 pm
by Tony Li
Great! Make a backup / commit to version control. That way if it happens again you can compare it against your backup.