Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question [Open Project] Help in Understanding Transitioning Logic between states (TransitionalTable)

Discussion in 'Open Projects' started by punkrooks, Nov 11, 2021.

  1. punkrooks


    Apr 15, 2016
    So I begin looking at the repo and was going through the code and I am getting some hard time to get along with the flow as most of the things were new for me and I am still learning btw.
    Currently I was not able to wrap my head around the logic written where it checks if a state should transition to another state.

    I really apologize if this question is too much of a beginner. Feel free to close it if so.

    For eg: we have
    Idle => [ Some conditions ] => Fight

    (please ignore the actual condition added, it is just for testing.. )

    with this, i am visualizing
    for example :

    Q1 So now, Is it equivalent to
    Option 1 or Option 2 ?:


    I am understanding as Option 1, please correct me if I am wrong.

    And the main part where I am having trouble is the transitioning logic
    The Operator are first taken
    and from there result groups are generated
    And used for furthur transitions.


    How are this ResultGroups used for transition accordingly. If someone could explain even in some few lines or give some reference, waypoint, anything. That would be really helpfull. I did look up the code, but I am still having some gaps.

  2. punkrooks


    Apr 15, 2016

    if condition is equivalent to Option 1

    and transitions are done accordingly, for eg
    there are 5 conditions and there are inbetween operators as follows:

    Code (CSharp):
    1. c1 || c2 || ( c3 && c4 && c5 )
    then this will get into result group as

    1 1 3

    1 is for OR
    where 3 is the total adjacent AND present

    furthur they are converted to condition checked array say

    T T F

    Then it will return T, as first condition itself returned true

    if it was F F F, it be returned False and no transition will be performed