Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use masks instead of collision layers for SpatialQueryFilter #61

Merged
merged 2 commits into from
Jul 8, 2023

Conversation

Jondolf
Copy link
Owner

@Jondolf Jondolf commented Jul 8, 2023

Replaces collision layers (groups and masks) with just masks in SpatialQueryFilter. Spatial queries don't necessarily exist as physical objects in the world, so it doesn't make sense for them to belong in groups, and this also just makes the API nicer.

Methods

Removed with_layers in favor of:

  • with_masks_from_bits
  • with_masks

Example

// Previously
let query_filter = SpatialQueryFilter::new().with_layers(CollisionLayers::from_bits(0xffff_ffff, 0b1011));

// Now
let query_filter = SpatialQueryFilter::new().with_masks_from_bits(0b1011);

@Jondolf Jondolf added the C-Enhancement New feature or request label Jul 8, 2023
Making `with_mask` additive can be a footgun since the default is all masks,
so it now sets the masks
@Jondolf Jondolf merged commit b3151bb into main Jul 8, 2023
@Jondolf Jondolf deleted the spatial-query-filter-masks branch July 8, 2023 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant