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

Make Collider optional, allowing usage without Parry or Nalgebra #327

Merged
merged 2 commits into from
Feb 18, 2024

Conversation

Jondolf
Copy link
Owner

@Jondolf Jondolf commented Feb 18, 2024

Objective

#311 added support for custom collider backends. However, the default Collider still remains, which requires the Parry and Nalgebra dependencies which are unnecessary if your collision backend doesn't use them.

Collider and Parry should be optional.

Solution

Add three feature flags: default-collider, parry-f32, and parry-f64. parry-f32 is a default feature that also enables default-collider.

The Parry features are unfortunately necessary, because Parry is split into separate crates for f32 and f64, and we can't reuse the f32 and f64 feature flags, because then the dependencies wouldn't be optional.

Not having the default-collider feature disables Collider, the default collision backend using it, the SpatialQueryPipeline, the SpatialQuery system parameter, and ShapeCaster. The RayCaster is still available for now, but it doesn't actually raycast unless users implement the functionality themselves.


Changelog

  • Add three feature flags: default-collider, parry-f32, and parry-f64
  • ColliderAabb no longer uses Parry's AABB, and it has new methods

Migration Guide

  • If using bevy_xpbd without default features, add either the parry-f32 or parry-f64 feature, unless you have a custom collision backend

@Jondolf Jondolf added C-Enhancement New feature or request A-Collision Relates to the broad phase, narrow phase, colliders, or other collision functionality labels Feb 18, 2024
@Jondolf Jondolf merged commit 03fe23e into main Feb 18, 2024
4 checks passed
@Jondolf Jondolf deleted the optional-collider branch February 18, 2024 03:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Collision Relates to the broad phase, narrow phase, colliders, or other collision functionality C-Enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant