A review on self transition in animation graph #13194
Unanswered
shrinktofit
asked this question in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
In animation graph, self transitions are vague edge case. Here we take about two kinds of self transitions: state transition and interruption.
State transition
Our animation graph now allows self transitions. It means the following constructions may appear in animation graph, where A is a motion state and SM is a state machine containing A:
A -> A
In this case, user connected a transition from A to itself.
SM/A -> SM/Exit -> SM/Entry -> SM/A
In this case, user connected a transition from A to Exit, and the SM has a transition on itself, and the SM/Entry select to transition into A again.
I had considered this case in early stage of design. My answer once was: the self transitions are valid and have definite sementic. For example, if a motion state A was proceeded at 0.3s, a self transition cause the whole animation graph (layer) to be proceeded as$transitionBlend(A_{0.3s}, A_{0.0s})$ and then, as time elapsed, $transitionBlend(A_{0.4s}, A_{0.1s})$ ...etc .
Well, I said yes to this, is because I think there may be a case: the game character is skill ACTing and when the user press a key, that skill will be reset to its beginning animation.
No matter if the requirement exists in real world, I allowed them in current version though. To achieve this, I internally implemented the self-transition as: a motion state may have two ports: a "from" port and a "to" port. Both port sample the same animation sequence(clip or animation blend) but each port has its own timer. When a transition happen, the from port of transition source and the to port transition destination are sampled. You can see the relavent code here: https://github.com/cocos/cocos-engine/blob/v3.6.2/cocos/core/animation/marionette/graph-eval.ts#L1633
But as of now, I'm gonna blame on the "self-transition" for the reason listed as follow.
Hard to teach.
Because self transitions, a state is actually divided into two internal states("from" and "to").
Make it hard to implement function states
TODO
Beta Was this translation helpful? Give feedback.
All reactions