mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-22 11:56:49 +01:00
Backported from godot4: Fix cell_height for navigation meshes
Fixes `cell_height` for navigation meshes.
- smix8
180a5cded1
This commit is contained in:
parent
c326722a65
commit
2f036edcc5
@ -347,7 +347,7 @@
|
||||
<return type="float" />
|
||||
<argument index="0" name="map" type="RID" />
|
||||
<description>
|
||||
Returns the map cell size.
|
||||
Returns the map cell size used to rasterize the navigation mesh vertices.
|
||||
</description>
|
||||
</method>
|
||||
<method name="map_get_closest_point" qualifiers="const">
|
||||
@ -447,7 +447,7 @@
|
||||
<argument index="0" name="map" type="RID" />
|
||||
<argument index="1" name="cell_size" type="float" />
|
||||
<description>
|
||||
Set the map cell size used to weld the navigation mesh polygons.
|
||||
Sets the map cell size used to rasterize the navigation mesh vertices. Must match with the cell size of the used navigation meshes.
|
||||
</description>
|
||||
</method>
|
||||
<method name="map_set_edge_connection_margin">
|
||||
|
@ -103,10 +103,10 @@
|
||||
[b]Note:[/b] While baking, this value will be rounded up to the nearest multiple of [member cell_size].
|
||||
</member>
|
||||
<member name="cell_height" type="float" setter="set_cell_height" getter="get_cell_height" default="0.25">
|
||||
The Y axis cell size to use for fields.
|
||||
The cell height used to rasterize the navigation mesh vertices on the Y axis. Must match with the cell height on the navigation map.
|
||||
</member>
|
||||
<member name="cell_size" type="float" setter="set_cell_size" getter="get_cell_size" default="0.25">
|
||||
The XZ plane cell size to use for fields.
|
||||
The cell size used to rasterize the navigation mesh vertices on the XZ plane. Must match with the cell size on the navigation map.
|
||||
</member>
|
||||
<member name="detail_sample_distance" type="float" setter="set_detail_sample_distance" getter="get_detail_sample_distance" default="6.0">
|
||||
The sampling distance to use when generating the detail mesh, in cell unit.
|
||||
|
@ -369,16 +369,16 @@
|
||||
</method>
|
||||
<method name="map_get_cell_height" qualifiers="const">
|
||||
<return type="float" />
|
||||
<argument index="0" name="map" type="RID" />
|
||||
<param index="0" name="map" type="RID" />
|
||||
<description>
|
||||
Returns the map cell height.
|
||||
Returns the map cell height used to rasterize the navigation mesh vertices on the Y axis.
|
||||
</description>
|
||||
</method>
|
||||
<method name="map_get_cell_size" qualifiers="const">
|
||||
<return type="float" />
|
||||
<argument index="0" name="map" type="RID" />
|
||||
<description>
|
||||
Returns the map cell size.
|
||||
Returns the map cell size used to rasterize the navigation mesh vertices on the XZ plane.
|
||||
</description>
|
||||
</method>
|
||||
<method name="map_get_closest_point" qualifiers="const">
|
||||
@ -495,7 +495,7 @@
|
||||
<argument index="0" name="map" type="RID" />
|
||||
<argument index="1" name="cell_height" type="float" />
|
||||
<description>
|
||||
Set the map cell height used to weld the navigation mesh polygons.
|
||||
Sets the map cell height used to rasterize the navigation mesh vertices on the Y axis. Must match with the cell height of the used navigation meshes.
|
||||
</description>
|
||||
</method>
|
||||
<method name="map_set_cell_size">
|
||||
|
@ -1352,8 +1352,9 @@ void NavMap::clip_path(const LocalVector<gd::NavigationPoly> &p_navigation_polys
|
||||
|
||||
NavMap::NavMap() {
|
||||
up = Vector3(0, 1, 0);
|
||||
cell_size = 0.25;
|
||||
cell_height = 0.25;
|
||||
/// each cell has the following cell_size and cell_height.
|
||||
cell_size = 0.25; // Must match ProjectSettings default 3D cell_size and NavigationMesh cell_size.
|
||||
cell_height = 0.25; // Must match ProjectSettings default 3D cell_height and NavigationMesh cell_height.
|
||||
edge_connection_margin = 0.25;
|
||||
regenerate_polygons = true;
|
||||
regenerate_links = true;
|
||||
|
@ -113,6 +113,10 @@ void NavRegion::update_polygons() {
|
||||
ERR_PRINT_ONCE(vformat("Navigation map synchronization error. Attempted to update a navigation region with a navigation mesh that uses a `cell_size` of %s while assigned to a navigation map set to a `cell_size` of %s. The cell size for navigation maps can be changed by using the NavigationServer map_set_cell_size() function. The cell size for default navigation maps can also be changed in the ProjectSettings.", double(map->get_cell_size()), double(mesh->get_cell_size())));
|
||||
}
|
||||
|
||||
if (!Math::is_equal_approx(double(map->get_cell_height()), double(mesh->get_cell_height()))) {
|
||||
ERR_PRINT_ONCE("Navigation map synchronization error. Attempted to update a navigation region with a navigation mesh that uses a different `cell_height` than the `cell_height` set on the navigation map.");
|
||||
}
|
||||
|
||||
if (map && Math::rad2deg(map->get_up().angle_to(transform.basis.get_column(1))) >= 90.0f) {
|
||||
ERR_PRINT_ONCE(vformat("Navigation map synchronization error. Attempted to update a navigation region with a navigation mesh that uses a `cell_height` of %s while assigned to a navigation map set to a `cell_height` of %s. The cell height for navigation maps can be changed by using the NavigationServer map_set_cell_height() function. The cell height for default navigation maps can also be changed in the ProjectSettings.", double(map->get_cell_height()), double(mesh->get_cell_height())));
|
||||
}
|
||||
|
@ -641,8 +641,8 @@ void NavigationMesh::_validate_property(PropertyInfo &property) const {
|
||||
}
|
||||
|
||||
NavigationMesh::NavigationMesh() {
|
||||
cell_size = 0.25f;
|
||||
cell_height = 0.25f;
|
||||
cell_size = 0.25f; // Must match ProjectSettings default 3D cell_size and NavigationServer NavMap cell_size.
|
||||
cell_height = 0.25f; // Must match ProjectSettings default 3D cell_height and NavigationServer NavMap cell_height.
|
||||
agent_height = 1.5f;
|
||||
agent_radius = 0.5f;
|
||||
agent_max_climb = 0.25f;
|
||||
|
@ -426,7 +426,7 @@ RID NavigationPolygon::get_rid() const {
|
||||
|
||||
NavigationPolygon::NavigationPolygon() {
|
||||
agent_radius = 10.0f;
|
||||
cell_size = 1.0f;
|
||||
cell_size = 1.0f; // Must match ProjectSettings default 2D cell_size.
|
||||
|
||||
parsed_geometry_type = PARSED_GEOMETRY_MESH_INSTANCES;
|
||||
collision_mask = 0xFFFFFFFF;
|
||||
|
Loading…
Reference in New Issue
Block a user