-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
NavigationMeshInstance crash baking static colliders with PlaneShape and ConvexPolygon #65764
Comments
Probably related to recastnavigation/recastnavigation#514 |
Rotating your shape even by 0.001 prevents the crash. It crashes because source geometry aligned 100% with the y-axis with no depth is invalid and it fails the ReCast span calculation. This is not specific to ConvexPolygon, it will happen with any other node type in Godot that allows to set the geometry depth to zero. Since Godot has no checks for this situation it adds the corrupted source geometry regardless which crashes ReCast that also has no check for it. What @timothyqiu linked prevents the crash on the ReCast side but it does not change the fact that this source geometry is illogical and should never be used in the first place. |
Specifically, when rasterizing a triangle into a heightfield with width or height of 0. This can happen when the input geometry bounding box extents are less than half the cell size in either x or z. This is a degenerate case, but can crop up in real life scenarios (see godotengine/godot#65764) so we should at least ensure it doesn't crash here.
This can happen when the extent of the input geometry bounding box is less than half the CellSize. This generates a heightfield size of 0 on either the x or z axis, and causes Recast to crash. Here's another sample project that causes a crash in the Recast code. This has been fixed upstream in Recast as part of recastnavigation/recastnavigation@3901c58. I've submitted a PR (#69189) to update the Recast integration in Godot to fix this issue. |
Godot version
v3.5.stable.official [991bb6a]
System information
Debian 11 (bullseye), OpenGL ES 3.0 Renderer: Mesa DRI Intel(R) HD Graphics 4400 (HSW GT2) Async. shader compilation: OFF
Issue description
Editor crash when attempting to bake a
NavigationMeshInstance
with Parsed Geometry (geometry_parsed_geometry_type
) set to Static Colliders with aPlaneShape
andConvexPolygon
as descendants.Steps to reproduce
Your best bet is to simply use the attached MRP, that being said:
Create this structure:
The first collision shape should be a PlaneShape.
MeshInstance2 is translated 1 unit in the Y direction.
The second collision shape is a ConvexPolygon and was generated from MeshInstance2; its settings look like:
(If you change the z value for any of the four points, the crash no longer occurs.)
Under NavigationMeshInstance create a NavMesh. Change Geoemtry -> Parsed Geometry to Static Colliders. Click Bake NavMesh. The crash should occur.
Minimal reproduction project
nav_bake_crash_mrp.zip
The text was updated successfully, but these errors were encountered: