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
You can disable the movement in Mixamo itself, just check "in-place"
Saves a lot of time! Thank you for pointing it out!
I was just about to ask why this wasn't done as that resolves the root motion issue.
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
Thank you for watching, I'm really glad it was helpful! :)
@@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🙏
Incredible, thanks it helps me a lot and actually stills working on godot 4.2
Dude these tutorials are extremely good. You need to make more!!!
Thank you! :)
I didn't watch this yet but is it something that could beused for a stealth game? @@legiongames2400
You're amazing, I was trying to figure this out for quite some time. Good video, keep up the good work, please :)
Nice one, you kind of forget to mention that you must enable looping in animation player in order for animations to actually loop.
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?
@@paulchen9145 Set looping with script depending if player is in range or not, that way you will not cancel already playing Animation :)
where is this?
in the animation window, there is an icon you need to click, on the right of the name of the anim @@0kr4m
Thanks bro
@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).
Oh yeah thats a good idea! Thank you for watching!
@@legiongames2400 Thank you for your video too, I learnt a lot from them!
thanks
Amazing video series!
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
Nice! Looking forward to the next vids!
Absolutely brilliant tutorial, learnt some great code and ways to complete my game
Thank you for sharing your knowledge.
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
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
This comment should be pinned to top. Wasted 4 hours of googling just to stumble upon this comment
@@MaxSvid Exactly the same thing happened to me.
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.
7:24, my mob goes run off like as bullett. Why it does this? I have hatched 2 videos to solve this problem.
probably because of its collision shape , happened with my project too
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.
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
I did that and still can't rename @@s1ndrome117
@@s1ndrome117 God Bless you
@@s1ndrome117 thanks bro
@@s1ndrome117 ty so much. 💙
These are some of the best Godot tutorials that I've ever watched. Thanks alot.
Thank you friend! :)
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
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.
Thanks man!
everytime i try to run my game it says “invalid get index global_transform (on base: null instance)” Any one know how to fix?
Me 2 but somehow my other game nav sistem also not working
Same here unfortunately😩
@@runningwolfgames5955 did you find a solution?
You need to assign the Player Path export variable to your player on the zombie instance you placed into your main scene
this is perfectly what i need to do in my project. u sir came in clutch and saved the day!
Glad I could help! :)
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 ❤
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 :((
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)
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 ?
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"
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.
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?
dude you are a legend!
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
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
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?
@@runningwolfgames5955 I kept the capsule but I disabled it.
@@PastaMaster115when I do that it for some reason falls through the map🤷♀️😂
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 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
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
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.
Same issue here
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
Nice! Looking forward to the next vids!
Thank you! :)
around 8 min mark - the animation of him running starts but does not loop - even though I have active turned on
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
Sir, your question is whether there is a misalignment of each collision bone when adding them to the zombie?
Thank you! Nice tutorial!
Thank you friend!!
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.
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
I like it, thanks for your tutorial!
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?
you just have to save and itll show up
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 '
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
Very cool tutorial, thanks
Thank you! :)
I learned a lot! Thank you 🤓
Glad it was helpful! :)
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.
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
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?
@@legiongames2400 Miziziziz and Canopy Games - but mainly the doc
@@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
@@collinvisser7108 Thank you, I still got ways to go.
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
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()
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.
Beautiful Zombies!
Yeah this is an Awesome video! I'd love it if you did some RTS style tutorials.
Thank you!
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?
@@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...
For me the problem was in looped attack animation.
@@paulchen9145 @e-prophet4110 did you guys managed it?
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
Thanks a lot for this tuto
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
did you slide the player node in the player path variable from the zombie ?
@@IceWolve67 what you mean
@@SparrowIZ in the inspector click assign on the right
@@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!
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
i'm getting that same issue but this isnt changing anything... can you give more detail?
THX BRO. You are te unique person that make good tutorials. I can't find tutorials like that in Spanish😭😭
Thank you friend! :)
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
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
works fine for me
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
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
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?
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?
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
for my game the zombie is attacking only once and then stopping unless i move out of the range
Ty keep it up can you make a video that tells how to do world generation
Thank you for watching! :) Like procedural generation?
Anyone can please can help me that how did bro combined al the animations in blender in one as I am new in blender
Thank you!
Thank you for watching! :)
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.
resolved?
my enemy character just runs off in the world past the player in a single direction, help
After saving the mesh file godot still wont let me edit anything about the model surely I'm not getting anything wrong
i would add a collision box to the zombie's hand and toggle the collider in the the animationplayer.
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?
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
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 :)
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.
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.
Why do you use process and not physics_process? I'm confused
incredible wow.
Finished 9/7
My enemy goes to the players initial position. And then just...vibrates... but doesnt look at the player. Anyone had this issue?
Fix for 3:00 "change type" option not shown, using Godot 4.3. Right click on the zombie node(root) and remove inheritance.
Explain in details
Can you make an AI tutorial with path finding
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
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
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.
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
@@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.
@@legiongames2400 Thank u a lot! This was gold since I am new to this :)
very helpfull thank you so much
Thank you :)
Thank you
Thank you for watching! :)
0:25 grab that grotto
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?
same issue occured with me, just set all skeletal bones collision layer to 2 as shown in video
Any good alternatives to Mixamo? Makes me nervous relying on an Adobe resource.
Not that I know of, but let me know if you find any good ones!
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 :>
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"
its still not working!@@legiongames2400
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??!!
@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.
@@dapro_bear8406 THANK YOU SO MUCH!!
@@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?
@@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!
@@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!
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").
delete system 32
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?
Ty! Switching at end (attack) transition works if you disable attack animation loop from AnimationPlayer.
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
@ But that defeats the whole purpose right? Because I don't wanna play another animation like Idle but attack again straight away
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.
cool game engine
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?
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.
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.
@@drilkus1312 Thanks mate u saved my ass
Whenever I try spawning them in, they spawn with no AI and are twice as big. How do you fix this?
Everything is working but the collision shapes move out of place whenever the get up animation plays
2:50 it just doesn't work I'm working with 4.2
what shortcut button did you use to put the files inside the duplicates to the other file?
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 !
I haven't done multiplayer with this just yet, I'm sorry
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
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
move_and_slide multiplies velocity by delta so unless you're moving the character manually that's probably not the problem?
Weird... hitting x/del on 1:50 just deletes the rig on my end (blender 3.6.5)
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
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.
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
idk why my 3d model gets bigger lying down and t posing when i delete the duplicate
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
i fixed it never mind
@@DaveyGame TELL ME THE FIIIXXXX
Sorry I kinda forgot cuz it's been like 2 months I don't think I have the proj either
@@DaveyGame ok
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)
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.