[SOLVED] How to use anim state graph?

I want to use the anim state graph to transition a npc creatures from different animations.
(I made the models and animations)
For the life of me I can’t figure out how to do so, even after reading blog posts and the API.
The issue I am dealing with is maybe the trigger? I have the start to idle, and idle to walk, and walk back to idle seen below.


I ended up scrapping my code out of frustration, but if anyone could help me I would be so thankful. Right now its more for aesthetic purposes (I don’t want the creatures to walk while in an idle state like the video below)

Hi @Jacob_McBride2!

Did you give the transitions between your states a condition? The transition from one state to another state will only occur if those conditions are met.

You can change the values of the conditions by script, for example when the character start to move, so the anim state graph can execute the correct state based on the conditions of the transitions.

1 Like

thank you! I do still have some questions.
The tutorial said to add a parameter and set to boolean, but the next screenshot shows the parameter with a different name and set as a trigger?


I’m trying to follow along but the state graph looks a bit scary. :eyes:

Okay so after following it so far I got it to blend the animations but both loop and and transition back and forth between each other, so this is progression. (here’s my state graph)


and here’s a video of the creatures (ones with fins on their back) transitioning back and forth.

This is the script I am trying to use to make the animations change
(idle animation while the creature is idle and walk while the creature is walking or turning)


Lastly, here is the location of the state graph and animations for the big finned green creature:
Screenshot 2024-12-09 12.23.00 PM

NEVERMIND!! I got IT

So, I didn’t have the boolean set right, and idle was active while walking was, I had to change it so when walking isn’t active idle is true. such a silly mistake.

Maybe it’s a way of JavsScript I don’t know yet, but this looks incorrect to me.

image

Also it looks like you try to set a boolean isWalking while the boolean of the parameter has the name walk.

image

image

1 Like

Thank you for helping me understand how to do the animation using a state graph, Now I can do a lot more (since I make animations, I could use it to animate a door or a NPC player or a melee attack.) This is awesome :grin:

Yes! And I realized this and since fixed it, it works now and I’m happy with the result, thank you!

1 Like

Here is the result if you are interested: fixed animation - Album on Imgur

1 Like

I’m a little confused about the image below. I thought the first arrow will display the value of the second arrow, but in your case they are different. How did you do this?

image

1 Like

To be honest, I have no clue. I was working on the state graph all last night searching for documentation on how to set it up properly, I guess it’s maybe how I set it up last night, since today I redid a lot in the graph. I’m also very new to the state graph system, so I’m not 100% sure what I am doing. (side note: sometimes the things that display on my computer are different for other users? For example I tested the walking speed of the creatures on my PC and it looked fine, but on another they went lightspeed, so maybe this is the same case? Or I may be connecting uncorrelated things.)

Also when I duplicate a creature while in the launch I get an error (but the animations and behavior work fine)

ASSERT FAILED:

rootBone entity for supplied guid:e2c28347-abf5-4d24-942d-3638a86d9350 cannot be found in the scene

That’s all to say, it works. So I won’t bother myself with trying to fix every detail :sweat_smile:

I guess there must be a bug somewhere in the editor, maybe when you undo something.

For this you probably need to use delta time dt for the movement speed of your creatures.

1 Like

Yeah that makes sense, my editor is always bugging out for some reason or another, and yeah I thought the same so I’m doing that now. By the way I appreciate your time and help.

1 Like

No problem, I enjoy doing it!

Your creatures look great by the way! :heart_eyes:

1 Like

Thank you! It took way too long to model and animate them but I enjoy it so I’ll definitely be adding way more! :laughing:

1 Like

@Jacob_McBride2 , if you want, I can model a creature for you based off one of the ones you already have.

1 Like

I have the animations for these ones, just an idle and a walking animation, I’m going to add a sleep animation and dying animation (they will sleep at night, and have a decay where they will eventually die) but if you want to for the fun of it or you do the animations (or export them with bones, or in a way I could animate them) Id be happy for you to! It’s all up to you though, and I’m not sure what I’ll be adding next.