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

  Рет қаралды 95,482

LegionGames

LegionGames

Күн бұрын

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

Пікірлер: 409
@NormalDalmatian
@NormalDalmatian 5 ай бұрын
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 ай бұрын
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.
@-starrysunrise-2908
@-starrysunrise-2908 Жыл бұрын
You can disable the movement in Mixamo itself, just check "in-place"
@legiongames2400
@legiongames2400 Жыл бұрын
Saves a lot of time! Thank you for pointing it out!
@TheRealAfroRick
@TheRealAfroRick 11 ай бұрын
I was just about to ask why this wasn't done as that resolves the root motion issue.
@Failfer
@Failfer 8 ай бұрын
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 ай бұрын
Thank you for watching, I'm really glad it was helpful! :)
@runningwolfgames5955
@runningwolfgames5955 2 ай бұрын
@@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🙏
@FredyyDev
@FredyyDev Жыл бұрын
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!
@artiop7687
@artiop7687 2 ай бұрын
Incredible, thanks it helps me a lot and actually stills working on godot 4.2
@tl3119
@tl3119 Жыл бұрын
@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 Жыл бұрын
Oh yeah thats a good idea! Thank you for watching!
@tl3119
@tl3119 Жыл бұрын
@@legiongames2400 Thank you for your video too, I learnt a lot from them!
@mamontain
@mamontain 10 ай бұрын
thanks
@eugeneivanov353
@eugeneivanov353 10 ай бұрын
Dude these tutorials are extremely good. You need to make more!!!
@legiongames2400
@legiongames2400 10 ай бұрын
Thank you! :)
@Yoni123
@Yoni123 7 ай бұрын
I didn't watch this yet but is it something that could beused for a stealth game? @@legiongames2400
@da_roachdogjr
@da_roachdogjr Жыл бұрын
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
@southparkfan4603
@southparkfan4603 2 ай бұрын
You're amazing, I was trying to figure this out for quite some time. Good video, keep up the good work, please :)
@tarik2662
@tarik2662 Жыл бұрын
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 4 ай бұрын
Thanks bro
@ItsWinnieBruh
@ItsWinnieBruh 29 күн бұрын
Amazing video series!
@JiKayPh
@JiKayPh 3 ай бұрын
Nice! Looking forward to the next vids!
@Rawrqual
@Rawrqual 7 ай бұрын
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 ай бұрын
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 ай бұрын
I did that and still can't rename @@s1ndrome117
@stly8358
@stly8358 3 ай бұрын
@@s1ndrome117 God Bless you
@kevinscott5899
@kevinscott5899 Ай бұрын
@@s1ndrome117 thanks bro
@RaveZG
@RaveZG 26 күн бұрын
@@s1ndrome117 ty so much. 💙
@andypandy-py1zc
@andypandy-py1zc 4 ай бұрын
Absolutely brilliant tutorial, learnt some great code and ways to complete my game Thank you for sharing your knowledge.
@barney10240
@barney10240 4 ай бұрын
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.
@TimberLine534
@TimberLine534 Ай бұрын
Thanks man!
@bongo6_462
@bongo6_462 Жыл бұрын
2:50 press reimport I believe if anyone is stuck. Really hopes this helps. Let me know, its my first day in Godot
@DuhKoreGames
@DuhKoreGames 3 ай бұрын
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 :((
@joelconstantine4105
@joelconstantine4105 8 ай бұрын
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 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 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
@tastybutspicy453
@tastybutspicy453 7 күн бұрын
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
@souvikdatta97
@souvikdatta97 25 күн бұрын
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)
@PastaMaster115
@PastaMaster115 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 23 күн бұрын
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 10 ай бұрын
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 ай бұрын
Me 2 but somehow my other game nav sistem also not working
@runningwolfgames5955
@runningwolfgames5955 2 ай бұрын
Same here unfortunately😩
@sirpetrol7728
@sirpetrol7728 Ай бұрын
@@runningwolfgames5955 did you find a solution?
@SylkieDev
@SylkieDev 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.
@waldemarfernandesanhaya1618
@waldemarfernandesanhaya1618 4 ай бұрын
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
@s1ndrome117
@s1ndrome117 7 ай бұрын
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?
@indiegameworld5830
@indiegameworld5830 Жыл бұрын
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
@PastaMaster115
@PastaMaster115 3 ай бұрын
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.
@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.
@ObrunoDF
@ObrunoDF 2 ай бұрын
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 ай бұрын
you just have to save and itll show up
@diljotsahota9761
@diljotsahota9761 5 ай бұрын
around 8 min mark - the animation of him running starts but does not loop - even though I have active turned on
@ItsWinnieBruh
@ItsWinnieBruh 29 күн бұрын
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.
@catjox_45
@catjox_45 Жыл бұрын
Nice! Looking forward to the next vids!
@legiongames2400
@legiongames2400 Жыл бұрын
Thank you! :)
@Mr-Draxs
@Mr-Draxs Жыл бұрын
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 Жыл бұрын
Thank you for watching! All of these things are already in this game, check out the character controller I used for it: kzbin.info/www/bejne/d2SrfZivlqd2p5Y
@bonsaipropaganda
@bonsaipropaganda Жыл бұрын
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 Жыл бұрын
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
@DeadByMonttt
@DeadByMonttt 6 ай бұрын
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 ай бұрын
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
@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?
@vettie
@vettie Жыл бұрын
These are some of the best Godot tutorials that I've ever watched. Thanks alot.
@legiongames2400
@legiongames2400 10 ай бұрын
Thank you friend! :)
@livvylowe8066
@livvylowe8066 Жыл бұрын
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?
@IndiaMagicTV
@IndiaMagicTV 6 ай бұрын
Beautiful Zombies!
@Shawn-cq7qy
@Shawn-cq7qy 9 ай бұрын
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 ❤
@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
@paulchen9145
@paulchen9145 Жыл бұрын
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 Жыл бұрын
​@@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 ай бұрын
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
@SunJaycy
@SunJaycy 7 ай бұрын
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?
@slimebuck
@slimebuck 11 ай бұрын
this is perfectly what i need to do in my project. u sir came in clutch and saved the day!
@legiongames2400
@legiongames2400 11 ай бұрын
Glad I could help! :)
@GeneralChrisGaming
@GeneralChrisGaming 17 күн бұрын
After saving the mesh file godot still wont let me edit anything about the model surely I'm not getting anything wrong
@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 12 күн бұрын
probably because of its collision shape , happened with my project too
@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 :)
@somindwithgames9827
@somindwithgames9827 13 күн бұрын
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()
@ropepores4688
@ropepores4688 Жыл бұрын
Thank you! Nice tutorial!
@legiongames2400
@legiongames2400 Жыл бұрын
Thank you friend!!
@pleb_guy
@pleb_guy 3 ай бұрын
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
@entei6736
@entei6736 Жыл бұрын
dude you are a legend!
@graphtet3751
@graphtet3751 9 ай бұрын
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 4 ай бұрын
@@IceWolve67 what you mean
@aschnn
@aschnn 22 күн бұрын
@@SparrowIZ in the inspector click assign on the right
@TheCoder-7
@TheCoder-7 15 күн бұрын
@@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!
@BESTIAL-CRUCIFIER
@BESTIAL-CRUCIFIER 7 ай бұрын
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?
@coltonrussell4110
@coltonrussell4110 Жыл бұрын
Yeah this is an Awesome video! I'd love it if you did some RTS style tutorials.
@legiongames2400
@legiongames2400 Жыл бұрын
Thank you!
@MatrixRex05
@MatrixRex05 14 күн бұрын
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 13 күн бұрын
Explain in details
@AsherCN-x4x
@AsherCN-x4x Жыл бұрын
I like it, thanks for your tutorial!
@spud7234
@spud7234 9 ай бұрын
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
@JacobKinsley
@JacobKinsley Жыл бұрын
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?
@aguest5394
@aguest5394 9 ай бұрын
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
@wannabeserpento99
@wannabeserpento99 8 ай бұрын
works fine for me
@kultist_28DSH
@kultist_28DSH 2 ай бұрын
and why do I have a Zombie moving away from the player, and not towards him?
@cxzv3
@cxzv3 Жыл бұрын
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 ай бұрын
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 Жыл бұрын
i would add a collision box to the zombie's hand and toggle the collider in the the animationplayer.
@collinvisser7108
@collinvisser7108 Жыл бұрын
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
@DanielAttaway
@DanielAttaway 6 ай бұрын
Very cool tutorial, thanks
@legiongames2400
@legiongames2400 6 ай бұрын
Thank you! :)
@생강차生薑茶
@생강차生薑茶 10 ай бұрын
I learned a lot! Thank you 🤓
@legiongames2400
@legiongames2400 10 ай бұрын
Glad it was helpful! :)
@BumpDev
@BumpDev 9 ай бұрын
Why do you use process and not physics_process? I'm confused
@NatureValleyCrumbs
@NatureValleyCrumbs Жыл бұрын
Well done, great video!
@legiongames2400
@legiongames2400 Жыл бұрын
Thank you for watching! :) :)
@PastaMaster115
@PastaMaster115 3 ай бұрын
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
@Luciferatw0rk
@Luciferatw0rk 13 күн бұрын
my enemy character just runs off in the world past the player in a single direction, help
@develuper6505
@develuper6505 2 ай бұрын
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 ай бұрын
delete system 32
@Luciferatw0rk
@Luciferatw0rk 12 күн бұрын
for my game the zombie is attacking only once and then stopping unless i move out of the range
@bluethingy1112
@bluethingy1112 9 ай бұрын
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 ай бұрын
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 ай бұрын
@@drilkus1312 Thanks mate u saved my ass
@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.
@rredenvous
@rredenvous 11 күн бұрын
My enemy goes to the players initial position. And then just...vibrates... but doesnt look at the player. Anyone had this issue?
@mrorange9127
@mrorange9127 6 ай бұрын
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 ай бұрын
same issue occured with me, just set all skeletal bones collision layer to 2 as shown in video
@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.
@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?
@sassani134
@sassani134 7 ай бұрын
Thanks a lot for this tuto
@Weebletmon
@Weebletmon 2 ай бұрын
possibility of a updated tutorial?
@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 Жыл бұрын
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 Жыл бұрын
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 Жыл бұрын
@@karimsantoro4326 Yeah it's super buggy, I ended up having to attach the collision shapes manually. Check out this vid kzbin.info/www/bejne/bJPFgXupd56Hqqs 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 :)
@francoiscoetzee1381
@francoiscoetzee1381 3 ай бұрын
Can you make an AI tutorial with path finding
@salt2947
@salt2947 10 ай бұрын
Everything is working but the collision shapes move out of place whenever the get up animation plays
@JustLis170
@JustLis170 5 ай бұрын
THX BRO. You are te unique person that make good tutorials. I can't find tutorials like that in Spanish😭😭
@legiongames2400
@legiongames2400 5 ай бұрын
Thank you friend! :)
@MyntiAI
@MyntiAI Жыл бұрын
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 Жыл бұрын
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
@thricemindblown7883
@thricemindblown7883 10 ай бұрын
Any good alternatives to Mixamo? Makes me nervous relying on an Adobe resource.
@legiongames2400
@legiongames2400 10 ай бұрын
Not that I know of, but let me know if you find any good ones!
@Spiward
@Spiward 27 күн бұрын
Please help, my bullet is curving upward???
@mr.someone.t4760
@mr.someone.t4760 9 ай бұрын
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 ай бұрын
@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 4 күн бұрын
@@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!
@BryceDeOliveira
@BryceDeOliveira 4 ай бұрын
Whenever I try spawning them in, they spawn with no AI and are twice as big. How do you fix this?
@ihaveagoddamnplanarthur
@ihaveagoddamnplanarthur 28 күн бұрын
0:25 grab that grotto
@yusifsayed8048
@yusifsayed8048 Ай бұрын
2:50 it just doesn't work I'm working with 4.2
Жыл бұрын
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.
@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?
@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
@ArrianeRanjikoAguilar
@ArrianeRanjikoAguilar 9 ай бұрын
what shortcut button did you use to put the files inside the duplicates to the other file?
@juillotine
@juillotine Жыл бұрын
Thank you!
@legiongames2400
@legiongames2400 Жыл бұрын
Thank you for watching! :)
@DavidLeather-eh5ze
@DavidLeather-eh5ze 24 күн бұрын
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
@stevekonrad
@stevekonrad 9 ай бұрын
Weird... hitting x/del on 1:50 just deletes the rig on my end (blender 3.6.5)
@Eternal_Night17
@Eternal_Night17 Жыл бұрын
why when i play animation the Collision shape don't move with my zombie, like zombie moves with bones and bones collisions, but that one big circle just keep in one place when i play the animation.
@legiongames2400
@legiongames2400 10 ай бұрын
You need to move it with the animation player if you want it to move as well
Complete 3D Shooting Mechanics - Godot 4 FPS Tutorial
12:14
LegionGames
Рет қаралды 107 М.
HAH Chaos in the Bathroom 🚽✨ Smart Tools for the Throne 😜
00:49
123 GO! Kevin
Рет қаралды 14 МЛН
The joker favorite#joker  #shorts
00:15
Untitled Joker
Рет қаралды 14 МЛН
4 More Godot 4 Devs Make 4 More Games in 44 Hours
30:17
DevLogLogan
Рет қаралды 36 М.
1 Year of Developing My Game in Godot
19:19
Blargis
Рет қаралды 251 М.
I Paid Fiverr Game Developers to Make the Same Game
10:25
BadGameDev
Рет қаралды 696 М.
Immersive Sim in Godot 4: COGITO - Overview
8:22
Philip D
Рет қаралды 41 М.
Creating SMART enemies from scratch! | Devlog
5:40
Challacade
Рет қаралды 328 М.
Optimizing my Game so it Runs on a Potato
19:02
Blargis
Рет қаралды 583 М.
6 Years of Blender in 13 Minutes
13:01
Kaizen
Рет қаралды 94 М.
3 Devs Make An FPS - Godot vs Unity vs Unreal || GameDev Battles
12:39
The Greatest Evil A Game Can Commit
25:16
Daryl Talks Games
Рет қаралды 193 М.