-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Need to occlude NavigationPolygon set in TileSet at runtime #3821
Comments
I can confirm the need for something like this, unless I'm misusing Navigation2D. In DynaDungeons, I had tried using Navigation2D (not committed) for pathfinding, but my problem is that I use two tilemaps:
With the implementation I had tried, the "allowed" status of the ground tile would take precedence over the "not allowed" status of the obstacle, thus pathfinding would ignore all obstacles. |
Yesss. This would be an extremely good thing to have, I've been wrestling with the same problem @akien-mga described above. |
Yes, having some kind of "NavigationOccluder" object would be extremely useful. |
Having a way to punch holes into navmeshes would be prim, too :P |
I have the same issue as akien-mga, and I can even have non-tile objects on top of it, that need to be avoided as well. Actually, in some cases it would be easier to build navigation only with occluders instead of nav. polys. |
Given how popular this issue is, I'll make sure it's fixed sometime before 2.1 is released :) |
That would be great! |
I also need that for my games.
With 1) and 2) would be very easy to create moving walls or opening doors. With 3) it would be great to make bodies to do not allow mutual crossing if they are occluding the path. I have one question: |
I think this is in the TODO list but not in the 2.1 as it looks like. Edit: Sorry my mistake. This is in the todo list for 2.1 |
Don't know if this trello is really used by developpers |
@kakoeimon when you build your tileset, you define a navigation polygon for each tile. Then, if you set a tilemap as a children of a Navigation2D, each tile will be linked to your navigation2d, and you build a full level of navigation. I said static data because you can't modify it at runtime as it's a tile information. Check this: https://www.youtube.com/watch?v=S-zEA_Ce1mk |
To add to this, you can actually use the "set_cell()" in the Tilemap node to switch cells with a NavigationPolygon to cells without them. Which is a way to cut off paths for doors and other roadblocks. |
@batmanasb You are right. Changing the tile from a tile with navigation polygon to a tile without navigation polygon updates the navigation mesh and blocks passages.
By the way @reduz reports his progress in Trello. |
@kakoeimon It's exactly what I am doing here https://www.youtube.com/watch?v=ThYeRtSqeBU, while adding some wall at runtime, i update a navigation tilemap which is only a navigationpolygoninstance and a staticbody. The problem is for "dynamic" object as car as you can see in video. edit: my mistake @kakoeimon, hint of tilemap navigation2d what no for you but to @genete :) |
@TotCac Yep, that's why we need obstacle avoidance. |
I've tried... But it's not critical for the imminent 2.1, so moving to the next milestone. |
As 2.2 is cancelled, any chance having this in 3.0? |
This Q&A question could be related: https://godotengine.org/qa/8757/2d-navigation-weighted-tiles-for-difficult-terrain |
Bump, which version would include this? 😃 |
2.1.2, that'd be great -> 2.1.3 |
Any chance for this in 3.0 or 3.1? Would be incredibly useful. |
I think they should freeze 3.0 and stop adding feature because release get delayed and delayed. |
When implementing this, would it be possible to give Tilemap node an option to make the whole tilemap navigable by default? In some cases putting tiles or objects later that blocks your npcs or player from walking through is more natural than painting walkable areas for them. |
|
how would this be different from just removing a tile from the path ? Or put a tile that does not a have a navigation polygon attached to it.. |
that's not an issue. add as many tiles without nav pol to have a very big obstacle. Also it does not matter the size of the obstacle (could a different object not necessarily a tile), what matters is the break in the nav. path. |
I'm bumping this issue so that someone that's good enough to implement this. Btw, they also have a lengthy explanation of the algorithm being used and what not. Please dev, do implement this. I'm afraid I'm not good enough to even understand it. Thank you. |
@balenol: Godot already is making use of a polygon clipping library named triangle. I am not sure if triangle is exposed to scripting, though? |
@Zireael07 I didn't know that. Maybe the only thing this "good enough than I am"-person should do, is to expose that library to the polygon2D object? I mean, does it have the NOT operation (i'm talking about boolean operation on polygon here) so that we could occlude the navmesh somehow? That would be awesome. |
I'd already open an issue to expose Clipper library to GDScript, as it's a part of engine external library aldeay #22275. But, it's not for computing at real time, and should not be used for our needs of new NavigationServer :) |
Not sure what use cases you'll be aiming to cover in the end. But if I could have a Navigation2D with many NavigationPolygonInstance inside and have them all get added together, that'd be super neat. |
@PabloNeirotti you do have the ability to do that right now. As long as the corners from each polygon is overlapping, godot will try to solve it. I've tried it with about 10000 instance before and it lag like hell. The clipper implementation is pretty useful because now instead of many instance with overlapping corners, you have one big polygon instance. |
+1 on the |
I think this could be solved with Clipper internally but I'm completely nebulous to path finding and navigation, though I'll give an idea. 😆 If I understand correctly, |
Hello friends, More than 3 years now that we ask for something to help us. Polygon operations on 2D (merge, xor...) and offseting has been merged into master branch 👍 Will have a try into this soon! |
@TotCac OH YEAAAAAAAAAAAAAAAAAAAH |
Congrats to @Xrayez juste above |
Thanks, I've exposed these methods in such a way that it would be applied to plenty of use cases I believe. I can't really help here until I actually need navigation features in my project to truly understand the use case, maybe some fellows can implement this in the core some day (wait another 3 years? 😅). |
How are these operations exposed? |
@J-Camilleri they are available in |
@Xrayez definitely. This is definitely helpful. Now I could just make a big/segmented navigation polygon and then clip it off bits by bits when loading. Thank you. |
If anyone still has the problem with multiple tilemaps, here is a solution i came up with: |
Dynamic collision avoidance has been implemented in #34776, closing. |
NavigationPolygon can be added to a Tileset to mark a tile to be used by Navigation2d to find a path.
While building your Tilemap, each tile have static data of navigation to be considered by pathfinding.
Problem: If you an extra layer of object that have to be avoided by Navigation2d pathfinding, how can you do?
Is it possible to have this improvment to 2d pathfinding?
The text was updated successfully, but these errors were encountered: