(Opinion) ‘Play Animation’ Action Task could cause confusing.

Forums 💬 NodeCanvas ⚙️ Support (Opinion) ‘Play Animation’ Action Task could cause confusing.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #15515
    whitedoggy
    Participant

      Hi.

      Longtime no see.

      We are using NodeCanvas till now, It has been like, more than 2 years now. What a time ain’t it? Thanks for the awesome tool like always.

      Anyway, allow me to tell you what I found:

       

      [Background]

      1. I have found ‘Play Animation’ Action Task is actually doing ‘CrossFade’ for Animator, without normalized time parameter.
      2. As for the result, If we execute that action multiple time for ‘non-looped’ Animation, It will simply not playing. (staying at the end of the state, pic 1)
      3. I have expected It would act like ‘Play Animation One Shot’, but it turns out it is not. (pic 2)
      4. I think this may cause confusing for other people?

      [attachment file=”Animation State.png”]

      pic 1

      [attachment file=”Play Animation Action Task.png”]
      pic 2

       

       

       

      So I did a simple edit for the code like below:

       

      [attachment file=”16487″]

      [attachment file=”16488″]

      It works like ‘Play animation one shot’ if I insert zero to ‘NormalizedStartTime’ parameter. Which is obvious.

       

       

      So I wonder, do you also think ‘Play Animation’ Action task may cause same confusing to other people like I had?

      It took some while to understand how this task actually working though. 😛

       

      #15516
      Gavalakis
      Keymaster

        Hello again! Time flies indeed 🙂

        Looking at the CrossFade method on Unity doc (https://docs.unity3d.com/ScriptReference/Animator.CrossFade.html) it seems that the CrossFade overload with hash has a default value for NormalizedStartTime of zero, while the overload with name (the one that this action is using), has a default value of NegativeInfinity. That is weird. I have now made it so that it explicitly pass 0 for NormalizedStartTime which was the intention, but if you find a use for exposing the NormalizedStartTime as a parameter to the task inspector, I can do it that way instead of course.

        Let me know and thank you 🙂

      Viewing 2 posts - 1 through 2 (of 2 total)
      • You must be logged in to reply to this topic.