Skip to content
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

Update 3D navigation demo for 4.0 #748

Merged
merged 1 commit into from
Jul 11, 2022

Conversation

jtnicholl
Copy link
Contributor

@jtnicholl jtnicholl commented Jun 9, 2022

I have updated the 3D navigation demo for Godot 4.0. On the list in #697.
Since the new NavigationServer provides a lot of new features for dynamic obstacle avoidance and such, and this demo doesn't use them, I also renamed it from "3D Navigation Mesh" to "Basic 3D Navigation". I figured that an advanced 3D navigation demo could be made later to showcase these features. I also renamed the directory it's in from "navmesh" to "basic_navigation".
One other thing I did is I extracted the robot mesh, level mesh, and navmesh from the scene and saved them to their own .res files. They contain binary data so they shouldn't have been packed into a .tscn file like that. I also removed the unused AnimationPlayer node, I'm not sure why it was there.

Lastly, I ran into an issue where the robot won't cross one small section of the level. This doesn't happen in the 3.x version. I tried everything I could think of, but I couldn't figure out why it's happening. Here's a screenshot to demonstrate:
Screenshot_20220609_142934
Hopefully someone can figure out what's causing this. I think it might be an engine bug. I don't think it's so major that this can't still be merged for now, but it will have to be fixed later.

@jtnicholl jtnicholl force-pushed the 3d_navigation branch 2 times, most recently from a408f65 to 63e176c Compare June 9, 2022 20:39
@Calinou Calinou added the update label Jun 9, 2022
@jtnicholl jtnicholl force-pushed the 3d_navigation branch 2 times, most recently from 08b855b to 87ea553 Compare June 11, 2022 12:38
@smix8
Copy link
Contributor

smix8 commented Jun 19, 2022

@jtnicholl
The pathfinding issue is due to the navmesh polygons being corrupted near the ramp. Godot also prints a region merge error at the scene start due to this. Clearing the baked navmesh and (re)baking solved the issue.

@jtnicholl
Copy link
Contributor Author

Not sure how I didn't notice that error message.
The error is caused by the settings used to generate the navmesh, clearing the navmesh before rebaking also clears all these settings back to the defaults. But the default settings won't work here, because it makes the ramp leading to the highest area up from the left uncrossable due to being too narrow.
The error says "This happens when the current cell_size is different from the one used to generate the navigation mesh" but this isn't true, the cell_size hasn't been changed after baking. After spending some time experimenting with the settings further, I managed to find a combination that makes the entire map navigable while also not printing the error message. It isn't ideal, though, it clips through the ground in a few small spots and also lifts above the ground quite a bit near the bases of some of the ramps, most noticeably the ramp that goes through the center ring. The cell_size should be lowered to fix this, but I couldn't find any combination of settings with a cell_size different from the default that worked.

@smix8
Copy link
Contributor

smix8 commented Jun 19, 2022

@jtnicholl
cell_size = 0.1
agent_radius = 0.1
max_slope = 65
Everything else default.

@jtnicholl
Copy link
Contributor Author

jtnicholl commented Jun 19, 2022

That's better, though it still lifts off the ground a bit near the bases of the ramps. I increased the agent_radius to 0.2 and that improved it a bit further. Still a slight bump but it's not that noticeable.

@aaronfranke aaronfranke added this to the 4.0 milestone Jul 10, 2022
Copy link
Member

@aaronfranke aaronfranke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The scenes need to be opened and re-saved since Godot 4 now doesn't save extra spaces inside parenthesis.

I figured that an advanced 3D navigation demo could be made later to showcase these features. I also renamed the directory it's in from "navmesh" to "basic_navigation".

I would prefer the folder name not have "basic" in it, unless/until there are multiple navigation demos. Even then, there's an argument in favor of having both "navigation" and "advanced_navigation" names.

@aaronfranke aaronfranke merged commit 5efee67 into godotengine:4.0-dev Jul 11, 2022
@jtnicholl jtnicholl deleted the 3d_navigation branch July 11, 2022 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants