-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improvements to AnimationNodeStateMachine #24402
Improvements to AnimationNodeStateMachine #24402
Conversation
7710ed0
to
6629a6e
Compare
6629a6e
to
6712bcd
Compare
c77d3c5
to
7ca8ecd
Compare
1bd743d
to
00b3990
Compare
befd11a
to
0d8b779
Compare
dc0378a
to
69d0060
Compare
69d0060
to
2f7215a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems good to me now
5d79992
to
efe5055
Compare
386eca8
to
e820dbf
Compare
e820dbf
to
decea27
Compare
@guilhermefelipecgs I know this keeps getting punted back, but is there any chance of rebasing this again and @reduz getting it merged now that the requested changes seems to be have been addressed? I was having a conversation earlier with @lyuma about some animation work he's looking at at the moment in terms of sub-state machine limitations he ran into, and remembered that this PR would likely address the issues he was having. |
@SaracenOne I pushed a rebased version here. Feel free to use this commit as your own. so I've been playing with it. I was able to replicate one complex state machine example sent to me by a Unity animation guru so it seems pretty powerful. Here are the issues I ran into:
That's basically it. Overall, the PR works and seems to solve most issues I had last time I tried sub State Machines. I know I listed a lot of things, but the only one which is a blocker for me to use it is the frame delay / no cross fading... that's important to have for a character controller, but otherwise, this PR did most things right. (Also note that if you take my cross fading suggestion (3), it may be possible to soft-lock with nested state machine transitions. The version of Unity I tried is dreadfully easy to soft lock if you add a loop between start and end of multiple state machines. If you're worried about this, set a limit of how many transitions you will follow at once.) |
decea27
to
c7f2c1e
Compare
Hi @lyuma, thanks for testing my changes, about the flickering, this is news to me, before the rebase this didn't happen and now I can see this happening in my projects too, I'll need to investigate this. This is the flickering you mentioned right?: Peek.2022-04-28.16-59.mp4In slow motion: Peek.2022-04-28.17-02.mp4I don't know why this started now, maybe a new bug has been introduced somewhere. About the crossfade, it should work normally, I did some tests, see #24402 (comment) |
@SaracenOne Don't merge yet because I need to investigate this "flicker". This bug causes a lot of wrong behavior, it's not just a visual issue. |
Ok so I did more testing, and I think my assessment was wrong, and it seems to work fine when using crossfade, at least after changing my example a bit. Here is the state machine I ended up creating: It's a little absurd, but I structured it like this to match the unity example I was basing this on, and it seemed like a good challenge and a way to learn a bit more how things work. So the part that actually threw me off is that transitions with xfade_time set seem to become "At End". it's not completely consistent, so it's hard for me to say what's correct. The Loopback thing was my attempt to avoid needing two copies of Logic (allow transitioning back to my own state machine), so I connected Start->End. Imagine you make a state machine for Jump, and the player holds spacebar so you want to xfade from one jump directly into another jump. Anyway... when doing this, it does seem to have some flickering, but I'm not sure if this case is supposed to work or not. Overall, I think I'm a little more comfortable with this system than when I started using it. I'm generally confused how xfade_time and "Immediate" are supposed to work together. I'm a little worried that I needed to use xfade both inside the state machine and outside of it, which makes me wonder if it's overlapping two crossfades, since that would cause interpolation between state machines to be non-linear. What are your thoughts? |
@lyuma I can't open your scene, could you send me a minimal reproduction project in a zip file for me to test? |
- Open the menu to add new animation nodes by dragging the transitions to empty areas and automatically connecting them. - Adds box selection to the state machine. - Add feature to group/ungroup selected nodes in a "sub" state machine. - Add start/end node by default. In addition, add new color to these nodes to differentiate then. - Add tooltip for transitions to show the connection "from -> to". - Add new "type" of transition line when multiple transitions are grouped. - Add popup to connect nodes in sub state machine. - Add dialog to select which nodes can be deleted when they are grouped. - Add classes: AnimationNodeStartState AnimationNodeEndState EditorAnimationMultiTransitionEdit - Implements disabled transition API Changes: - Now it's posible to add transitions between state machines, `AnimationNodeStateMachine::add_transition` will works with relative path, this means you can use it like this `add_transition("Idle", "Walk", tr)` or `add_transition("Idle", "StateMachine/Shoot)`.
@SaracenOne the bug I mentioned was a regression, I opened an issue here #60710 so if the PR is good I think we can continue with the merge, |
c7f2c1e
to
e7056c1
Compare
Thanks for keeping up with a lengthy review process :) |
This commit makes StateMachine now only usable inside other StateMachine. This breaks compatibility between BlendTrees and StateMachine. A StateMachine created inside a BlendTrees will not be able to exit due to missing end nodes. Is this intentional? |
Closes #19773.
Notes about the implementation: #24402 (comment)
Open the menu to add new animation nodes by dragging the transitions to empty areas and automatically connecting them:
Adds box selection to the state machine:
Add feature to group/ungroup selected nodes in a "sub" state machine:
Add popup to connect nodes in sub state machine:
Add new "type" of transition line when multiple transitions are grouped:
Add dialog to select which transitions can be deleted when they are grouped: