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

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

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #16484
    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?

    Animation-State

    pic 1

    Play-Animation-Action-Task
    pic 2

     

     

     

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

     

    Play-Animation-Code-1

    Play-Animation-Advance-Code-1

    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. 😛

     

    Attachments:
    You must be logged in to view attached files.
    #16511
    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 🙂

    Join us on Discord: https://discord.gg/97q2Rjh

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