|Topic was automatically imported from the old Question2Answer platform.
In the official Godot fps tutorial, Part 2 — Godot Engine (3.1) documentation in English, a lot of things are done in code, that would be done in the editor if you were using unity. For instance, when setting up animations in the tutorial, a dictionary variable is put in the code that lists every animation and then what animations can be played after the animation is finished. then it has a dictionary for every animation and it’s speed! In unity, this is done with a node system, and there’s a file for each animation which has a speed variable among other simple settings, and I think that’s a much more efficient way of doing it. putting all of it in the code, is confusing, and it’s a lot of repetition. Is this the only way of doing it in godot?
Have you checked the animation player node and Animation Tree?
gmaps | 2019-10-17 10:41
Thanks, this is what I needed, I’m not quite sure how to call the animations in the tree with code, but I’m sure it can be done. I’m not sure why the fps tutorial did this all in code when using the animation tree would probably have been a lot easier. The one thing I would like to know, is how would I connect a state animation node to another state animation node, but make it so the transition only happens if I call it in the code? (unity can use a boolean, or an int)
Millard | 2019-10-17 12:48
Well at least the tutorial makes you understand the value of Animation tree
For playing animations I use:
active = true
playback = get("parameters/playback")
And then I use
To travel to another node.
gmaps | 2019-10-17 16:22
Thanks for the help, I am using gdscript, and I think what you are using is C#, I think I can transfer it, but if you could put it up in gdscript as well, that would be great.
P.S, what does “Travel” mean?
Millard | 2019-10-17 16:51
I’m using gdscript and that is gdscript code
Oh sorry, I forgot to mention, I use state machine, you define states (animations) and you travel from one to another. Very simple concept. The enginealso interpolates between states so it seems very smooth.
gmaps | 2019-10-17 16:56
oops, just shows how new I am to Godot. Just to clarify, does your example code tell the state machine to start playing “idle-armed” and then when it is finished to start the animation process over again, starting at “run-armed”?
Millard | 2019-10-17 17:02
Kinda, it tells it to play idle-armed at the start of the scene. You also have animation player node where you can define whether the animation is repeating or is played only once. So it’s stuck in that state until we tell it to travel to another state. If two states are not connected directly it will travel through closest path (for example you don’t want to connect “idle” and “shoot” directly, you want to have “aim” state in the middle). It’s best if you check some demo project or tutorial.
Check this one, it’s for 2d, but the concept is the same.
gmaps | 2019-10-17 17:58
Thanks for the help
Millard | 2019-10-17 18:33