Skip to content

Conversation

@unpairedbracket
Copy link
Contributor

Objective

  • Enable downstream library users to access all of the SpatialQueryPipeline constituents needed to implement methods like cast_shape.

Solution

  • New methods dispatcher_ref() { self.dispatcher.as_ref() } and entity(index) { self.proxies[index].entity } implemented rather than just making the fields pub to ensure downstreams can only use the values, not mess with them in any ways that could compromise correctness
  • New type-erased ( -> impl TypedCompositeShape, so that the return types don't have to be made pub) versions of the existing as_composite_shape* methods, renaming the existing ones by adding _internal. I think it would be possible to replace the existing versions with these new ones altogether, but I worried that might prove unnecessarily restrictive in future. Alternatively could just make the existing methods and their return types public.

Changelog

Added

  • New public methods on SpatialQueryPipeline that allow downstream crates to implement additional spatial queries
    • as_composite_shape/as_composite_shape_with_predicate return composite shapes representing the Avian world, usable with parry's bvh/spatial query machinery
    • dispatcher_ref returns a reference to the QueryDispatcher used by the pipeline
    • entity(idx) fetches the Entity referred to by the given index in the pipeline's BVH. Useful for interpreting the results of parry queries, which refer to colliders by their index within the BVH

@Jondolf Jondolf added C-Feature A new feature, making something new possible A-Spatial-Query Relates to spatial queries, such as ray casting, shape casting, and intersection tests labels Oct 12, 2025
@Jondolf Jondolf added this to the 0.4 milestone Oct 12, 2025
Copy link
Member

@Jondolf Jondolf left a comment

Choose a reason for hiding this comment

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

Thanks! These names look fine, and I'm happy to expose the methods to unblock custom query use cases. The details will likely change with upcoming spatial query reworks (ex: #810), but these are relatively advanced APIs anyway, so I'm not too concerned about breaking users there

@Jondolf Jondolf merged commit 30359c8 into avianphysics:main Oct 12, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Spatial-Query Relates to spatial queries, such as ray casting, shape casting, and intersection tests C-Feature A new feature, making something new possible

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants