Condition in AnimatorGroup

All topics about ZGameEditor goes here.

Moderator: Moderators

Post Reply
User avatar
rrTea
Posts: 475
Joined: Sat Feb 15, 2014 9:54 am

Condition in AnimatorGroup

Post 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>
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: Condition in AnimatorGroup

Post 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.
User avatar
rrTea
Posts: 475
Joined: Sat Feb 15, 2014 9:54 am

Re: Condition in AnimatorGroup

Post 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).
Post Reply