-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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
Deprecate functionality to copy visual Mesh data directly to a NavigationMesh #77702
Conversation
As I have just learned in #77452 (comment), the deprecated functionality should be wrapped in |
So how do we make navmeshes from gridmaps and/or other procgen meshes now? |
Zireael07 I think you are referring to the GridMap issue from today. I already gave a step-by-step. |
…tionMesh Deprecates NavigationMesh.create_from_mesh() function and MeshInstance3D 'Create Navigation Mesh' dropdown option.
aad8798
to
ae86579
Compare
@smix8 I would much rather see this function duplicated to Previously you said that:
Ok great, maybe we can keep that functionality, but renamed? Or is there a planned replacement which can handle more cases? Currently it's relatively simple to create a Navmesh as you mentioned in this issue (#77690): # Add a navmesh
var plane = PlaneMesh.new()
plane.set_size(Vector2(0.25, 0.25))
var nav_mesh = NavigationMesh.new()
var nav_mesh.create_from_mesh(plane) What would be the new proposed way to do this from code if we are deprecating this function? |
You add a very simplistic mesh with 4 vertices and 4 indices by using the var navmesh : NavigationMesh = NavigationMesh.new()
navmesh.vertices = PackedVector3Array([
Vector3(-10.0, 0.0, 10.0),
Vector3(10.0, 0.0, 10.0),
Vector3(10.0, 0.0, -10.0),
Vector3(-10.0, 0.0, -10.0),
])
navmesh.add_polygon(
PackedInt32Array([0, 1, 2, 3])
)
$NavigationRegion3D.navigation_mesh = navmesh This is an optimization over the PlaneMesh cause you do not stall the RenderingServer to create and access the PlaneMesh which is problematic at runtime especially with threads. You can also use a convex polygon instead of the triangles of a PlaneMesh as the NavigationServer supports any flat convex polygon.
The replacement is navigation mesh baking which handles all cases. |
This looks easy enough. I guess it loses a little where a user can draw a plane mesh or polygon mesh and transform it in the editor window. Then one can use I guess just documenting a lot more the |
It would be nice to provide some links to issues that this causes that cannot be resolved and can only be addressed by discouraging the use of the feature. It also seems to me that while the feature is flawed, there isn't a readily available replacement for it with the same level of convenience. I would like there to be a bit more discussion before we deprecate it. So postponing to at least 4.2 to give it a chance to be discussed more. |
Deprecates
NavigationMesh.create_from_mesh()
function and MeshInstance3D EditorPluginCreate Navigation Mesh
dropdown option.Both are a constant source of false user errors. The documentation already says what the functions do, copy vertices and indices from Mesh to NavigationMesh (and they do not more) but even what they do is wrong in most cases.
The vast majority of visual meshes have inherently invalid data for navigation mesh use. It makes little sense to support such a data copy directly with a dropdown Editor option that most new users will stumble over.
Both functions are from a time where Godot had a very simplistic concept of what a valid navigation mesh could and should be, with no navigation mesh connections and no NavigationServer to worry about.
For baking a valid navigation mesh from visual meshes either use a NavigationRegion or the NavigationMeshGenerator.
For procedural navigation meshes all the usual functions still exist to add vertices and polygons to a NavigationMesh. It is also a lot faster at runtime to use your vertices and indices arrays directly as the RenderingServer will make your performance bleed for receiving the visual mesh arrays.