Using Animator Layers with Dialogue system

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
lostmushroom
Posts: 195
Joined: Mon Jul 01, 2019 1:21 pm

Using Animator Layers with Dialogue system

Post 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?
User avatar
Tony Li
Posts: 22161
Joined: Thu Jul 18, 2013 1:27 pm

Re: Using Animator Layers with Dialogue system

Post 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])
lostmushroom
Posts: 195
Joined: Mon Jul 01, 2019 1:21 pm

Re: Using Animator Layers with Dialogue system

Post 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);
User avatar
Tony Li
Posts: 22161
Joined: Thu Jul 18, 2013 1:27 pm

Re: Using Animator Layers with Dialogue system

Post 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.
lostmushroom
Posts: 195
Joined: Mon Jul 01, 2019 1:21 pm

Re: Using Animator Layers with Dialogue system

Post by lostmushroom »

I get this in the console. Seems correct I think?
animator layer.PNG
animator layer.PNG (14.18 KiB) Viewed 537 times
User avatar
Tony Li
Posts: 22161
Joined: Thu Jul 18, 2013 1:27 pm

Re: Using Animator Layers with Dialogue system

Post 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?
lostmushroom
Posts: 195
Joined: Mon Jul 01, 2019 1:21 pm

Re: Using Animator Layers with Dialogue system

Post by lostmushroom »

It has magically started working :D

Thanks for your help!
User avatar
Tony Li
Posts: 22161
Joined: Thu Jul 18, 2013 1:27 pm

Re: Using Animator Layers with Dialogue system

Post by Tony Li »

Great! Make a backup / commit to version control. That way if it happens again you can compare it against your backup.
Post Reply