It's utterly absurd how this 'feature' takes years to fix. It's almost March 2024 and in Godot 4.2 'wall clinging' is still a problem, that's taken me almost a day to research, and we're still have to do with hacks. Thank you for the solution, and sorry for ranting.
I may be late to this, but if you do this and also put the terrain in a layer that is not included in the thing-getting-stuck's mask, it will still pathfind correctly because it "knows" not to go though walls and will not collide with them if it gets too close. For example, if the wall is in layer 1 you disable mask 1 in the thing. The wall would still be able to interact with other stuff, you just need to enable mask 1 in the things you want the wall to interact with. Also, you can change masks and layers in script, so if you need to make the thing collide with the wall you can enable and disable it as much as you want.
so what happens if you have a character with a bigger colision shape? this fixes nothing. (not blaming you by the way, i just dont understand why the implemented it like this, its very buggy and basically still useless for commercial use.)
@@MaFFaKa i have implemented my own navigation system for now. it works great, wont use godot's anytime soon. it took me one week to have this system up and working.
i tried doing that with a 16x16 tile (I set the merging Edge Connection parameter to 8)but It doesn't seem to work,Could you please help me ? Thanks :D
@@mgomezmunoz92 I found an alternative basically what I do, is I make an auto-tile with navigation2D collisions except they aren't directly touching edges if that makes sense
Tried this in Godot 4, different process but similar idea, setting the project setting to combine the polygons. But the problem is when the target is outside of the navigation polygons (in between the gaps), the agent thinks it cannot navigate to it. Is there a fix?
This is great. But in Godot 4 no matter what I do, enemies still get stuck sometimes unless I give them absolutely tiny collision shape. Have you figured something better that works for Godot 4?
Unfortunately no, this is the best I have come up with for this problem. Actually, if your levels are static and not randomly generated, you can just manually create large navigation polygons yourself, and be sure to define them such that there's a good amount of space between the navigation polygon and any terrain.
The navigation polygons are much easier to deal with than tilemap navs for sure, and the overall pathfinding is smoother because of the way the polygons are divided. Might look into automating NavRegion2D creation for tilemaps. Would be nice to just be able to pick a margin of distance from from the ground layer, and fill in the polys where there are background layers.
Tileset navigation is not as good as having a large single navigation polygon, I have done some testing with a vampire survivors like game and there is a clear difference between tilemap and single polygon navigation.
@@FirebelleyGames true but I think you can cut holes into navigation polygons. Granted for fast prototyping tile maps are great, but it can’t handle more the 25 AIs before frame loss, where a single polygon didn’t have any or barely noticeable frame loss even when getting close to 200+ AIs.
I'm using circular collider and I still have this problem. I'm using safe velocity (for obstacle avoidance) driving the CharacterBody2D velocity and as the character approaches the corner, the velocity vector approaches perpendicular direction to the wall character is still sliding on. It ends up stuck with center of circle aligned with the corner, pushing perpendicularly to the wall and not moving.
for anyone on godot 4, you need to turn on advanced settings to see Navigation 2D Option in the settings by the way
It's utterly absurd how this 'feature' takes years to fix. It's almost March 2024 and in Godot 4.2 'wall clinging' is still a problem, that's taken me almost a day to research, and we're still have to do with hacks. Thank you for the solution, and sorry for ranting.
I may be late to this, but if you do this and also put the terrain in a layer that is not included in the thing-getting-stuck's mask, it will still pathfind correctly because it "knows" not to go though walls and will not collide with them if it gets too close.
For example, if the wall is in layer 1 you disable mask 1 in the thing. The wall would still be able to interact with other stuff, you just need to enable mask 1 in the things you want the wall to interact with.
Also, you can change masks and layers in script, so if you need to make the thing collide with the wall you can enable and disable it as much as you want.
Thank you, tried doing this but I was unsuccessful, didn`t knew about this merging Edge Connection parameter, really useful!
Thanks mate, I just had this issue in Godot 4. You saved me many, many hours of frustration!
thank you this was driving me insane and i couldn't find a workaround
This is exactly what I needed. Much appreciated.
why is it shaking?
Thank you. Been looking for this for 3 months
so what happens if you have a character with a bigger colision shape? this fixes nothing. (not blaming you by the way, i just dont understand why the implemented it like this, its very buggy and basically still useless for commercial use.)
This is indeed a problem unfortunately
I decided to make navigation polygons manually, if you found a better solution please let me know.
@@MaFFaKa i have implemented my own navigation system for now. it works great, wont use godot's anytime soon. it took me one week to have this system up and working.
@@Marduk401 yeah, godot's nav system is huge steaming POS, unfortunately. Still there a year later.
Concise and very helpful thank you!
Hi could you make a nice and easy followup off youre bullet turtorial, like how that you can make a shotgun type of shot etc
Is there a way to disable the diagonal cut made at corners?
i tried doing that with a 16x16 tile (I set the merging Edge Connection parameter to 8)but It doesn't seem to work,Could you please help me ?
Thanks :D
same issue, did you fix it?
@@mgomezmunoz92 I found an alternative basically what I do, is I make an auto-tile with navigation2D collisions except they aren't directly touching edges if that makes sense
I tried this and my character stopped moving all together. Can you please help?
what a simple fix thank you :)
Great Tutorial! ❤
Tried this in Godot 4, different process but similar idea, setting the project setting to combine the polygons. But the problem is when the target is outside of the navigation polygons (in between the gaps), the agent thinks it cannot navigate to it. Is there a fix?
try increasing the target desired distance of the agent
This is great. But in Godot 4 no matter what I do, enemies still get stuck sometimes unless I give them absolutely tiny collision shape. Have you figured something better that works for Godot 4?
Unfortunately no, this is the best I have come up with for this problem.
Actually, if your levels are static and not randomly generated, you can just manually create large navigation polygons yourself, and be sure to define them such that there's a good amount of space between the navigation polygon and any terrain.
@@FirebelleyGames yup thats what i did and it works now.
The navigation polygons are much easier to deal with than tilemap navs for sure, and the overall pathfinding is smoother because of the way the polygons are divided.
Might look into automating NavRegion2D creation for tilemaps. Would be nice to just be able to pick a margin of distance from from the ground layer, and fill in the polys where there are background layers.
Tileset navigation is not as good as having a large single navigation polygon, I have done some testing with a vampire survivors like game and there is a clear difference between tilemap and single polygon navigation.
That makes sense, but TileMap navigation is often more sensible particularly for complicated tilemaps with lots of obstacles.
@@FirebelleyGames true but I think you can cut holes into navigation polygons. Granted for fast prototyping tile maps are great, but it can’t handle more the 25 AIs before frame loss, where a single polygon didn’t have any or barely noticeable frame loss even when getting close to 200+ AIs.
I also didn’t know about the merge distance option though, so I should probably do more testing.
wouldnt using circular collissions also fix this issue? or is it not using move_and_slide to move around?
I'm using circular collider and I still have this problem. I'm using safe velocity (for obstacle avoidance) driving the CharacterBody2D velocity and as the character approaches the corner, the velocity vector approaches perpendicular direction to the wall character is still sliding on. It ends up stuck with center of circle aligned with the corner, pushing perpendicularly to the wall and not moving.