bevy_xpbd icon indicating copy to clipboard operation
bevy_xpbd copied to clipboard

Optimize shapecasting with multiple hits

Open Jondolf opened this issue 1 year ago • 0 comments
trafficstars

Currently, SpatialQuery::shape_hits and SpatialQuery::shape_hits_callback can compute multiple hits by performing multiple best-first traversals in a loop. At each iteration, the entity that was hit is added to the excluded entities so that it gets filtered in the next iteration.

This is inefficient. The methods should be changed to only traverse the QBVH acceleration structure once, potentially with a depth-first traversal like SpatialQuery::ray_hits and SpatialQuery::ray_hits_callback.

Jondolf avatar Jul 06 '24 14:07 Jondolf