Skip to content

Conversation

@smix8
Copy link
Contributor

@smix8 smix8 commented Apr 12, 2025

Adds GridMap octant queries.

Requires #105329 to be merged first.

Adds octant query functions as a performance alternative to the existing cell functions.

E.g. when only a few cells for some specific octants are needed, e.g. inside some AABB bounds, and not all the cells of the entire GridMap which creates potentially a slow array with thousands of entries.

TypedArray[Vector3i] get_used_octants()
Returns the octant coordinates as Vector3i of all octants that have at least 1 cell in use.

TypedArray[Vector3i] get_used_octants_by_item( p_item: int)
Returns the used octant coordinates of all octants that have at least 1 cell with the specific cell item in use.

TypedArray[Vector3i] get_used_cells_in_octant(p_octant_coords: Vector3i)
Returns the used cell coordinates of all the cells inside the specific octant coordinate.

TypedArray[Vector3i] get_used_cells_in_octant_by_item(p_octant_coords: Vector3i, p_item: int)
Returns the used cell coordinates of all the cells inside the specific octant coordinate that have the specific cell item in use.

TypedArray[Vector3i] get_used_octants_in_bounds(p_bounds: AABB)
Returns the used octant coordinates of all octants that have at least 1 cell used with the specific local bounds.

Vector3i get_octant_coords_from_cell_coords(p_cell_coords: Vector3i)
Script helper to convert cell coordinate to octant coordinate for the octant related query functions.

@smix8 smix8 requested review from a team as code owners April 12, 2025 23:52
@smix8 smix8 added this to the 4.5 milestone Apr 12, 2025
@smix8 smix8 force-pushed the gridmap_octant_query branch 5 times, most recently from 7d50194 to 1f5f668 Compare April 13, 2025 12:42
@smix8 smix8 marked this pull request as draft April 13, 2025 12:49
@smix8 smix8 force-pushed the gridmap_octant_query branch from 1f5f668 to cf5946c Compare April 13, 2025 15:25
@smix8 smix8 marked this pull request as ready for review April 13, 2025 17:29
Copy link
Member

@rburing rburing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functionality looks good, and I would say the debug PR already justifies adding this API. I have just some comments on the docs.

@smix8 smix8 force-pushed the gridmap_octant_query branch 2 times, most recently from 36f8d01 to bf81b6f Compare April 22, 2025 23:57
@smix8
Copy link
Contributor Author

smix8 commented Apr 23, 2025

I realized that I needed 2 native functions to get cells and octants inside AABBs that can skip Variant / TypedArray. Need them to speed up e.g. navmesh parsing or editor plugin that are really slow on larger GridMaps. So I added get_index_keys_in_bounds() and get_octant_keys_in_bounds().

Realizing further that so many new queries will turn into a nice bug surface at some point I also added some GridMap tests to cover the basics.

@smix8 smix8 requested a review from a team April 23, 2025 00:07
@smix8 smix8 force-pushed the gridmap_octant_query branch from bf81b6f to ce14fee Compare April 23, 2025 00:39
@smix8 smix8 changed the title Add GridMap octant related queries Add GridMap octant related queries and tests Apr 23, 2025
@smix8 smix8 force-pushed the gridmap_octant_query branch from ce14fee to 4a22ba2 Compare April 23, 2025 00:40
@smix8 smix8 force-pushed the gridmap_octant_query branch from 4a22ba2 to 8c2bfd4 Compare April 23, 2025 23:35
@smix8 smix8 requested a review from rburing April 23, 2025 23:36
@smix8 smix8 force-pushed the gridmap_octant_query branch from 8c2bfd4 to f682d5e Compare May 15, 2025 21:00
@smix8 smix8 force-pushed the gridmap_octant_query branch 2 times, most recently from db0bf33 to d281cf4 Compare June 10, 2025 15:01
@smix8 smix8 modified the milestones: 4.5, 4.6 Jun 18, 2025
Adds GridMap octant queries and tests.
@smix8 smix8 force-pushed the gridmap_octant_query branch from d281cf4 to 39d8f64 Compare October 30, 2025 17:04
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.

6 participants