Page 1 of 1

Condition in AnimatorGroup

Posted: Mon Oct 23, 2017 4:31 am
by rrTea
I have a bunch of AnimatorSimples in an AnimatorGroup. A particular AnimatorSimple should be active only under specific circumstances, so I wrapped it in a Condition. But this makes everything crash... Or is this not meant to be used like that?

Code: Select all

<?xml version="1.0" encoding="iso-8859-1" ?>
<ZApplication Name="App" Caption="ZGameEditor application" FileVersion="2">
  <OnLoaded>
    <StartAnimator Animator="anim_Up"/>
  </OnLoaded>
  <OnUpdate>
    <AnimatorGroup Name="anim_Up" Duration="1">
      <Animators>
        <AnimatorSimple Duration="1" Target="variable1" ToValue="1"/>
        <Condition Expression="return(allow);">
          <OnTrue>
            <AnimatorSimple Duration="1" Target="variable2" ToValue="1"/>
          </OnTrue>
        </Condition>
      </Animators>
    </AnimatorGroup>
  </OnUpdate>
  <Content>
    <Variable Name="Variable1"/>
    <Variable Name="Variable2"/>
    <Constant Name="allow" Type="1" IntValue="1"/>
  </Content>
</ZApplication>

Re: Condition in AnimatorGroup

Posted: Tue Oct 24, 2017 8:18 am
by VilleK
Hi,

Indeed it is meant for Animators list to only contain Animator components. I checked the code to see if I could make Conditionals work here like in your example (it would be useful) but unfortunately I could not find a way.

Re: Condition in AnimatorGroup

Posted: Tue Oct 24, 2017 8:43 am
by rrTea
Thanks for confirming, I was a bit surprised but luckily a workaround is pretty simple (I just named the Animator and added a condition in OnStart of the group that just sets both From and To values to the same number).