Navigation with Pathfinder - Learn Godot 4 2D - no talking
Вставка
- Опубліковано 2 чер 2024
- In this video I show you how you can move objects within a predefined area with the help of NavigationRegion and NavigationAgent.
If you liked the video and are interested in more don't forget to subscribe.
And If you would like a video about a game mechanic, leave a comment about it
📜 Note
the function _get_random_position() is not shown because it is not suitable for beginners.
With 4.3 there should be a built in function for this.
To achieve a similar effect, write a couple of points manually into an array and then pick it with a random genrator.
💎 Assets
water animals: nszym.itch.io/spearfishing-as...
🎵 Music credits
"Ancient Winds" from Kevin MacLeod
❤️ Support the Channel
Ko-Fi: ko-fi.com/devdrache
🎬 Video Chapters
0:00 - What you can expect
0:17 - code navigationAgent2D movement
1:45 - Setup NavigationRegion2D
2:23 - spawn fishes & result
You didn't have to create a nav region. Tilemaps have them built in. You can just go to their properties, and enable its navigation layer, then set the tiles you want to have movement as you see fit in tileset > select> physics.
I think that doing this would prevent the fish from swimming through walls, but that may have been because they didn't have collision shapes.
the whole scene has no collider.
The agent radius in the NavigationRegion2D must be increased so that the fish no longer go through the walls.
I worked a bit sloppy here 🙈