Skip to content

Navigation.map_get_path() non optimal path when using travel_cost #66128

@Begah

Description

@Begah

Godot version

4.0 beta1

System information

Popos x11

Issue description

The navigation server doesn't seem to give the optimal path when travel_cost is added.
From testing, region_set_travel_cost does affect the path, but the result isn't optimal.
For example :
GodotNavigationMinimum

Start point is the green point and end is the red point.
The blue line show what the rendering server give meanwhile the black line is what is expected.

The cost of travel of the right white area is 120 while the cost of travel of the purple/pink is 1, thus the travel time during the white part should be minimal.

Another example, this time the yellow/green area has a cost of travel at 0:
GodotNavigationMinimum2

As before the blue line is what the navigation server is giving while the black one is what it should give (or probably the same as before, but i didn't do the math..., atleast not at all what the navigation server is reporting).

I may try and take a look at fixing this issue but path finding is an area of computer science i'm yet to really dig into so i don't have the skills.

It may also be expected behavior, if it is then my apology for waisting your time.

I'm happy to provide additional info

Steps to reproduce

Download the project zip, and while in the editor, select the main node and click twice on the 'toggle run' button, or click until the label switches to 'Running'
Then recalculate path with the button 'calculate path' (property of the main node')
Each region can be adjusted via the property start end cost, but the path needs to be then recalculated.

This projects runs inside the editor directly

Minimal reproduction project

TestNav.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions