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

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 ก.ย. 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

ความคิดเห็น • 410

  • @-starrysunrise-2908
    @-starrysunrise-2908 ปีที่แล้ว +80

    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 11 หลายเดือนก่อน +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 2 หลายเดือนก่อน +2

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

  • @eugeneivanov353
    @eugeneivanov353 11 หลายเดือนก่อน +33

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

    • @legiongames2400
      @legiongames2400  10 หลายเดือนก่อน +1

      Thank you! :)

    • @Yoni123
      @Yoni123 7 หลายเดือนก่อน

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

  • @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 :)

  • @tarik2662
    @tarik2662 ปีที่แล้ว +9

    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 ปีที่แล้ว

      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 ปีที่แล้ว

      @@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 7 หลายเดือนก่อน

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

    • @noobnocontroletm3473
      @noobnocontroletm3473 5 หลายเดือนก่อน

      Thanks bro

  • @tl3119
    @tl3119 ปีที่แล้ว +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  ปีที่แล้ว +1

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

    • @tl3119
      @tl3119 ปีที่แล้ว +1

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

    • @mamontain
      @mamontain 10 หลายเดือนก่อน

      thanks

  • @ItsWinnieBruh
    @ItsWinnieBruh หลายเดือนก่อน

    Amazing video series!

  • @da_roachdogjr
    @da_roachdogjr ปีที่แล้ว +7

    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

  • @JiKayPh
    @JiKayPh 3 หลายเดือนก่อน +1

    Nice! Looking forward to the next vids!

  • @andypandy-py1zc
    @andypandy-py1zc 4 หลายเดือนก่อน

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

  • @indiegameworld5830
    @indiegameworld5830 ปีที่แล้ว +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

  • @NormalDalmatian
    @NormalDalmatian 6 หลายเดือนก่อน +17

    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 4 หลายเดือนก่อน +2

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

    • @IdenBond-xr1tj
      @IdenBond-xr1tj 2 หลายเดือนก่อน

      @@MaxSvid Exactly the same thing happened to me.

    • @okayoni6342
      @okayoni6342 หลายเดือนก่อน

      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.

  • @victorgustavo4366
    @victorgustavo4366 2 หลายเดือนก่อน

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

    • @Luciferatw0rk
      @Luciferatw0rk 15 วันที่ผ่านมา

      probably because of its collision shape , happened with my project too

  • @Rawrqual
    @Rawrqual 7 หลายเดือนก่อน +6

    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 หลายเดือนก่อน +10

      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 3 หลายเดือนก่อน +1

      @@s1ndrome117 God Bless you

    • @kevinscott5899
      @kevinscott5899 หลายเดือนก่อน +1

      @@s1ndrome117 thanks bro

    • @RaveZG
      @RaveZG 29 วันที่ผ่านมา +1

      @@s1ndrome117 ty so much. 💙

  • @vettie
    @vettie ปีที่แล้ว +2

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

  • @waldemarfernandesanhaya1618
    @waldemarfernandesanhaya1618 5 หลายเดือนก่อน +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

  • @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.

  • @I_turnedLEFT
    @I_turnedLEFT 10 หลายเดือนก่อน +7

    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 10 หลายเดือนก่อน +2

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

    • @runningwolfgames5955
      @runningwolfgames5955 2 หลายเดือนก่อน +1

      Same here unfortunately😩

    • @sirpetrol7728
      @sirpetrol7728 หลายเดือนก่อน +1

      @@runningwolfgames5955 did you find a solution?

    • @colinharrington5543
      @colinharrington5543 2 วันที่ผ่านมา

      You need to assign the Player Path export variable to your player on the zombie instance you placed into your main scene

  • @slimebuck
    @slimebuck 11 หลายเดือนก่อน +2

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

    • @legiongames2400
      @legiongames2400  11 หลายเดือนก่อน +1

      Glad I could help! :)

  • @Shawn-cq7qy
    @Shawn-cq7qy 9 หลายเดือนก่อน +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 ❤

  • @DuhKoreGames
    @DuhKoreGames 3 หลายเดือนก่อน +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 :((

  • @souvikdatta97
    @souvikdatta97 28 วันที่ผ่านมา

    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)

  • @DeadByMonttt
    @DeadByMonttt 6 หลายเดือนก่อน +2

    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 หลายเดือนก่อน +2

      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"

  • @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.

  • @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?

  • @entei6736
    @entei6736 ปีที่แล้ว +1

    dude you are a legend!

  • @tastybutspicy453
    @tastybutspicy453 11 วันที่ผ่านมา +1

    i created the physical skeleton and did the collision shapes, but when i play the animation the skeleton moves without the collision shapes. i really dont know what could cause this, at this point i am giving up and just not bothering with this. on Godot 4.4 btw

  • @PastaMaster115
    @PastaMaster115 3 หลายเดือนก่อน +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 2 หลายเดือนก่อน

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

    • @noahnielsen8673
      @noahnielsen8673 26 วันที่ผ่านมา

      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

  • @joelconstantine4105
    @joelconstantine4105 8 หลายเดือนก่อน +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 7 หลายเดือนก่อน

      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 7 หลายเดือนก่อน

      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 6 หลายเดือนก่อน

      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

  • @catjox_45
    @catjox_45 ปีที่แล้ว

    Nice! Looking forward to the next vids!

  • @diljotsahota9761
    @diljotsahota9761 6 หลายเดือนก่อน +1

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

  • @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 10 หลายเดือนก่อน

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

  • @ropepores4688
    @ropepores4688 ปีที่แล้ว

    Thank you! Nice tutorial!

  • @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: th-cam.com/video/A3HLeyaBCq4/w-d-xo.html

  • @AsherCN-x4x
    @AsherCN-x4x ปีที่แล้ว

    I like it, thanks for your tutorial!

  • @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

  • @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

  • @DanielAttaway
    @DanielAttaway 6 หลายเดือนก่อน

    Very cool tutorial, thanks

  • @생강차生薑茶
    @생강차生薑茶 10 หลายเดือนก่อน

    I learned a lot! Thank you 🤓

    • @legiongames2400
      @legiongames2400  10 หลายเดือนก่อน

      Glad it was helpful! :)

  • @ItsWinnieBruh
    @ItsWinnieBruh หลายเดือนก่อน

    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.

  • @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

  • @somindwithgames9827
    @somindwithgames9827 16 วันที่ผ่านมา +2

    If any body is having trouble with this part 6:24
    you have to do
    @export var player_path: NodePath
    for no tension copy this
    extends CharacterBody3D
    var player = null
    var nav_agent = null
    const SPEED = 4.0
    @export var player_path: NodePath
    func _ready():
    # Get player node
    player = get_node(player_path)

    # Assuming NavigationAgent3D is a child node; adjust path if necessary
    nav_agent = $NavigationAgent3D
    func _process(delta):
    # Ensure nav_agent and player are valid
    if nav_agent and player:
    # Set target position for the navigation agent
    nav_agent.set_target_position(player.global_transform.origin)

    # Get the next navigation point
    var next_nav_point = nav_agent.get_next_path_position()

    # Calculate velocity
    var direction = (next_nav_point - global_transform.origin).normalized()
    velocity = direction * SPEED

    # Move the character
    move_and_slide()

  • @PastaMaster115
    @PastaMaster115 3 หลายเดือนก่อน +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.

  • @IndiaMagicTV
    @IndiaMagicTV 6 หลายเดือนก่อน

    Beautiful Zombies!

  • @coltonrussell4110
    @coltonrussell4110 ปีที่แล้ว +1

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

  • @paulchen9145
    @paulchen9145 ปีที่แล้ว +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 ปีที่แล้ว +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...

    • @ПавелСироткин-р6л
      @ПавелСироткин-р6л ปีที่แล้ว

      For me the problem was in looped attack animation.

    • @viquitorious
      @viquitorious ปีที่แล้ว

      @@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

  • @sassani134
    @sassani134 8 หลายเดือนก่อน

    Thanks a lot for this tuto

  • @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 7 หลายเดือนก่อน

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

    • @SparrowIZ
      @SparrowIZ 5 หลายเดือนก่อน

      @@IceWolve67 what you mean

    • @aschnn
      @aschnn 25 วันที่ผ่านมา

      @@SparrowIZ in the inspector click assign on the right

    • @TheCoder-7
      @TheCoder-7 18 วันที่ผ่านมา

      @@aschnn I personally tried this and it STILL won't work, I looked at bug reports, tutorials, comments, for almost 3 months now so I've gotta ask, HOW THE HELL DID YOU FIX THIS!

  • @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

    • @pleb_guy
      @pleb_guy 3 หลายเดือนก่อน

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

  • @JustLis170
    @JustLis170 5 หลายเดือนก่อน

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

  • @pleb_guy
    @pleb_guy 3 หลายเดือนก่อน +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

  • @aguest5394
    @aguest5394 9 หลายเดือนก่อน +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

  • @PastaMaster115
    @PastaMaster115 3 หลายเดือนก่อน +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

  • @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

  • @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  9 หลายเดือนก่อน

      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 9 หลายเดือนก่อน

      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

  • @Luciferatw0rk
    @Luciferatw0rk 15 วันที่ผ่านมา

    for my game the zombie is attacking only once and then stopping unless i move out of the range

  • @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?

  • @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

  • @juillotine
    @juillotine ปีที่แล้ว

    Thank you!

  • @BESTIAL-CRUCIFIER
    @BESTIAL-CRUCIFIER 8 หลายเดือนก่อน +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.

    • @0xSuperMano
      @0xSuperMano 4 หลายเดือนก่อน

      resolved?

  • @Luciferatw0rk
    @Luciferatw0rk 16 วันที่ผ่านมา

    my enemy character just runs off in the world past the player in a single direction, help

  • @GeneralChrisGaming
    @GeneralChrisGaming 21 วันที่ผ่านมา

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

  • @jlebrech
    @jlebrech ปีที่แล้ว +1

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

  • @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?

  • @thebotheringguy2154
    @thebotheringguy2154 2 หลายเดือนก่อน

    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 2 หลายเดือนก่อน

      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 :)

  • @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  5 หลายเดือนก่อน

      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.

  • @BumpDev
    @BumpDev 9 หลายเดือนก่อน +1

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

  • @tutorial4779
    @tutorial4779 ปีที่แล้ว

    incredible wow.

  • @slavcabbage2619
    @slavcabbage2619 19 วันที่ผ่านมา

    Finished 9/7

  • @rredenvous
    @rredenvous 14 วันที่ผ่านมา

    My enemy goes to the players initial position. And then just...vibrates... but doesnt look at the player. Anyone had this issue?

  • @MatrixRex05
    @MatrixRex05 17 วันที่ผ่านมา

    Fix for 3:00 "change type" option not shown, using Godot 4.3. Right click on the zombie node(root) and remove inheritance.

    • @raddemo2860
      @raddemo2860 16 วันที่ผ่านมา

      Explain in details

  • @francoiscoetzee1381
    @francoiscoetzee1381 3 หลายเดือนก่อน +1

    Can you make an AI tutorial with path finding

  • @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

  • @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 th-cam.com/video/6bbPHsB9TtI/w-d-xo.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 :)

  • @belgbeladel
    @belgbeladel ปีที่แล้ว

    very helpfull thank you so much

  • @owenlloyd2528
    @owenlloyd2528 ปีที่แล้ว

    Thank you

  • @ihaveagoddamnplanarthur
    @ihaveagoddamnplanarthur หลายเดือนก่อน

    0:25 grab that grotto

  • @mrorange9127
    @mrorange9127 7 หลายเดือนก่อน +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 4 หลายเดือนก่อน +1

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

  • @thricemindblown7883
    @thricemindblown7883 11 หลายเดือนก่อน +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!

  • @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 ปีที่แล้ว

      its still not working!@@legiongames2400

  • @mr.someone.t4760
    @mr.someone.t4760 9 หลายเดือนก่อน +5

    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!

    • @jjl2844
      @jjl2844 7 วันที่ผ่านมา

      @@dapro_bear8406 While I appreciate your findings on this issue, this still hasn't explained _how_ to fix it, only *why* it's not working (or at least from what I understand of it). Do you happen to have any ideas? Thanks a bunch!

  • @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

  • @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?

  •  ปีที่แล้ว +1

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

    • @paulchen9145
      @paulchen9145 ปีที่แล้ว

      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?

    •  ปีที่แล้ว

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

    • @paulchen9145
      @paulchen9145 ปีที่แล้ว

      @ 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.

  • @ayotundealabi7843
    @ayotundealabi7843 3 หลายเดือนก่อน +1

    cool game engine

  • @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  9 หลายเดือนก่อน

      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 6 หลายเดือนก่อน +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 3 หลายเดือนก่อน +1

      @@drilkus1312 Thanks mate u saved my ass

  • @BryceDeOliveira
    @BryceDeOliveira 5 หลายเดือนก่อน

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

  • @salt2947
    @salt2947 11 หลายเดือนก่อน

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

  • @yusifsayed8048
    @yusifsayed8048 หลายเดือนก่อน

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

  • @ArrianeRanjikoAguilar
    @ArrianeRanjikoAguilar 9 หลายเดือนก่อน

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

  • @ibluebee2832
    @ibluebee2832 6 หลายเดือนก่อน

    Hey Legion ! I'm doing a multiplayer game where the players are spawned, so i can't use player_path the same way you did, do you have any idea on how to solve this problem ? the players name aren't player1 and player2, they are 1 for the host and random numbers for the clients. thanks for the tutorial !

    • @legiongames2400
      @legiongames2400  5 หลายเดือนก่อน

      I haven't done multiplayer with this just yet, I'm sorry

  • @DavidLeather-eh5ze
    @DavidLeather-eh5ze 27 วันที่ผ่านมา

    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

  • @AneeshDogra
    @AneeshDogra 6 หลายเดือนก่อน

    Hey thanks a lot for the tutorials. I am using a different model and tried to follown along in the code for the zombie but for some reason my zombie just runs instantly to the player and then starts spinning. I think that:
    velocity = (next_nav_point - global_transform.origin).normalized() * SPEED
    should normalize the speed etc. but shouldn't we be taking delta into consideration here? I am running on 144 hz

    • @legiongames2400
      @legiongames2400  6 หลายเดือนก่อน

      move_and_slide multiplies velocity by delta so unless you're moving the character manually that's probably not the problem?

  • @stevekonrad
    @stevekonrad 10 หลายเดือนก่อน

    Weird... hitting x/del on 1:50 just deletes the rig on my end (blender 3.6.5)

  • @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 3 หลายเดือนก่อน

      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.

  • @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

  • @ArrianeRanjikoAguilar
    @ArrianeRanjikoAguilar 9 หลายเดือนก่อน

    idk why my 3d model gets bigger lying down and t posing when i delete the duplicate

  • @DaveyGame
    @DaveyGame 9 หลายเดือนก่อน

    hey im having a problem, i run the game and it crashes im at 18:37 its a part of the spawning im also getting an error, "Attempt to call function 'get_child_count' in base 'null instance' on a null instance." and it wont allow me to spawn zombies

    • @DaveyGame
      @DaveyGame 9 หลายเดือนก่อน

      i fixed it never mind

    • @glovemiester
      @glovemiester 6 หลายเดือนก่อน

      @@DaveyGame TELL ME THE FIIIXXXX

    • @DaveyGame
      @DaveyGame 6 หลายเดือนก่อน

      Sorry I kinda forgot cuz it's been like 2 months I don't think I have the proj either

    • @glovemiester
      @glovemiester 6 หลายเดือนก่อน

      @@DaveyGame ok

  • @Dankakes
    @Dankakes ปีที่แล้ว

    HIIII Can you show this with multiple platers? how to get the zombies to descide on a player to attack? Im thinking every 10 or so seconds it can determine the distance of each player and choose to path to the closest one (Via nav path so they dont try to go through walls)

    • @legiongames2400
      @legiongames2400  ปีที่แล้ว +1

      Hey thank you for watching! The game is unfortunately not made for more than one player so any video I make on this topic would have to be for a different game. But I think you're on the right track where you can get references to all player objects and for each zombie you would get the path to each player and check which one is shortest. You'd set that as your target and for next 10 seconds you'd be chasing that player.