laundmo / bevy-spatial

Spatial datastructures for Bevy
Other
150 stars 17 forks source link

R-tree recreate_after setting only applies on entity updates #9

Closed cBournhonesque closed 1 year ago

cBournhonesque commented 1 year ago

I noticed that you have the setting for R-star: recreate_after, which is the threshold of moved entities above which we recreate the whole tree. I was wondering why this threshold is only applied to existing entities that moved. I can see here (https://github.com/laundmo/bevy-spatial/blob/main/src/spatial_access.rs#L106) that for added entities the threshold is not used, only the total size of the tree is used.

Shouldn't the threshold be used for any case where we update the tree with add_point ? (i.e. the sum of added + moved entities)?

We have the threshold because calling 100x add_point can be slower than re-creating the tree from scratch, right? In your experience, what is a good value for this parameter?

laundmo commented 1 year ago

Oh nice catch, and about 100 is what i'd do. feel free to pr a fix for that!

laundmo commented 1 year ago

closed by: #10