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

Add NavigationRegion costs for 2D and 3D pathfinding #61739

Merged
merged 1 commit into from
Jun 8, 2022

Conversation

smix8
Copy link
Contributor

@smix8 smix8 commented Jun 6, 2022

Adds NavigationRegion costs for pathfinding in 2D and 3D.

Each navigationregion has two new properties.
Fixed enter_cost value for entering this region from a different region e.g. entering from "ground" region to "water" region.
Distance based travel_cost multiplier for moving on the same navmesh.

Note that since 2D converts pixel units to full 3D world pathfinding units on the navigationmap the 2D travel_cost has a tremendous effect and the 2D enter_cost value needs to be increased dramatically compared to 3D for a similar pathfinding result.

Godot 4.0 TestProject for 2D and 3D:
NavigationRegionCostTestMap.zip

navigation_region_cost

@smix8 smix8 requested review from a team as code owners June 6, 2022 03:50
@smix8 smix8 force-pushed the navigation_region_cost_4.x branch from 7343e1d to 5f261e6 Compare June 6, 2022 03:59
@smix8
Copy link
Contributor Author

smix8 commented Jun 6, 2022

I ... have no idea what is causing this one linux build to fail, help!

@akien-mga
Copy link
Member

The error is:

servers/navigation_server_2d.cpp:57:2: error: no declaration matches 'void NavigationServer2D::region_set_enter_cost(RID, real_t) const'
   57 |  NavigationServer2D::FUNC_NAME(T_0 D_0, T_1 D_1)                                      \
      |  ^~~~~~~~~~~~~~~~~~
servers/navigation_server_2d.cpp:247:6: note: in expansion of macro 'FORWARD_2_C'
  247 | void FORWARD_2_C(region_set_enter_cost, RID, p_region, real_t, p_enter_cost, rid_to_rid, real_to_real);
      |      ^~~~~~~~~~~

So you seem to have a mismatch between a prototype and a macro. Maybe argument arity, type, or constness mismatch.

@akien-mga
Copy link
Member

Maybe clash between using float and real_t in different places. The failing CI builds uses double=64 i.e. real_t is double.

@smix8 smix8 force-pushed the navigation_region_cost_4.x branch from 5f261e6 to 1ce747c Compare June 6, 2022 12:05
@akien-mga akien-mga added this to the 4.0 milestone Jun 6, 2022
@akien-mga akien-mga added the cherrypick:3.x Considered for cherry-picking into a future 3.x release label Jun 6, 2022
@akien-mga
Copy link
Member

CC @AndreaCatania @Scony

@smix8 smix8 force-pushed the navigation_region_cost_4.x branch 2 times, most recently from 5bbd1ee to ff3d237 Compare June 6, 2022 13:16
Add NavigationRegion costs for pathfinding.
@smix8 smix8 force-pushed the navigation_region_cost_4.x branch from ff3d237 to cfdfd30 Compare June 6, 2022 13:25
@akien-mga akien-mga merged commit e4994e2 into godotengine:master Jun 8, 2022
@akien-mga
Copy link
Member

Thanks!

@smix8 smix8 deleted the navigation_region_cost_4.x branch June 8, 2022 15:52
@akien-mga akien-mga removed the cherrypick:3.x Considered for cherry-picking into a future 3.x release label Jun 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants