3D Enemies With Pathfinding and Animations - Godot 4 FPS Tutorial

Поделиться
HTML-код
  • Опубликовано: 7 сен 2024
  • In this Godot 4 tutorial we create complex 3D zombie enemies for an FPS game. The covered topics include animations, pathfinding, attacking, detailed collision shapes, animation states using an AnimationTree, and spawning. These types of enemies can be used for a variety of first person games and third person games, including FPS, horror, survival, RPG, etc. All of this code works with Godot 4.1.
    Support the channel: / legiongames
    The project is available on Github: github.com/Leg...
    Assets:
    Zombie model: www.mixamo.com/
    Ground texture by 0melapics: www.freepik.co...
    Kenney Graveyard Kit - www.kenney.nl/...
    Wishlist Game: store.steampow...
    Discord: / discord
    Itch: legiongames.it...
    Twitter: / legiongames1
    Instagram: / legiongames1

Комментарии • 391

  • @NormalDalmatian
    @NormalDalmatian 5 месяцев назад +14

    For future viewers, if you notice that the auto-generated collisions for the skeleton don't stick to the model during animations it is addressed and fixed in the next video of this series! I'm talking about the collisions meant for bullet hits mentioned around 3:45

    • @MaxSvid
      @MaxSvid 3 месяца назад +2

      This comment should be pinned to top. Wasted 4 hours of googling just to stumble upon this comment

    • @IdenBond-xr1tj
      @IdenBond-xr1tj Месяц назад

      @@MaxSvid Exactly the same thing happened to me.

    • @okayoni6342
      @okayoni6342 21 день назад

      For future readers, the video in question is the Complete 3D Shooting Mechanics video, and it's at 7:04 in that video. Huge thanks to @NormalDalmation for pointing this out.

  • @-starrysunrise-2908
    @-starrysunrise-2908 Год назад +77

    You can disable the movement in Mixamo itself, just check "in-place"

    • @legiongames2400
      @legiongames2400  Год назад +31

      Saves a lot of time! Thank you for pointing it out!

    • @TheRealAfroRick
      @TheRealAfroRick 10 месяцев назад +1

      I was just about to ask why this wasn't done as that resolves the root motion issue.

  • @Failfer
    @Failfer 8 месяцев назад +9

    This is really nice thank you, I found other tutorials on AI Navigation but they all used the default capsule and didn't include the looking at part which I wanted to figure out, thank you

    • @legiongames2400
      @legiongames2400  8 месяцев назад +2

      Thank you for watching, I'm really glad it was helpful! :)

    • @runningwolfgames5955
      @runningwolfgames5955 2 месяца назад +1

      @@legiongames2400any idea what could cause me to get an error in the zombie script on the line nav_agent.set_target_position(player.global_transform.origin)
      When I got to launch the debugger it crashes and says “Invalid get index ’global_transform’(on base: null instance’). Any help would be greatly appreciated🙏

  • @artiop7687
    @artiop7687 Месяц назад +1

    Incredible, thanks it helps me a lot and actually stills working on godot 4.2

  • @tarik2662
    @tarik2662 Год назад +8

    Nice one, you kind of forget to mention that you must enable looping in animation player in order for animations to actually loop.

    • @paulchen9145
      @paulchen9145 11 месяцев назад

      But then the "AtEnd" transition from the attack-state back to the run-state will not happen right? Because the attack-animation is infinitely looping?

    • @tarik2662
      @tarik2662 11 месяцев назад

      @@paulchen9145 Set looping with script depending if player is in range or not, that way you will not cancel already playing Animation :)

    • @0kr4m
      @0kr4m 7 месяцев назад

      where is this?

    • @IceWolve67
      @IceWolve67 6 месяцев назад

      in the animation window, there is an icon you need to click, on the right of the name of the anim @@0kr4m

    • @noobnocontroletm3473
      @noobnocontroletm3473 4 месяца назад

      Thanks bro

  • @tl3119
    @tl3119 11 месяцев назад +7

    @LegionGames The look_at flipped problem can actually fixed by setting the third argument (use_model_front) to true.
    According to the manual:
    If use_model_front is true, the +Z axis (asset front) is treated as forward (implies +X is left) and points toward the target position. By default, the -Z axis (camera forward) is treated as forward (implies +X is right).

    • @legiongames2400
      @legiongames2400  11 месяцев назад +1

      Oh yeah thats a good idea! Thank you for watching!

    • @tl3119
      @tl3119 11 месяцев назад +1

      @@legiongames2400 Thank you for your video too, I learnt a lot from them!

    • @mamontain
      @mamontain 9 месяцев назад

      thanks

  • @eugeneivanov353
    @eugeneivanov353 10 месяцев назад +33

    Dude these tutorials are extremely good. You need to make more!!!

    • @legiongames2400
      @legiongames2400  10 месяцев назад +1

      Thank you! :)

    • @Yoni123
      @Yoni123 6 месяцев назад

      I didn't watch this yet but is it something that could beused for a stealth game? @@legiongames2400

  • @ItsWinnieBruh
    @ItsWinnieBruh 13 дней назад

    Amazing video series!

  • @da_roachdogjr
    @da_roachdogjr Год назад +6

    If after you make the enemy look at you and suddenly he's rotating but not moving, its because of the path height offset, I set it back to 0 and now it works.
    The setting is in NavigationAgent3D > pathfinding

  • @barney10240
    @barney10240 4 месяца назад +2

    During the "Attack < Run" animation in the "Switch" and subtab "Switch Mode," if you're on Godot 4.2+, don't bother to use "at The End"; instead, use "Immediate" for this tutorial.

  • @FredyyDev
    @FredyyDev 11 месяцев назад +13

    Hey, i'm not sure you know this but in 6:19 you could just export a node and use directly the same way you did there!

  • @southparkfan4603
    @southparkfan4603 2 месяца назад +1

    You're amazing, I was trying to figure this out for quite some time. Good video, keep up the good work, please :)

  • @souvikdatta97
    @souvikdatta97 10 дней назад

    Instead of setting the Zombie mesh y rotation to -180 degrees, we can also use this
    void look_at(target: Vector3, up: Vector3 = Vector3(0, 1, 0), use_model_front: bool = false)
    make the last parameter to true.
    So the code would look like this:
    look_at(Vector3(player.global_position.x, global_position.y, player.global_position.z), Vector3.UP, true)

  • @bongo6_462
    @bongo6_462 Год назад +5

    2:50 press reimport I believe if anyone is stuck. Really hopes this helps. Let me know, its my first day in Godot

  • @indiegameworld5830
    @indiegameworld5830 11 месяцев назад +2

    I have subbed, because this isnt a copy and read, its an actual tutorial. Thanks alot, hopefullyi dont mess it up and blame it on the tutorial. And plus the get next path position has changed which makes previous tutorial sort of redundant

  • @andypandy-py1zc
    @andypandy-py1zc 4 месяца назад

    Absolutely brilliant tutorial, learnt some great code and ways to complete my game
    Thank you for sharing your knowledge.

  • @SylkieDev
    @SylkieDev 3 месяца назад +3

    Has anybody had issues running this in Godot 4.2.2 stable? I was having issues with the state machine not transitioning back to run, and so I downloaded the main project from github, it has the same issue. When they transition to the attack state they just stand still, and continue playing the attack animation.

  • @JiKayPh
    @JiKayPh 3 месяца назад +1

    Nice! Looking forward to the next vids!

  • @Rawrqual
    @Rawrqual 7 месяцев назад +4

    Not sure if it's a bug in Godot 4.2, but I couldn't rename my animations no matter what settings I pressed. I had to eventually go and re-name them inside Blender instead.

    • @s1ndrome117
      @s1ndrome117 7 месяцев назад +8

      it got changed in 4.2, now you have to create a inherited scene, save it, then remove inheritance by right-clicking on the root node inside the saved scene

    • @0kr4m
      @0kr4m 7 месяцев назад +1

      I did that and still can't rename @@s1ndrome117

    • @stly8358
      @stly8358 2 месяца назад +1

      @@s1ndrome117 God Bless you

    • @kevinscott5899
      @kevinscott5899 21 день назад +1

      @@s1ndrome117 thanks bro

    • @RaveZG
      @RaveZG 11 дней назад +1

      @@s1ndrome117 ty so much. 💙

  • @ItsWinnieBruh
    @ItsWinnieBruh 13 дней назад

    If your Struggling with the renaming of animations...
    You can rename the ANIMATIONS in BLENDER (before you stash the animations).
    and Export
    They will Keep their name this way instead of trying to rename them in Godot.

  • @PastaMaster115
    @PastaMaster115 2 месяца назад +3

    My code is exactly the same as yours but my zombie keeps on flying off to a corner of the map, never to be seen again. And then when I added the rotation code, then he started flying circles around me at light speed. And I flipped his mesh around, just for the sake of doing it, now he flies off to a completely different corner of the map. I even disabled the nav mesh just to see what would happen and he still flies away. Now matter how low I make his speed, he's still to fast.
    I even copied in code from another enemy tracking tutorial that worked in a different project. Still just flies off in whatever direction. Is something wrong with my level?
    Edit: So I made a test level to see what it would do and it did the exact same thing. So I looked to my Zombie scene. It seems that it was the extra capsule collision shape added before the physical bones were made. I deleted it and now it rotates when I move but it doesn't go anywhere. So I'm going to put your code back and see if I can manage to make him move. Then I can finally move on with this tutorial lol
    I rewrote your code and it works. Not sure how it was different from mine though. Anyway, time to finish this! lol

    • @runningwolfgames5955
      @runningwolfgames5955 2 месяца назад

      I am having the same issue after I added the capsule shape my character wasn’t able to move what did u do to fix it?

    • @PastaMaster115
      @PastaMaster115 2 месяца назад

      @@runningwolfgames5955 I kept the capsule but I disabled it.

    • @runningwolfgames5955
      @runningwolfgames5955 Месяц назад

      @@PastaMaster115when I do that it for some reason falls through the map🤷‍♀️😂

    • @noahnielsen8673
      @noahnielsen8673 8 дней назад

      I just had the same problem. In the future if you do happen to be in the same situation, just make sure that the capsule's collision is in layer 1 and the bones' collisions are in layer 2. That worked for me at least

  • @I_turnedLEFT
    @I_turnedLEFT 9 месяцев назад +5

    everytime i try to run my game it says “invalid get index global_transform (on base: null instance)” Any one know how to fix?

    • @dkiras193
      @dkiras193 9 месяцев назад +1

      Me 2 but somehow my other game nav sistem also not working

    • @runningwolfgames5955
      @runningwolfgames5955 2 месяца назад +1

      Same here unfortunately😩

    • @sirpetrol7728
      @sirpetrol7728 24 дня назад

      @@runningwolfgames5955 did you find a solution?

  • @DuhKoreGames
    @DuhKoreGames 2 месяца назад +2

    hey this is a great tutorial! just curious if you could explain/make a short video on adding visibility range to them, like they only notice you when you get a certain distance away, im struggling to understand how to implement it :((

  • @waldemarfernandesanhaya1618
    @waldemarfernandesanhaya1618 4 месяца назад +3

    My zombie My zombie doesn't walk, can someone help me, I did everything said in the tutorial and it still didn't work, I tried other tutorials and it didn't work either, I'm starting to think that the problem is with the model or with the naviga agent

  • @Mr-Draxs
    @Mr-Draxs Год назад +3

    next video i recommend camera movement/reaction(camera shake).
    you know it shakes if moving right/left foward/backward(zoom in acording to speed) atacking/gettinghyrt(little shake in direction of atack, react to oposite direction of getting hurt)
    so many games forgot to add camera reaction when its something kinda simple and adds so much to immersion.

    • @legiongames2400
      @legiongames2400  Год назад +2

      Thank you for watching! All of these things are already in this game, check out the character controller I used for it: ruclips.net/video/A3HLeyaBCq4/видео.html

  • @diljotsahota9761
    @diljotsahota9761 5 месяцев назад +1

    around 8 min mark - the animation of him running starts but does not loop - even though I have active turned on

  • @nicolaslanzoni9385
    @nicolaslanzoni9385 5 месяцев назад

    leaving a like to show my appreciation to the video, not because of how useful it was to me (it was) , but exclusively due to the fact he pronounces words with "L" as wittle baby would, which i find very cute.

  • @joelconstantine4105
    @joelconstantine4105 7 месяцев назад +7

    I really appreciate the tutorials you've been having, all of this has been incredibly invaluable. However, I'm having some issues with this one and wondering if I missed anything. I'm on Godot 4.2.
    After following the tutorial up to the creation of the zombie script, everything seems to work fine, but when I test the my level scene to see how the zombie works, it moves around the map at an incredibly fast speed and has is not focused on the player at all. The zombie simply zooms around the map in random directions at high speed before it finally just falls off the end and disappears
    Total loss as to what is going on

    • @RdClZn
      @RdClZn 6 месяцев назад

      Same here but I noticed it's going for the initial position of the player, it's as if the position and target are not getting updated at all

    • @mrorange9127
      @mrorange9127 6 месяцев назад

      Any progress on this bug? I noticed that it is still doing the same thing after i deleted the script. It's probably due to the navigation agent.

    • @Pajusa101
      @Pajusa101 5 месяцев назад

      Same issue here

    • @gli7ch240
      @gli7ch240 4 месяца назад

      I had this same problem mine was because the collision shapes made for the sombie were on the same layer and mask as the world so they were infinitely colliding with each other pushing each other around change the masle and layer of each collision on the bones to a different one

  • @ObrunoDF
    @ObrunoDF 2 месяца назад +1

    13:31 Hey bro, ah this part when we need to create this call method and the function hit doesn't appear. What can we do?

    • @btim8350
      @btim8350 2 месяца назад +1

      you just have to save and itll show up

  • @PastaMaster115
    @PastaMaster115 2 месяца назад +1

    I don't know why yours works fine with your extra collision shape. For me the extra collision shape make it not work at all. Since I got an error for not having it, I added it back in but disabled it. It conflicts with the collision in the physical bones.

  • @Shawn-cq7qy
    @Shawn-cq7qy 8 месяцев назад +1

    Thx ❤the first time a watch it I didn’t do it right so I try a different video an then I come back to this video and restart it and it worked and I know now what I had done wrong and great video ❤

  • @s1ndrome117
    @s1ndrome117 7 месяцев назад +2

    hey! I wanted to ask why would you prefer to use _process() instead of _physics_process() for the enemy? shouldn't collision based bodies be in _physics_process() most of the time?

  • @paulchen9145
    @paulchen9145 11 месяцев назад +5

    I have a problem with the animation tree:
    When I switch the attack animation to "looping" the "at end"-transition from the attack state back to the run state is not working anymore.
    I guess this is expected, but it is important to have the attack animation looping, because when the player just stands still or stays in range of the player, the zombie should attack multiple times, so it should stay in the attack state. But I still want it to return to the run state once the player is out of range.
    I am guessing the "at end" transition never happens because a looping animation does not "end".
    How did you guys fix this?

    • @paulchen9145
      @paulchen9145 11 месяцев назад +1

      ​@@e-prophet4110It's kinda weird because if you think about it wouldn't you be stuck in an animation state forever (like "attack") just because the animation is looping? Intuitively the "at end" transition should fire after every played animation and if the condition isn't met, it should loop again...

    • @user-qx1ff1pn1b
      @user-qx1ff1pn1b 11 месяцев назад

      For me the problem was in looped attack animation.

    • @viquitorious
      @viquitorious 11 месяцев назад

      @@paulchen9145 @e-prophet4110 did you guys managed it?

    • @legiongames2400
      @legiongames2400  10 месяцев назад +5

      Something I apparently hadn't noticed while I was making this. The animation can stay looping but the transition shouldn't be at end, it should be immediate. To give them a bit more range when they already started the attack I changed my target in range function to this:
      func _target_in_range():
      if anim_tree.get("parameters/conditions/attack"):
      return global_position.distance_to(player.global_position) < 2 * ATTACK_RANGE
      return global_position.distance_to(player.global_position) < ATTACK_RANGE

  • @vettie
    @vettie Год назад +2

    These are some of the best Godot tutorials that I've ever watched. Thanks alot.

  • @bonsaipropaganda
    @bonsaipropaganda Год назад +2

    So I'm stuck. when I try: "func target_in_range():
    return global_position.direction_to(player.global_position) < attack_range"
    I get an invalid operands error:
    Invalid operands 'Vector3' and 'float' in operator '

    • @bonsaipropaganda
      @bonsaipropaganda Год назад +2

      nvm I'm silly haha I just needed to take a break and come back to it the next day and I immediately saw what I did wrong! I wrote direction_to instead of distance to

  • @victorgustavo4366
    @victorgustavo4366 Месяц назад

    7:24, my mob goes run off like as bullett. Why it does this? I have hatched 2 videos to solve this problem.

  • @collinvisser7108
    @collinvisser7108 Год назад +3

    Neat well done - not sure if you did but using call deferred on hit and not calling it directly - my understand is this is performance - another small change is to use an area 3D on the player and on the enemy to control distance and link up the bools to the animation to area enter and area exist this can also have performance implications. distance_to is expensive to run every frame.
    Been enjoying this video

    • @legiongames2400
      @legiongames2400  Год назад

      Nice, thank you for the tips on performance, it's something that I really need to learn more about. Any resources that you used to figure all of this stuff out?

    • @collinvisser7108
      @collinvisser7108 Год назад

      @@legiongames2400 Miziziziz and Canopy Games - but mainly the doc

    • @collinvisser7108
      @collinvisser7108 Год назад

      @@legiongames2400 I am not an expert - You can see from my chanel and my itch I am doing basic stuff - I am not trying to use what the C++ code give and not codeing my own code - leverage the engine

    • @legiongames2400
      @legiongames2400  Год назад

      @@collinvisser7108 Thank you, I still got ways to go.

    • @ince55ant
      @ince55ant Год назад

      you can do a cheaper distance_to by manually recreating it BUT not doing the square root part (a² + b² = c², with c being the distance and a & b being x/y/z, also remember to use absolute to get positive values). just need to note when making comparisons that the distance is squared, which you can just manually do, or multiply a variable by itself which is cheaper than the square root you'd otherwise have had to do

  • @slimebuck
    @slimebuck 10 месяцев назад +2

    this is perfectly what i need to do in my project. u sir came in clutch and saved the day!

  • @SunJaycy
    @SunJaycy 7 месяцев назад +2

    my attack animation doesn't loop. and if I change the animation to loop in the editor then it doesn't switch back to run. fixed it. change the "at end" to "immediate" on the attack to running anim

    • @ThatAnimatorGuy_
      @ThatAnimatorGuy_ 2 месяца назад

      i'm getting that same issue but this isnt changing anything... can you give more detail?

  • @jasmansaharan2044
    @jasmansaharan2044 2 месяца назад +2

    Anyone can please can help me that how did bro combined al the animations in blender in one as I am new in blender

  • @jlebrech
    @jlebrech Год назад +1

    i would add a collision box to the zombie's hand and toggle the collider in the the animationplayer.

  • @JustLis170
    @JustLis170 4 месяца назад

    THX BRO. You are te unique person that make good tutorials. I can't find tutorials like that in Spanish😭😭

  • @graphtet3751
    @graphtet3751 9 месяцев назад +2

    When it try to add the enemy to the scene and run it it crashes and displays the text “invalid get index global transform on base null instance” how do I solve this

    • @IceWolve67
      @IceWolve67 6 месяцев назад

      did you slide the player node in the player path variable from the zombie ?

    • @SparrowIZ
      @SparrowIZ 4 месяца назад

      @@IceWolve67 what you mean

    • @aschnn
      @aschnn 7 дней назад

      @@SparrowIZ in the inspector click assign on the right

  • @coltonrussell4110
    @coltonrussell4110 Год назад +1

    Yeah this is an Awesome video! I'd love it if you did some RTS style tutorials.

  • @ThatAnimatorGuy_
    @ThatAnimatorGuy_ 2 месяца назад +1

    can you please make a video on ranged enemies? I'm making a movement based fps so it is really easy to dodge the melee enemies shown here. ty

  • @DeadByMonttt
    @DeadByMonttt 5 месяцев назад +1

    in godot 4.1.3
    when the attack animation is in loop we can't make the State_machine to go back to "Run" with "at_the_end"
    if we don't loop the "Attack" animation the enemy just hit you once and stand there
    how can i solve this problem ?

    • @legiongames2400
      @legiongames2400  5 месяцев назад +1

      Something I apparently hadn't noticed while I was making this. The animation can stay looping but the transition shouldn't be at end, it should be immediate. To give them a bit more range when they already started the attack I changed my target in range function to this:
      func _target_in_range():
      if anim_tree.get("parameters/conditions/attack"):
      return global_position.distance_to(player.global_position) < 2 * ATTACK_RANGE
      return global_position.distance_to(player.global_position) < ATTACK_RANGE"

    • @DeadByMonttt
      @DeadByMonttt 5 месяцев назад

      @@legiongames2400 thanks for your help

  • @livvylowe8066
    @livvylowe8066 Год назад +3

    Hi! I seem to be running into an issue with the AnimationTree Root Motion step, where setting the Root Motion track doesn't seem to lock it in place. I'm using the same mixamo animations as you but with a custom uploaded armature/mesh. Any ideas what could be the issue here? Thanks in advance.
    Edit: I just said screw it and redid the mixamo download with "in-place" checked

    • @redfun2125
      @redfun2125 9 месяцев назад

      Sir, your question is whether there is a misalignment of each collision bone when adding them to the zombie?

  • @GeneralChrisGaming
    @GeneralChrisGaming 2 дня назад

    After saving the mesh file godot still wont let me edit anything about the model surely I'm not getting anything wrong

  • @cxzv3
    @cxzv3 Год назад +3

    Ty keep it up can you make a video that tells how to do world generation

    • @legiongames2400
      @legiongames2400  Год назад

      Thank you for watching! :) Like procedural generation?

  • @queworldwow6262
    @queworldwow6262 Месяц назад

    Thank you so much for this tutorial, it really helped! By the way, any idea how to make the enemy not jiggle when it comes to the edge of the navigation region? For some reason it freaks out when touches the edges of this area, it always moves at the speed of light and just rotates back-forth

  • @catjox_45
    @catjox_45 Год назад

    Nice! Looking forward to the next vids!

  • @PastaMaster115
    @PastaMaster115 2 месяца назад +1

    I'm so frustrated. I'm almost at the end of this tutorial. Things were rocky but I managed to get things to work for the most part. Except the zombie still floating above the ground when running but perfectly on the ground when attacking. And when attacking, won't do anything else until I get out of his attack range so he can run again. And on top of all of that, all the collision shapes somehow became catastrophically fucked. So I have to spend another hour placing them back where they go. I'm not having very good luck lol

  • @aguest5394
    @aguest5394 8 месяцев назад +1

    1:45 having trouble with this part, maybe maximo or the import has changed im not sure but i cannot just click delete not sure how/what to merge

  • @BESTIAL-CRUCIFIER
    @BESTIAL-CRUCIFIER 7 месяцев назад +1

    Hey man, this tutorial has been incredibly helpful to me. Can you offer any advice for making a range where the zombie doesn't pursue the player and instead idles/wanders? I tried but it didn't work, might be my misunderstanding of the animation tree.

  • @davew723
    @davew723 5 месяцев назад

    Thanks for the video. It helped me get a FPS player controller going. For the enemy's why don't you use a hit box (area3d/collisionbox) to determine if there attack works. The range approach seems kind of scetchy.

    • @legiongames2400
      @legiongames2400  4 месяца назад

      Thank you for watching! Yeah could be a little sketchy for some applications but it's worked okay for this kind of game. Probably wouldn't use it for anything but basic melee attacks.

  • @slavcabbage2619
    @slavcabbage2619 День назад

    Finished 9/7

  • @ihaveagoddamnplanarthur
    @ihaveagoddamnplanarthur 13 дней назад

    0:25 grab that grotto

  • @spud7234
    @spud7234 9 месяцев назад +2

    Hey uh, how do i make the enemies not travel in a straight line? i.e avoid obstacles and follow the actual walkable path to the player
    in debug mode for the nav agent, the path even shows that it wants to go around obstacles and ramps
    is there some other way to write the walking code here?

    • @legiongames2400
      @legiongames2400  8 месяцев назад

      I'm not fully understanding the question. The enemy pathing avoids obstacles and then travels in a straight line when that path is available, what kind of behavior are you looking for here?

    • @spud7234
      @spud7234 8 месяцев назад

      I seem to be doing something wrong then, because mine does not avoid obstacles, I'll watch the vid more closely and see if it works, thanks

  • @thebotheringguy2154
    @thebotheringguy2154 Месяц назад

    i am struggling with a problem: the switch mode seems to not work properly in godot 4.2
    i also found on reddit people talking about this exact problem, they used to have the same working pattern of this zombie regarding animations and also the way to switch between animation, but as they update up to 4.2 (they used 4.0 initially) this happens: the switch mode "at the end" seems to not work properly, so we get the zombie stucked in the same position with attack looping as soon he match the range condition, before that he runs fine towards player, but after that he just stares you blocked in the same position with attack loop

    • @thebotheringguy2154
      @thebotheringguy2154 Месяц назад

      for now i solved the problem using "Xfade time" using also "immediate" switch mode, i gave 2 seconds to the animation to crossfade (which is nice cause the zombie slowly starting to run, kinda like more realistic acceleration)
      But still kindly asking to resolve the "at the end" problem :)

  • @JacobKinsley
    @JacobKinsley Год назад +1

    Doesn't godot 4.0 have a way to directly import blender files so you don't have to mess with glb files and stuff?

  • @BumpDev
    @BumpDev 8 месяцев назад +1

    Why do you use process and not physics_process? I'm confused

  • @kultist_28DSH
    @kultist_28DSH Месяц назад

    and why do I have a Zombie moving away from the player, and not towards him?

  • @Originalshy
    @Originalshy Месяц назад

    I have a question! For the game I am making, the enemies do not have animations. Can I still detect the damage, and how?

  • @melware_1869
    @melware_1869 8 месяцев назад +2

    for some reason when i followed until 7:00 everything was fine, but the move and slide function made my mesh just run into the void, had no way of changing where he went, was wondering if anyone has something similar happen to them?

    • @IceWolve67
      @IceWolve67 6 месяцев назад

      like he does just move forward to no end ?

    • @melware_1869
      @melware_1869 6 месяцев назад

      @@IceWolve67 yeah, and at lightspeed as well

  • @ropepores4688
    @ropepores4688 Год назад

    Thank you! Nice tutorial!

  • @DanielAttaway
    @DanielAttaway 5 месяцев назад

    Very cool tutorial, thanks

  • @bluethingy1112
    @bluethingy1112 9 месяцев назад +2

    Hey! Great Tutorial! Sorry I'm late, but I have a bug. Sometimes, when my zombie finishes its stand up animation, it will fly up into the air really fast. While it looks really funny in the game, I don't want it to happen. Could you help?

    • @legiongames2400
      @legiongames2400  8 месяцев назад

      Had the same issue pop up but the problem for me was that the enemies were spawning on top of each other so I had to make sure to rotate the spawns. IDK if the same thing is causing it for you though.

    • @drilkus1312
      @drilkus1312 5 месяцев назад +1

      I posted in another comment, but make sure your zombies Collision Mask is not the same as your worlds Collision Layer. Otherwise it can't find the correct path, so instead it rockets into the air.

    • @icesin7084
      @icesin7084 2 месяца назад +1

      @@drilkus1312 Thanks mate u saved my ass

  • @karimsantoro4326
    @karimsantoro4326 Год назад +3

    Hi i have a problem with my animation tree: from run to attack it' s all right but I have noticed that the enemy character, does not continue to attack either if my player is still in range. the enemy remain stopped until I move my player. I have tried loop animation for the enemy smash but in that way, the animation tree remains always in the smash animation. Could someone help me to understand better the problem? thanks

    • @legiongames2400
      @legiongames2400  Год назад +2

      That's my fault, sorry! My knockback hits the player out of range so I never noticed this was an issue! At the end of the enemy process function remove anim_tree.set("parameters/conditions/run", !_target_in_range()) and add anim_tree.set("parameters/conditions/run", true) to the ready function.

    • @karimsantoro4326
      @karimsantoro4326 Год назад

      i feel like a fool. I should have thought about it. thanks anyway. But do you too godot 4.1.1 have problems in collisions of physical bones? if I start an animation after setting the statemachine those collisions scatter by themselves

    • @legiongames2400
      @legiongames2400  Год назад +1

      @@karimsantoro4326 Yeah it's super buggy, I ended up having to attach the collision shapes manually. Check out this vid ruclips.net/video/6bbPHsB9TtI/видео.html around 7:28 for a more in-depth process.

    • @davidmarinho2848
      @davidmarinho2848 Год назад

      @@legiongames2400 Thank u a lot! This was gold since I am new to this :)

  •  Год назад +1

    Ty! Switching at end (attack) transition works if you disable attack animation loop from AnimationPlayer.

    • @paulchen9145
      @paulchen9145 11 месяцев назад

      But then the animation does not loop anymore right? So when the player just stands there the zombie should attack him multiple times, which is not happening when the animation does not loop?

    •  11 месяцев назад

      @@paulchen9145 Switch to different animation like Idle after attack ends

    • @paulchen9145
      @paulchen9145 11 месяцев назад

      @ But that defeats the whole purpose right? Because I don't wanna play another animation like Idle but attack again straight away

    • @s3byn
      @s3byn 11 месяцев назад

      Toggle the animation looping based on if the player is in range or not. When not in range, the zombie will finish its animation and return to his walking state because looping is disabled.

  • @francoiscoetzee1381
    @francoiscoetzee1381 3 месяца назад +1

    Can you make an AI tutorial with path finding

  • @IndiaMagicTV
    @IndiaMagicTV 6 месяцев назад

    Beautiful Zombies!

  • @user-mp2dx8kp4q
    @user-mp2dx8kp4q Год назад

    I like it, thanks for your tutorial!

  • @Spiward
    @Spiward 12 дней назад

    Please help, my bullet is curving upward???

  • @MGenrl
    @MGenrl 8 месяцев назад

    I am having trouble getting my movement to work. Here's the code: extends CharacterBody3D
    var player = null
    const SPEED = 4.0
    @export var player_path : NodePath
    @onready var nav_agent = $NavigationAgent3D
    # Called when the node enters the scene tree for the first time.
    func _ready():
    player = get_node(player_path)
    # Called every frame. 'delta' is the elapsed time since the previous frame.
    func _process(delta):
    velocity = Vector3.ZERO
    nav_agent.set_target_position(player.global_transform.origin)
    var next_nav_point = nav_agent.get_next_path_position()
    velocity = (next_nav_point - global_transform.origin).normalized() * SPEED
    move_and_slide()
    If you see any problems in the code, please tell me.

    • @soup_5268
      @soup_5268 5 месяцев назад

      same here i have no errors but my enemy is not moving at all

  • @mr.someone.t4760
    @mr.someone.t4760 8 месяцев назад +4

    Great video and series! I just have a problem when copy and paste the zombie I get a debug error saying: Invalid get index 'global_position'(on base: 'null instance"). This error is occurring on the _target_in_range(): part, and _process part. I even tried to copy paste your code form the git hub, since I am relatively new in godot so I must have made a mistake, but I still get the same error message. How to fix please help??!!

    • @dapro_bear8406
      @dapro_bear8406 8 месяцев назад +3

      @mr.someone.t4760 After wayyyyy too much time for such an easy thing to fix, I discovered at 6:24 through 6:29 that Legion Games assigns the player_path to the actual player (it's null by default) by clicking on the zombie in the explorer then clicking the player path and then clicking the actual player on the UI that pops up. In this case, there is a "null instance" because the script is trying to move the zombie to something that doesn't exist using a node/variable that isn't assigned to anything. Despite the fact that it has been two weeks, hopefully this helped.

    • @mr.someone.t4760
      @mr.someone.t4760 8 месяцев назад

      @@dapro_bear8406 THANK YOU SO MUCH!!

    • @runningwolfgames5955
      @runningwolfgames5955 2 месяца назад

      @@dapro_bear8406 I’m experiencing the same issue is there anyway could explain how to fix it better I’m extremely new. Like would I just need to remove the variable player = null?

    • @dapro_bear8406
      @dapro_bear8406 2 месяца назад

      @@runningwolfgames5955 If you are still experiencing the same bug i had encountered, I believe that there is a very "fast segment" of the video where Legion Games assigns the player some sort of variable in a diffrent menu (I think by clicking on the left side of something) the timestamp that this happens is 6:24 (slow down the video and watch several times). Let me know if this helps!

  • @sassani134
    @sassani134 7 месяцев назад

    Thanks a lot for this tuto

  • @user-zq6du5zo6c
    @user-zq6du5zo6c 10 месяцев назад

    I learned a lot! Thank you 🤓

  • @sinsamuhamad
    @sinsamuhamad 6 месяцев назад

    How can a distance parameter be established such that if a player is within one meter of a zombie, the zombie will start chasing, but if the player is farther away from the zombie, it will not chase?

  • @Weebletmon
    @Weebletmon Месяц назад

    possibility of a updated tutorial?

  • @salt2947
    @salt2947 10 месяцев назад

    Everything is working but the collision shapes move out of place whenever the get up animation plays

  • @darxkl05
    @darxkl05 Год назад

    Even though I'm using godot 3.5 , you saved my fucking life. I had been struggling with smooth rotation for ages. Thanks a lot.
    Btw, I actually rotated the enemy through code, and this created a conflict with lerp so I just ended up removing the line that rotated the enemy and used the approach showed in the video (rotating the mesh). With both lines of code, the enemy just kept changing rotation every frame

  • @reliablespoon
    @reliablespoon 3 месяца назад

    I keep getting the error "Invalid get index 'global_transform' (on base: 'null instance'). I don't know why this is. I did everything exactly as you did it in the tutorial

    • @PastaMaster115
      @PastaMaster115 2 месяца назад

      I get that same error any time I try to do navigation meshes. I found out in a different tutorial that if you keep your code as is, and drop a zombie into your level and adjust the player path property, set it to player, it will work. Well sort of. I think it's meant to set that automatically when they spawn in on their own. But mine is sprinting off the damn screen when I enter the level.

  • @yusifsayed8048
    @yusifsayed8048 Месяц назад

    2:50 it just doesn't work I'm working with 4.2

  • @artsmit9545
    @artsmit9545 5 месяцев назад

    i have quarry , i made tps controller but it is not moveing in direction of camera faceing i can only go all direction (with animation) indipendent to camera can you help me i used same lerp logic and basic templet of charecter conreolled script

  • @mrorange9127
    @mrorange9127 6 месяцев назад +1

    Hi Legion Games, the Zombie just moves at a very high speed in the player's direction and falls off the map after i enter the script in the video, are there any reasons to why this is happening?

    • @timepass6972
      @timepass6972 3 месяца назад +1

      same issue occured with me, just set all skeletal bones collision layer to 2 as shown in video

  • @ayotundealabi7843
    @ayotundealabi7843 3 месяца назад +1

    cool game engine

  • @MyntiAI
    @MyntiAI Год назад +1

    For some reason there is an error for the code of the AI chasing the player. On the line "nav_agent.set_target_position(player.global_transform.origin)" it gives me an error. There are screenshots in the discord server for visual aid as I don't know how to explain it or even why something's wrong. Any help is appreciated :>

    • @legiongames2400
      @legiongames2400  Год назад +1

      Responded on discord but I think the issue is with how you're getting the player path using the editor like I did when I wasn't spawning the zombies. I eventually replaced that with just setting the path variable to the absolute path of the player directly:
      var player_path = "/root/World/Map/NavigationRegion3d/Player"

    • @CodeCanvasLabs
      @CodeCanvasLabs 11 месяцев назад

      its still not working!@@legiongames2400

  • @develuper6505
    @develuper6505 2 месяца назад +1

    HELP ME PLEASE!!! every time I start a scene, I get: The parameter "delta" is never used in the function "_process()". If this is intended, prefix it with an underscore: "_delta". and zombie.gd:15 @ _ready(): Node not found: " " (relative to "/root/Zombie").

    • @Devappl187
      @Devappl187 2 месяца назад +3

      delete system 32

  • @brandonawstinks
    @brandonawstinks 3 месяца назад +1

    For some reason, my enemy just runs off the map as soon as the game starts at a very fast speed.

    • @brandonawstinks
      @brandonawstinks 3 месяца назад

      as an update. it is now in the sky.

    • @legiongames2400
      @legiongames2400  3 месяца назад

      Oh lawd. That is no good, could you double check where he's tryna go by printing his nav points?

    • @PastaMaster115
      @PastaMaster115 2 месяца назад

      I had the same problem. Then I added the rotation code and then he was spinning around me at light speed. And then spun fast enough to fly off like a helicopter.

  • @thricemindblown7883
    @thricemindblown7883 10 месяцев назад +1

    Any good alternatives to Mixamo? Makes me nervous relying on an Adobe resource.

    • @legiongames2400
      @legiongames2400  10 месяцев назад +1

      Not that I know of, but let me know if you find any good ones!

  • @EricEmakpo
    @EricEmakpo 6 дней назад

    I tired the spawn buh didn't work

  • @NatureValleyCrumbs
    @NatureValleyCrumbs Год назад

    Well done, great video!

  • @user-hv2qz5vi5f
    @user-hv2qz5vi5f 4 месяца назад

    Whenever I try spawning them in, they spawn with no AI and are twice as big. How do you fix this?

  • @belgbeladel
    @belgbeladel Год назад

    very helpfull thank you so much

  • @juillotine
    @juillotine Год назад

    Thank you!

  • @owenlloyd2528
    @owenlloyd2528 Год назад

    Thank you

  • @DavidLeather-eh5ze
    @DavidLeather-eh5ze 9 дней назад

    node not found BOOO BOOO.... jk but eh i have MANY errors that i am struggling through because im working on a game i didnt design along side these videos lol and still have barly any clue what i am doing lol. also my enviroment isnt showing up in the node not sure how to get it into there but it does have colision boxes

  • @tutorial4779
    @tutorial4779 11 месяцев назад

    incredible wow.

  • @ArrianeRanjikoAguilar
    @ArrianeRanjikoAguilar 9 месяцев назад

    what shortcut button did you use to put the files inside the duplicates to the other file?

  • @entei6736
    @entei6736 Год назад

    dude you are a legend!